Julia version manager and package manager
Project description
JuliaPkg
Do you want to use Julia in your Python script/project/package? No problem! JuliaPkg will help you out!
- Declare the version of Julia you require in a
juliapkg.json
file. - Add any packages you need too.
- Call
juliapkg.resolve()
et voila, your dependencies are there. - Use
juliapkg.executable()
to find the Julia executable andjuliapkg.project()
to find the project where the packages were installed. - Virtual environments? PipEnv? Poetry? Conda? No problem! JuliaPkg will set up a different project for each environment you work in, keeping your dependencies isolated.
Install
pip install juliapkg
Declare dependencies
Functional interface
status(target=None)
shows the status of dependencies.require_julia(version, target=None)
declares that you require the given version of Julia. Theversion
is a Julia compat specifier, so1.5
matches any1.*.*
version at least1.5
.add(pkg, uuid, dev=False, version=None, path=None, subdir=None, url=None, rev=None, target=None)
adds a required package. Its name and UUID are required.rm(pkg, target=None)
remove a package.
Note that these functions edit juliapkg.json
but do not actually install anything until
resolve()
is called, which happens automatically in executable()
and project()
.
The target
specifies the juliapkg.json
file to edit, or the directory containing it.
If not given, it will be your virtual environment or Conda environment if you are using one,
otherwise ~/.pyjuliapkg.json
.
juliapkg.json
You can also edit juliapkg.json
directly if you like. Here is an example which requires
Julia v1.. and the Example package v0.5.*:
{
"julia": "1",
"packages": {
"Example": {
"uuid": "7876af07-990d-54b4-ab0e-23690620f79a",
"version": "0.5"
}
}
}
Using Julia
juliapkg.executable()
returns a compatible Julia executable.juliapkg.project()
returns the project into which the packages have been installed.juliapkg.resolve(force=False)
ensures all the dependencies are installed. You don't normally need to do this because the other functions resolve automatically.
Details
Configuration
JuliaPkg does not generally need configuring, but for advanced usage the following options
are available. Options can be specified either as an environment variable or as an -X
option to python
. The -X
option has higher precedence.
Environment Variable | -X Option |
Description |
---|---|---|
PYTHON_JULIAPKG_EXE=<exe> |
-X juliapkg-exe=<exe> |
The Julia executable to use. |
PYTHON_JULIAPKG_PROJECT=<project> |
-X juliapkg-project=<project> |
The Julia project where pacakges are installed. |
PYTHON_JULIAPKG_OFFLINE=<yes/no> |
-X juliapkg-offline=<yes/no> |
Work in Offline Mode - does not install Julia or any packages. |
Which Julia gets used?
JuliaPkg tries the following strategies in order to find Julia on your system:
- If the
-X juliapkg-exe
argument topython
is set, that is used. - If the environment variable
PYTHON_JULIAPKG_EXE
is set, that is used. - If
julia
is in yourPATH
, and is compatible, that is used. - If
juliaup
is in yourPATH
, it is used to install a compatible version of Julia. - Otherwise, JuliaPkg downloads a compatible version of Julia and installs it into the Julia project.
More strategies may be added in a future release.
Where are Julia packages installed?
JuliaPkg installs packages into a project whose location is determined by trying the following strategies in order:
- If the
-X juliapkg-project
argument topython
is set, that is used. - If the environment variable
PYTHON_JULIAPKG_PROJECT
is set, that is used. - If you are in a Python virtual environment or Conda environment, then
{env}/julia_env
subdirectory is used. - Otherwise
~/.julia/environments/pyjuliapkg
is used (respectsJULIA_DEPOT
).
More strategies may be added in a future release.
Adding Julia dependencies to Python packages
JuliaPkg looks for juliapkg.json
files in many locations, namely:
{project}/pyjuliapkg
where project is as above (depending on your environment).- Every directory and direct sub-directory in
sys.path
.
The last point means that if you put a juliapkg.json
file in a package, then install that
package, then JuliaPkg will find those dependencies and install them.
You can use add
, rm
etc. above with target='/path/to/your/package'
to modify the
dependencies of your package.
Offline mode
If you set the environment variable PYTHON_JULIAPKG_OFFLINE=yes
(or call python
with the
option -X juliapkg-offline=yes
) then JuliaPkg will operate in offline mode. This means it
will not attempt to download Julia or any packages.
Resolving will fail if Julia is not already installed. It is up to you to install any required Julia packages.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file juliapkg-0.1.14.tar.gz
.
File metadata
- Download URL: juliapkg-0.1.14.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f37e0c16a0706169cce039fc0bde3431e72c17464342f9aaf1b8922144e2058d |
|
MD5 | 66819df15fb5c298ec2f101d5fd888e3 |
|
BLAKE2b-256 | c4a13f60d4d68ecde8d8a1121c99a675828999872ca3f46fae8393bb39ff0551 |
File details
Details for the file juliapkg-0.1.14-py3-none-any.whl
.
File metadata
- Download URL: juliapkg-0.1.14-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd3f1eaa229963536054539b0b57d913e2af3ceda4cd93a98bc8982a8617229b |
|
MD5 | 75f0037fe541eec793abb215c87f2ff1 |
|
BLAKE2b-256 | 75d53d58f6519c4a938d91de5c1e723b2fa71717683e62a6ec9aa9067c3d3bc2 |