# julia { #tvbo.adapters.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.

## Attributes

| Name | Description |
| --- | --- |
| [logger](#tvbo.adapters.julia.logger) |  |

## Functions

| Name | Description |
| --- | --- |
| [eval_with_auto_install](#tvbo.adapters.julia.eval_with_auto_install) | Evaluate Julia code, automatically installing missing packages if needed. |
| [get_julia](#tvbo.adapters.julia.get_julia) | Return the Julia Main module (lazily initialized). |
| [install_julia_package](#tvbo.adapters.julia.install_julia_package) | Install a Julia package if not already installed. |

### eval_with_auto_install { #tvbo.adapters.julia.eval_with_auto_install }

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

Evaluate Julia code, automatically installing missing packages if needed.

### get_julia { #tvbo.adapters.julia.get_julia }

```python
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 {.doc-section .doc-section-parameters}

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



#### Returns: {.doc-section .doc-section-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 { #tvbo.adapters.julia.install_julia_package }

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

Install a Julia package if not already installed.

#### Parameters {.doc-section .doc-section-parameters}

| Name         | Type        | Description                                       | Default    |
|--------------|-------------|---------------------------------------------------|------------|
| package_name | str         | Name of the Julia package to install              | _required_ |
| Main         | Any \| None | Julia Main module (will be retrieved if None)     | `None`     |
| update       | bool        | If True, update the package to the latest version | `False`    |