PythonCall API Reference

Py objects

Missing docstring.

Missing docstring for Py. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pybuiltins. Check Documenter's build log for details.

Constructors

These functions construct Python objects of builtin types from Julia values.

Missing docstring.

Missing docstring for pybool. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pycollist. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pybytes. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pycomplex. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pydict. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyfloat. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyfrozenset. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyint. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pylist. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyrange. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyrowlist. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyset. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyslice. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pystr. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pytuple. Check Documenter's build log for details.

Builtins

These functions mimic the Python builtin functions or keywords of the same name.

Missing docstring.

Missing docstring for pyall. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyany. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyascii. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pycall. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pycallable. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pycompile. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pycontains. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pydelattr. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pydelitem. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pydir. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyeval. Check Documenter's build log for details.

Missing docstring.

Missing docstring for @pyeval. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyexec. Check Documenter's build log for details.

Missing docstring.

Missing docstring for @pyexec. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pygetattr. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pygetitem. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyhasattr. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyhasitem. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyhash. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyhelp. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyimport. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyin. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyis. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyisinstance. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyissubclass. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyiter. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pylen. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pynext. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyprint. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyrepr. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pysetattr. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pysetitem. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pytype(::Any). Check Documenter's build log for details.

Missing docstring.

Missing docstring for pywith. Check Documenter's build log for details.

Conversion to Julia

These functions convert Python values to Julia values, using the rules documented here.

Missing docstring.

Missing docstring for pyconvert. Check Documenter's build log for details.

Missing docstring.

Missing docstring for @pyconvert. Check Documenter's build log for details.

Wrap Julia values

These functions explicitly wrap Julia values into Python objects, documented here.

As documented here, Julia values are wrapped like this automatically on conversion to Python, unless the value is immutable and has a corresponding Python type.

Missing docstring.

Missing docstring for pyjl. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyjlraw. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyisjl. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyjlvalue. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pybinaryio. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pytextio. Check Documenter's build log for details.

Arithmetic

These functions are equivalent to the corresponding Python arithmetic operators.

Note that the equivalent Julia operators are overloaded to call these when all arguments are Py (or Number). Hence the following are equivalent: Py(1)+Py(2), Py(1)+2, pyadd(1, 2), pyadd(Py(1), Py(2)), etc.

Missing docstring.

Missing docstring for pyneg. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pypos. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyabs. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyinv. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyindex. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyadd. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pysub. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pymul. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pymatmul. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pypow. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyfloordiv. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pytruediv. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pymod. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pydivmod. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pylshift. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyrshift. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyand. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyxor. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyor. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyiadd. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyisub. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyimul. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyimatmul. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyipow. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyifloordiv. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyitruediv. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyimod. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyilshift. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyirshift. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyiand. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyixor. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyior. Check Documenter's build log for details.

Logic

These functions are equivalent to the corresponding Python logical operators.

Note that the equivalent Julia operators are overloaded to call these when all arguments are Py (or Number). Hence the following are equivalent: Py(1) < Py(2), Py(1) < 2, pylt(1, 2), pylt(Py(1), Py(2)), etc.

Note that the binary operators by default return Py (not Bool) since comparisons in Python do not necessarily return bool.

Missing docstring.

Missing docstring for pytruth. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pynot. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyeq. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyne. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyle. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pylt. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyge. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pygt. Check Documenter's build log for details.

Create classes

These functions can be used to create new Python classes where the functions are implemented in Julia. You can instead use @pyeval etc. to create pure-Python classes.

Missing docstring.

Missing docstring for pytype(::Any, ::Any, ::Any). Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyfunc. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyclassmethod. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pystaticmethod. Check Documenter's build log for details.

Missing docstring.

Missing docstring for pyproperty. Check Documenter's build log for details.

Wrapper types

The following types wrap a Python object, giving it the semantics of a Julia object. For example PyList(x) interprets the Python sequence x as a Julia abstract vector.

Apart from a few fundamental immutable types, conversion from Python to Julia Any will return a wrapper type such as one of these, or simply Py if no wrapper type is suitable.

Missing docstring.

Missing docstring for PyList. Check Documenter's build log for details.

Missing docstring.

Missing docstring for PySet. Check Documenter's build log for details.

Missing docstring.

Missing docstring for PyDict. Check Documenter's build log for details.

Missing docstring.

Missing docstring for PyIterable. Check Documenter's build log for details.

Missing docstring.

Missing docstring for PyArray. Check Documenter's build log for details.

Missing docstring.

Missing docstring for PyIO. Check Documenter's build log for details.

Missing docstring.

Missing docstring for PyTable. Check Documenter's build log for details.

Missing docstring.

Missing docstring for PyPandasDataFrame. Check Documenter's build log for details.

Missing docstring.

Missing docstring for PyObjectArray. Check Documenter's build log for details.

Missing docstring.

Missing docstring for PyException. Check Documenter's build log for details.

Custom wrappers

Here is a minimal example of defining a wrapper type. You may add methods, fields and a supertype to the type to specialise its behaviour. See any of the above wrapper types for examples.

# The new type with a field for the Python object being wrapped.
struct MyType
    py::Py
end

# Says that the object is a wrapper.
ispy(x::MyType) = true

# Says how to access the underlying Python object.
Py(x::MyType) = x.py

@py and @pyconst

Missing docstring.

Missing docstring for @py. Check Documenter's build log for details.

Missing docstring.

Missing docstring for @pyconst. Check Documenter's build log for details.

Low-level API

The functions here are not exported. They are mostly unsafe in the sense that you can crash Julia by using them incorrectly.

Missing docstring.

Missing docstring for PythonCall.pynew. Check Documenter's build log for details.

Missing docstring.

Missing docstring for PythonCall.pyisnull. Check Documenter's build log for details.

Missing docstring.

Missing docstring for PythonCall.pycopy!. Check Documenter's build log for details.

Missing docstring.

Missing docstring for PythonCall.getptr. Check Documenter's build log for details.

Missing docstring.

Missing docstring for PythonCall.pydel!. Check Documenter's build log for details.

Missing docstring.

Missing docstring for PythonCall.unsafe_pynext. Check Documenter's build log for details.