Python
Provides python bindings, some helper functions and async management.
Python.Python
— ModuleDefines the Python module which sets up the Python interpreter and imports required modules and constants.
Python.CALLBACKS
— ConstantAn array of callback functions.
Python.PYMODPATHS
— ConstantAn array of Python module paths.
Python.PYTHONPATH
— ConstantThe Python module search path.
Python.PY_V
— ConstantThe Python version.
Python._INITIALIZED
— ConstantThis constant indicates whether the Python runtime has been initialized. It is used to delay initialization until the first Python call.
Python.pyCached
— ConstantA dictionary for caching Python objects.
Python.pyisvalue_func
— ConstantA Python object used for checking if a value is a Python object.
Python.pytryfloat
— ConstantA Python object used for converting values to float.
Python.PythonAsync
— TypeA 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.
PythonCall.Wrap.PyDict
— MethodPyDict(p::Pair)
Create a Python dictionary from a pair.
Base.copyto!
— MethodCopies a python async structures.
copyto!(
pa_to::Python.PythonAsync,
pa_from::Python.PythonAsync
) -> Bool
Python.__pyfetch
— MethodFetches the result of a Python function call synchronously and returns an exception if any.
__pyfetch(f::Py, ::Val{:try}, args...; kwargs...) -> Any
Python.__pyfetch
— MethodFetches the result of a Python function call synchronously.
__pyfetch(f::Py, args...; kwargs...) -> Any
Python._async_init
— MethodInitialized a PythonAsync structure (which holds a reference to the event loop.)
_async_init(pa::Python.PythonAsync)
Python._isfutdone
— MethodChecks if a Python future is done.
_isfutdone(fut::Py) -> Bool
Python._pyfetch
— MethodFetches the result of a Julia function call synchronously.
_pyfetch(f::Function, args...; kwargs...) -> Any
Python._pyfetch_timeout
— MethodFetches 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.async_start_runner_func!
— MethodMain async loop function, sleeps indefinitely and closes loop on exception.
async_start_runner_func!(pa) -> Py
Python.clearpypath!
— MethodRemove wrong python version libraries dirs from python loading path.
Python.isdict
— MethodTest whether a Python object is a dictionary.
Python.isinitialized_async
— MethodChecks if python async state (event loop) is initialized.
isinitialized_async(pa::Python.PythonAsync) -> Bool
Python.islist
— MethodTest whether a Python object is a list.
Python.py_except_name
— Methodpy_except_name(e::PyException)
Get the name of a Python exception.
Python.py_start_loop
— FunctionStarts a python event loop, updating pa
.
py_start_loop()
py_start_loop(pa::Python.PythonAsync)
Python.pycancel
— FunctionCancels a Python future.
pycancel(fut::Py) -> Bool
pycancel(fut::Py, ::Bool) -> Bool
Python.pydicthash
— Methodpydicthash(d)
Calculate the hash of a Python dictionary.
Python.pyisnonzero
— Methodpyisnonzero(v::Py)::Bool
Check if a Python value is nonzero.
Python.pylist_to_matrix
— Methodpylist_to_matrix(data::Py)
Convert a Python list to a Julia matrix.
Python.pyloop_stop_fn
— MethodGenerates a function that terminates the python even loop.
pyloop_stop_fn() -> Python.var"#fn#7"
Python.pyschedule
— MethodSchedules a Python coroutine to run on the event loop.
pyschedule(coro::Py) -> Py
Python.pytask
— MethodCreates a Julia task from a Python function call and runs it asynchronously.
pytask(f::Py, args...; kwargs...) -> Task
Python.pytask
— MethodCreates a Julia task from a Python coroutine and returns the Python future and the Julia task.
pytask(coro::Py) -> Task
Python.pytofloat
— Methodpytofloat(v::Py, def::T)::T where {T<:Number}
Convert a Python value to a Julia float, with a default value.
Python.pywait_fut
— MethodWaits for a Python future to be done.
pywait_fut(fut::Py) -> Union{Nothing, Py}
Python.@pymodule
— MacroImport a python module over a variable defined in global scope.
Python.@pystr
— Macro@pystr(k, v=nothing)
Convert a Julia value to a Python string representation.