Python

Provides python bindings, some helper functions and async management.

Python.PythonModule

Defines the Python module which sets up the Python interpreter and imports required modules and constants.

source
Python._INITIALIZEDConstant

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

source
Python.PythonAsyncType

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::Python.PythonAsync,
    pa_from::Python.PythonAsync
) -> Bool
source
Python.__pyfetchMethod

Fetches the result of a Python function call synchronously and returns an exception if any.

__pyfetch(f::Py, ::Val{:try}, args...; kwargs...) -> Any
source
Python.__pyfetchMethod

Fetches the result of a Python function call synchronously.

__pyfetch(f::Py, args...; kwargs...) -> Any
source
Python._async_initMethod

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

_async_init(pa::Python.PythonAsync)
source
Python._pyfetchMethod

Fetches the result of a Julia function call synchronously.

_pyfetch(f::Function, args...; kwargs...) -> Any
source
Python._pyfetch_timeoutMethod

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::Py,
    f2::Union{Function, Py},
    timeout::Dates.Period,
    args...;
    kwargs...
) -> Any
source
Python.py_start_loopFunction

Starts a python event loop, updating pa.

py_start_loop()
py_start_loop(pa::Python.PythonAsync)
source
Python.pycancelFunction

Cancels a Python future.

pycancel(fut::Py) -> Bool
pycancel(fut::Py, ::Bool) -> Bool
source
Python.pyloop_stop_fnMethod

Generates a function that terminates the python even loop.

pyloop_stop_fn() -> Python.var"#fn#pyloop_stop_fn##0"
source
Python.pyscheduleMethod

Schedules a Python coroutine to run on the event loop.

pyschedule(coro::Py) -> Py
source
Python.pytaskMethod

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

pytask(f::Py, args...; kwargs...) -> Task
source
Python.pytaskMethod

Creates a Julia task from a Python coroutine and returns the Python future and the Julia task.

pytask(coro::Py) -> Task
source
Python.pytofloatMethod
pytofloat(v::Py, def::T)::T where {T<:Number}

Convert a Python value to a Julia float, with a default value.
source
Python.@pystrMacro
@pystr(k, v=nothing)

Convert a Julia value to a Python string representation.
source