julia_import ¶
Import the Julia environment.
This provides additional functionality on top of
juliapkg
(which automatically downloads Julia packages for us). It
will import the
juliacall
module to create a Julia environment (as
jl
), and uses it to import the
DataAxesFormats.jl
Julia package.
You can control the behavior using the following environment variables:
-
PYTHON_JULIACALL_HANDLE_SIGNALS(by default,yes). This is needed to avoid segfaults when calling Julia from Python. -
PYTHON_JULIACALL_THREADS(by default,auto). By default Julia will use all the threads available in the machine. On machines with hyper-threading you may want to specify only half the number of threads (that is, just have one thread per physical core) as that should provide better performance for compute-intensive (as opposed to IO-intensive) code. -
PYTHON_JULIACALL_OPTLEVEL(by default,3).
This code is based on the code from the
pysr
Python package, adapted to our needs. TODO: Much of this is replicated
in all our Python packages that invoke Julia.
- dafpy.julia_import. jl = Julia: Main ¶
-
The interface to the Julia run-time.
- dafpy.julia_import. jl_version = (1, 11, 5) ¶
-
The version of Julia being used.
- class dafpy.julia_import. UndefInitializer [source] ¶
-
A Python class to use instead of Julia’s
UndefInitializer. We need this to allow@overloadto work in the presence ofUndef.
- dafpy.julia_import. Undef = <dafpy.julia_import.UndefInitializer object> ¶
-
A Python value to use instead of Julia’s
undef. We need this to allow@overloadto work in the presence ofundef.
- dafpy.julia_import. use_default_julia_environment ( ) None [source] ¶
-
Force JuliaCall to use your default environment (whatever that is). By default JuliaCall creates its own separate independent environment, which means that it re-downloads and re-installs all the dependency packages there. This is nice if you don’t otherwise use Julia and/or don’t care about the wasted disk space and initial installation time and manual control over package versions. It sucks if you do otherwise use Julia, and/or you want manual control over the version of some of the packages (e.g., if you are actively developing them). You would think there would a built-in method for doing this in JuliaCall, right?
To make this easier (and trigger it before actually importing packages), you can set the
PYTHON_JULIACALL_USE_DEFAULT_ENVIRONMENTenvironment variable toyes, and thenimport dafpywill calluse_default_julia_environmentfor you. Sigh.