PlanarPython
Provides python bindings, some helper functions and async management.
PlanarPython.PlanarPython — Module
Defines the PlanarPython module which sets up the Python interpreter and imports required modules and constants.
PlanarPython.CALLBACKS — Constant
An array of callback functions.
PlanarPython.PYMODPATHS — Constant
An array of Python module paths.
PlanarPython.PYTHONPATH — Constant
The Python module search path.
PlanarPython.PY_V — Constant
The Python version.
PlanarPython._INITIALIZED — Constant
This constant indicates whether the Python runtime has been initialized. It is used to delay initialization until the first Python call.
PlanarPython.pyCached — Constant
A dictionary for caching Python objects.
PlanarPython.pyisvalue_func — Constant
A Python object used for checking if a value is a Python object.
PlanarPython.pytryfloat — Constant
A Python object used for converting values to float.
PlanarPython.PythonAsync — Type
A structure for handling Python's asynchronous operations.
pyaiopythreadspylooppycoro_typeglobsstart_functasktask_running
This structure is used to manage Python's asynchronous operations. It contains fields for Python's asyncio, threads, event loop, coroutine type, global variables, start function, and task status.
PythonCall.PyDict — Method
PyDict(p::Pair)
Create a Python dictionary from a pair.Base.copyto! — Method
Copies a python async structures.
copyto!(
pa_to::PlanarPython.PythonAsync,
pa_from::PlanarPython.PythonAsync
) -> Bool
PlanarPython.__pyfetch — Method
Fetches the result of a Python function call synchronously and returns an exception if any.
__pyfetch(
f::PythonCall.Py,
::Val{:try},
args...;
kwargs...
) -> Any
PlanarPython.__pyfetch — Method
Fetches the result of a Python function call synchronously.
__pyfetch(f::PythonCall.Py, args...; kwargs...) -> Any
PlanarPython._async_init — Method
Initialized a PythonAsync structure (which holds a reference to the event loop.)
_async_init(pa::PlanarPython.PythonAsync)
PlanarPython._isfutdone — Method
Checks if a Python future is done.
_isfutdone(fut::PythonCall.Py) -> Bool
PlanarPython._pyfetch — Method
Fetches the result of a Julia function call synchronously.
_pyfetch(f::Function, args...; kwargs...) -> Any
PlanarPython._pyfetch_timeout — Method
Fetches the result of a Python function call synchronously with a timeout. If the timeout is reached, it calls another function and returns its result.
_pyfetch_timeout(
f1::PythonCall.Py,
f2::Union{Function, PythonCall.Py},
timeout::Dates.Period,
args...;
kwargs...
) -> Any
PlanarPython.async_start_runner_func! — Method
Main async loop function, sleeps indefinitely and closes loop on exception.
async_start_runner_func!(pa) -> PythonCall.Py
PlanarPython.clearpypath! — Method
Remove wrong python version libraries dirs from python loading path.
PlanarPython.isdict — Method
Test whether a Python object is a dictionary.
PlanarPython.isinitialized_async — Method
Checks if python async state (event loop) is initialized.
isinitialized_async(pa::PlanarPython.PythonAsync) -> Bool
PlanarPython.islist — Method
Test whether a Python object is a list.
PlanarPython.py_except_name — Method
py_except_name(e::PyException)
Get the name of a Python exception.PlanarPython.py_start_loop — Function
Starts a python event loop, updating pa.
py_start_loop()
py_start_loop(pa::PlanarPython.PythonAsync)
PlanarPython.pycancel — Function
Cancels a Python future.
pycancel(fut::PythonCall.Py) -> Bool
pycancel(fut::PythonCall.Py, ::Bool) -> Bool
PlanarPython.pydicthash — Method
pydicthash(d)
Calculate the hash of a Python dictionary.PlanarPython.pyisnonzero — Method
pyisnonzero(v::Py)::Bool
Check if a Python value is nonzero.PlanarPython.pylist_to_matrix — Method
pylist_to_matrix(data::Py)
Convert a Python list to a Julia matrix.PlanarPython.pyloop_stop_fn — Method
Generates a function that terminates the python even loop.
pyloop_stop_fn() -> PlanarPython.var"#fn#pyloop_stop_fn##0"
PlanarPython.pyschedule — Method
Schedules a Python coroutine to run on the event loop.
pyschedule(coro::PythonCall.Py) -> PythonCall.Py
PlanarPython.pytask — Method
Creates a Julia task from a Python function call and runs it asynchronously.
pytask(f::PythonCall.Py, args...; kwargs...) -> Task
PlanarPython.pytask — Method
Creates a Julia task from a Python coroutine and returns the Python future and the Julia task.
pytask(coro::PythonCall.Py) -> Task
PlanarPython.pytofloat — Method
pytofloat(v::Py, def::T)::T where {T<:Number}
Convert a Python value to a Julia float, with a default value.PlanarPython.pywait_fut — Method
Waits for a Python future to be done.
pywait_fut(
fut::PythonCall.Py
) -> Union{Nothing, PythonCall.Py}
PlanarPython.@pymodule — Macro
Import a python module over a variable defined in global scope.
PlanarPython.@pystr — Macro
@pystr(k, v=nothing)
Convert a Julia value to a Python string representation.