julia

adapters.julia

Python ↔︎ Julia bridge using juliacall (PythonCall.jl).

Replaces the legacy pyjulia (julia package) which is unmaintained and emits spurious MainInclude warnings on Julia ≥ 1.3.

Julia package management is handled automatically by juliapkg via tvbo/juliapkg.json. When juliacall is first imported, juliapkg will install Julia (if needed) and all declared packages.

Functions

Name Description
eval_with_auto_install Evaluate Julia code, automatically installing missing packages if needed.
get_julia Return the Julia Main module (lazily initialized).
install_julia_package Install a Julia package if not already installed.

eval_with_auto_install

adapters.julia.eval_with_auto_install(code, max_retries=3)

Evaluate Julia code, automatically installing missing packages if needed.

get_julia

adapters.julia.get_julia(compiled_modules=True)

Return the Julia Main module (lazily initialized).

On first call, juliacall/juliapkg will automatically: - Install Julia if not present - Resolve and install packages declared in tvbo/juliapkg.json - Precompile packages

Parameters

compiled_modules : bool Ignored (kept for API compatibility). juliacall always uses precompiled modules.

Returns

(None, Main) Tuple of (None, Main) for backward compatibility. The first element was the pyjulia Julia instance; with juliacall it is not needed.

install_julia_package

adapters.julia.install_julia_package(package_name, Main=None, update=False)

Install a Julia package if not already installed.

Parameters

Name Type Description Default
package_name str Name of the Julia package to install required
Main Optional[Any] Julia Main module (will be retrieved if None) None
update bool If True, update the package to the latest version False