PlanarPython

Provides python bindings, some helper functions and async management.

PlanarPython._INITIALIZED — Constant

This constant indicates whether the Python runtime has been initialized. It is used to delay initialization until the first Python call.

source
PlanarPython.PythonAsync — Type

A structure for handling Python's asynchronous operations.

  • pyaio

  • pythreads

  • pyloop

  • pycoro_type

  • globs

  • start_func

  • task

  • task_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.

source
Base.copyto! — Method

Copies a python async structures.

copyto!(
    pa_to::PlanarPython.PythonAsync,
    pa_from::PlanarPython.PythonAsync
) -> Bool
source
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
source
PlanarPython.__pyfetch — Method

Fetches the result of a Python function call synchronously.

__pyfetch(f::PythonCall.Py, args...; kwargs...) -> Any
source
PlanarPython._async_init — Method

Initialized a PythonAsync structure (which holds a reference to the event loop.)

_async_init(pa::PlanarPython.PythonAsync)
source
PlanarPython._pyfetch — Method

Fetches the result of a Julia function call synchronously.

_pyfetch(f::Function, args...; kwargs...) -> Any
source
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
source
PlanarPython.pycancel — Function

Cancels a Python future.

pycancel(fut::PythonCall.Py) -> Bool
pycancel(fut::PythonCall.Py, ::Bool) -> Bool
source
PlanarPython.pytask — Method

Creates a Julia task from a Python function call and runs it asynchronously.

pytask(f::PythonCall.Py, args...; kwargs...) -> Task
source
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
source
PlanarPython.pytofloat — Method
pytofloat(v::Py, def::T)::T where {T<:Number}

Convert a Python value to a Julia float, with a default value.
source