Skip to main content

Julia and Python in seamless harmony

Reason this release was yanked:

does not include juliacalldeps.json

Project description

PythonCall.jl logo

Project Status: Active – The project has reached a stable, usable state and is being actively developed. Stable Documentation Dev Documentation Test Status Codecov

Bringing Python® and Julia together in seamless harmony:

  • Call Python code from Julia and Julia code from Python via a symmetric interface.
  • Simple syntax, so the Python code looks like Python and the Julia code looks like Julia.
  • Intuitive and flexible conversions between Julia and Python: anything can be converted, you are in control.
  • Fast non-copying conversion of numeric arrays in either direction: modify Python arrays (e.g. bytes, array.array, numpy.ndarray) from Julia or Julia arrays from Python.
  • Helpful wrappers: interpret Python sequences, dictionaries, arrays, dataframes and IO streams as their Julia couterparts, and vice versa.
  • Beautiful stack-traces.
  • Works anywhere: tested on Windows, MacOS and Linux, 32- and 64-bit, Julia 1.0 upwards and Python 3.5 upwards.

⭐ If you like this, a GitHub star would be lovely thank you. ⭐

To get started, read the documentation.

Example 1: Calling Python from Julia

In this example, we use PythonCall.jl from a Pluto notebook to inspect the Iris dataset:

  • We load the Iris dataset as a Julia DataFrame using RDatasets.jl.
  • We use pytable(df) to convert it to a Python pandas.DataFrame.
  • We use the Python package seaborn to produce a pair-plot, which is automatically displayed.

Seaborn example screenshot

Example 2: Calling Julia from Python

In this example we use the Python module juliacall from an IPython notebook to train a simple neural network:

  • We generate some random training data using Python's numpy.
  • We construct and train a neural network model using Julia's Flux.
  • We plot some sample output from the model using Python's matplotlib.pyplot.

Flux example screenshot

What about PyCall?

The existing package PyCall is another similar interface to Python. Here we note some key differences, but a more detailed comparison is in the documentation.

  • PythonCall supports a wider range of conversions between Julia and Python, and the conversion mechanism is extensible.
  • PythonCall by default never copies mutable objects when converting, but instead directly wraps the mutable object. This means that modifying the converted object modifies the original, and conversion is faster.
  • PythonCall does not usually automatically convert results to Julia values, but leaves them as Python objects. This makes it easier to do Pythonic things with these objects (e.g. accessing methods) and is type-stable.
  • PythonCall installs dependencies into a separate conda environment for each Julia project. This means each Julia project can have an isolated set of Python dependencies.
  • PythonCall supports Julia 1.0+ and Python 3.5+ whereas PyCall supports Julia 0.7+ and Python 2.7+.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

juliacall-0.4.1.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

juliacall-0.4.1-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file juliacall-0.4.1.tar.gz.

File metadata

  • Download URL: juliacall-0.4.1.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.6.10

File hashes

Hashes for juliacall-0.4.1.tar.gz
Algorithm Hash digest
SHA256 5b9ad5f7e2534d515109333609b99ea558863716f6f76b4f0edbbbe988913bad
MD5 1b4dd5ca750b4966d376ba529e7d7ced
BLAKE2b-256 32394d85e44dba59e98ab5c6e88ecddf2ff187d5b0ae6a5feeba4b1c58357d76

See more details on using hashes here.

File details

Details for the file juliacall-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: juliacall-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.6.10

File hashes

Hashes for juliacall-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 90cacb49e0782bbed295b0ab8ed64b028c6c285271d18f8028fa45dba4184cba
MD5 f0892369d66e9e6363d79d5cfaf6081c
BLAKE2b-256 a29faa84204e8098e851fb7f463596daa5a7186302016cc706b16a355f54b320

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page