Skip to content

julia

init_julia()

Starts Julia and loads required packages, exactly once per process.

Source code in src/finch/compile_jl/julia.py
71
72
73
74
75
76
def init_julia() -> tuple[Any, Any]:
    """Starts Julia and loads required packages, exactly once per process."""
    global _jc, _jl
    if _jl is None and JULIA_AVAILABLE:
        _jc, _jl = _start_julia()
    return _jc, _jl

julia_available()

Whether the Julia backend can be used, i.e. whether both Python packages init_julia needs are installed. They are optional dependencies; see the julia extra in pyproject.toml.

Source code in src/finch/compile_jl/julia.py
14
15
16
17
18
19
20
21
22
def julia_available() -> bool:
    """
    Whether the Julia backend can be used, i.e. whether both Python packages
    `init_julia` needs are installed. They are optional dependencies; see the
    `julia` extra in `pyproject.toml`.
    """
    return all(
        importlib.util.find_spec(name) is not None for name in ("juliapkg", "juliacall")
    )