SnakeBridge.Adapter (SnakeBridge v0.7.5)

View Source

Provides the use SnakeBridge.Adapter macro for generated Python adapters.

When you use SnakeBridge.Adapter, it imports the __python_call__/2 function that generated adapters use to call Python functions via Snakepit.

Example

defmodule MyApp.Math do
  use SnakeBridge.Adapter

  @spec sqrt(number()) :: float()
  def sqrt(x) do
    __python_call__("sqrt", [x])
  end
end

The adapter module tracks the Python module name and provides the runtime bridge to execute Python functions.

Summary

Functions

Calls a Python function with the given arguments using SnakeBridge.Runtime.

Functions

__python_call__(func_name, args)

@spec __python_call__(String.t(), list()) ::
  {:ok, term()} | {:error, Snakepit.Error.t()}

Calls a Python function with the given arguments using SnakeBridge.Runtime.