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.

Python._INITIALIZEDConstant

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

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.

Base.copyto!Method

Copies a python async structures.

copyto!(
    pa_to::Python.PythonAsync,
    pa_from::Python.PythonAsync
) -> Bool
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
Python.__pyfetchMethod

Fetches the result of a Python function call synchronously.

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

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

_async_init(pa::Python.PythonAsync)
Python._isfutdoneMethod

Checks if a Python future is done.

_isfutdone(fut::Py) -> Bool
Python._pyfetchMethod

Fetches the result of a Julia function call synchronously.

_pyfetch(f::Function, args...; kwargs...) -> Any
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
Python.clearpypath!Method

Remove wrong python version libraries dirs from python loading path.

Python.isdictMethod

Test whether a Python object is a dictionary.

Python.isinitialized_asyncMethod

Checks if python async state (event loop) is initialized.

isinitialized_async(pa::Python.PythonAsync) -> Bool
Python.py_start_loopFunction

Starts a python event loop, updating pa.

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

Cancels a Python future.

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

Generates a function that terminates the python even loop.

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

Schedules a Python coroutine to run on the event loop.

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

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

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

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

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

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

Waits for a Python future to be done.

pywait_fut(fut::Py) -> Union{Nothing, Py}
Python.@pymoduleMacro

Import a python module over a variable defined in global scope.

Python.@pystrMacro
@pystr(k, v=nothing)

Convert a Julia value to a Python string representation.