Skip to main content

Jubilant, the joyful library for driving Juju

Jubilant is a Python library that wraps the Juju CLI, primarily for use in charm integration tests. It provides methods that map 1:1 to Juju CLI commands, but with a type-annotated, Pythonic interface.

You should consider switching to Jubilant if your integration tests currently use pytest-operator (and they probably do). Jubilant has an API you'll pick up quickly, and it avoids some of the pain points of python-libjuju, such as websocket failures and having to use async. Read our design goals.

Jubilant 1.0.0 was released in April 2025. We'll avoid making breaking changes to the API after this point.

Read the full documentation

Using Jubilant

Jubilant is published to PyPI, so you can install and use it with your favorite Python package manager:

$ pip install jubilant
# or
$ uv add jubilant

Because Jubilant calls the Juju CLI, you'll also need to install Juju.

To use Jubilant in Python code:

import jubilant

juju = jubilant.Juju()
juju.deploy('snappass-test')
juju.wait(jubilant.all_active)

# Or only wait for specific applications:
juju.wait(lambda status: jubilant.all_active(status, 'snappass-test', 'another-app'))

Below is an example of a charm integration test. First we define a module-scoped pytest fixture named juju which creates a temporary model and runs the test with a Juju instance pointing at that model. Jubilant'stemp_model context manager creates the model during test setup and destroys it during teardown:

# conftest.py
@pytest.fixture(scope='module')
def juju():
    with jubilant.temp_model() as juju:
        yield juju


# test_deploy.py
def test_deploy(juju: jubilant.Juju):        # Use the "juju" fixture
    juju.deploy('snappass-test')             # Deploy the charm
    status = juju.wait(jubilant.all_active)  # Wait till the app and unit are 'active'

    # Hit the Snappass HTTP endpoint to ensure it's up and running.
    address = status.apps['snappass-test'].units['snappass-test/0'].address
    response = requests.get(f'http://{address}:5000/', timeout=10)
    response.raise_for_status()
    assert 'snappass' in response.text.lower()

You don't have to use pytest with Jubilant, but it's what we recommend. Pytest's assert-based approach is a straight-forward way to write tests, and its fixtures are helpful for structuring setup and teardown.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jubilant-1.12.0.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jubilant-1.12.0-py3-none-any.whl (37.1 kB view details)

Uploaded Python 3

File details

Details for the file jubilant-1.12.0.tar.gz.

File metadata

  • Download URL: jubilant-1.12.0.tar.gz
  • Upload date:
  • Size: 35.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for jubilant-1.12.0.tar.gz
Algorithm Hash digest
SHA256 7d796d5c19f0b74a041f50aa68919731c7c83da4fb8a8258c8861524532b6997
MD5 e7dea1c37fdeca409283d08b8111fd41
BLAKE2b-256 27c313eb3579d021346c95d0622ebbcce7d3326ed6412d0b51d4d3df2461443d

See more details on using hashes here.

Provenance

The following attestation bundles were made for jubilant-1.12.0.tar.gz:

Publisher: publish.yaml on canonical/jubilant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jubilant-1.12.0-py3-none-any.whl.

File metadata

  • Download URL: jubilant-1.12.0-py3-none-any.whl
  • Upload date:
  • Size: 37.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for jubilant-1.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa64922156d861149666c8ce08cb93b1fd787172fdd12175a4d0563955a67544
MD5 1c11e2a09307a7717fe2a17e535e2920
BLAKE2b-256 4e170569153f6aca13716e019243d01895f26061233bae7e21a459cc128e7120

See more details on using hashes here.

Provenance

The following attestation bundles were made for jubilant-1.12.0-py3-none-any.whl:

Publisher: publish.yaml on canonical/jubilant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page