JuliaPythonAdaptor
JuliaPythonAdaptor is a small Julia/Python package that helps you to create relocatable applications integrated with Julia and Python together.
The Julia programs using JuliaPythonAdaptor can be compiled by PackageCompiler into sysimages or executables that will work on another machine, if binary-compatible.
Note that your Python binaries are NOT bundled in the compiled julia files. You should also provide a proper Python environment for the target machines.
Motivation
At the current stage, a Julia programmer suffers from the following tasks:
-
Setting up a Python environment to work with Julia.
-
Reusing an existing Python/Julia environment from another language.
-
Distributing compiled Julia binaries that interoperate with Python packages.
This project aims at providing a user-friendly approach to address all above issues.
Target Uses
-
Software Integration
If you want to make software that bundle Julia and Python together and make a separated environment, you might consider using this package or refer to the implementation.
-
Simple Python-Julia Interoperability
If your activating environment contains
juliaandpython, you don't need to consider details.
Installation
-
Install a julia (>= 1.6.1) distribution. Add it to
$PATHif you want to avoid manual configurations. -
Install a Python (3.7+) distribution. Add it to
$PATHif you want to avoid manual configurations. -
For the Python distribution:
pip install https://github.com/thautwarm/JuliaPythonAdaptor.jlorpip install JuliaPythonAdaptorFor the Julia distribution:
julia -e "using Pkg; Pkg.add(\"JSON\", \"JuliaPythonAdaptor\")"
Usage
For relocatability, you might add the following environment variables:
| Environment Variable | Description | Default Value |
|---|---|---|
| JP_ADAPTOR_PY_EXE | the Python executable path | python found in $PATH |
| JP_ADAPTOR_JL_EXE | the Julia executable path | julia found in $PATH |
| JP_ADAPTOR_JL_PROJ | the Julia project that will be activated | the global Julia project |
| JP_ADAPTOR_JL_IMAGE | the Julia Sysimage that will be used | decided by the julia program |
| JP_ADAPTOR_JL_DEPOT_PATH | deciding JULIA_DEPOT_PATH |
decided by the julia program |
Then, if you call Python from Julia, import JuliaPythonAdaptor before you import PythonCall. If you call Julia from Python, import JuliaPythonAdaptor before you import juliacall.
I use PyCall, how to use this package?
PyCall is a great package for Julia to call Python, but it so far does not consider much about relocatability and environment separation.
Please refer to these detailed instructions from PyCall to PythonCall. They will help you with migrating your codebase.
Contributions
PRs and issues are welcome.
Besides, this project leverages the mechanism provided by PythonCall.jl, CondaPkg.jl, MicroMamba.jl and pyjuliapkg. You might also consider contributing to them.
Metadata
Release files for JuliaPythonAdaptor 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| JuliaPythonAdaptor-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / JuliaPythonAdaptor-0.3.0-py3-none-any.whl
| Download URL | JuliaPythonAdaptor-0.3.0-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ba35c3cc64a11b27aea951ecafff0377db88e8c77dac856080acbeba1e95ced
|
|
BLAKE2b-256 checksum How to use checksums |
dd70ec2c7b771a5142277d069b46f2f3f921bd3736b46d062df7b80a964fc78e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.10
|