Skip to main content

Julia and Python in seamless harmony

Project description

PythonCall.jl logo
PythonCall & JuliaCall

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

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 counterparts, and vice versa.
  • Beautiful stack-traces.
  • Supports modern systems: tested on Windows, MacOS and Linux; 64-bit; Julia 1.10 upwards and Python 3.10 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 the Julia module PythonCall from a Pluto notebook to inspect the Iris dataset:

  • We load the Iris dataset as a Julia DataFrame using RDatasets.
  • 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.

Flux example screenshot

What about PyCall?

The existing package PyCall is another similar interface to Python. Here we note some key differences:.

  • 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 using CondaPkg. This means each Julia project can have an isolated set of Python dependencies.

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.9.33.tar.gz (498.3 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.9.33-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: juliacall-0.9.33.tar.gz
  • Upload date:
  • Size: 498.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"20.04","id":"focal","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for juliacall-0.9.33.tar.gz
Algorithm Hash digest
SHA256 e35b780888bbdf84f00a45e7e0707ac1d2d8dfa664e85d5c41e6e198e48adb6e
MD5 56a85f9fbf4bc5b8b25c564a6f6c4a85
BLAKE2b-256 193a2215d5d93aaaee27cb4259411f6ea480b0ce5c5f02c42a57807186e973e6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: juliacall-0.9.33-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"20.04","id":"focal","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for juliacall-0.9.33-py3-none-any.whl
Algorithm Hash digest
SHA256 614d00b989b900bfd0b3d3e7e91b1ebe50210d0c48ffb9e810352e18870bcb5f
MD5 d952c10407e6d46d321775f0753aa0f4
BLAKE2b-256 87019f1194186738db9a99206755464fd7ffbc779b304fff79b9b7907ae084e7

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