Skip to main content

This is juju-resolute, a fork of python-libjuju (published on PyPI as juju). It installs as juju-resolute but is imported as juju, so it stays a drop-in replacement. Note: because both packages own the on-disk juju directory, only one of juju or juju-resolute can be installed in a given environment at a time.

Source code: https://github.com/canonical/k8s-python-libjuju

Bug reports: https://github.com/canonical/k8s-python-libjuju/issues

Upstream: https://github.com/juju/python-libjuju

Documentation: https://pythonlibjuju.readthedocs.io/en/latest/

Supported Python versions: 3.8 through 3.13 Supported Juju versions: 3.1 through 3.6

Design Notes

  • Asynchronous - Uses asyncio and async/await features of Python

  • Websocket-level bindings are programmatically generated (indirectly) from the Juju golang code, ensuring full api coverage

  • Provides an OO layer which encapsulates much of the websocket api and provides familiar nouns and verbs (e.g. Model.deploy(), Application.add_unit(), etc.)

Installation

pip3 install juju-resolute

Quickstart

Here’s a simple example that shows basic usage of the library. The example connects to the currently active Juju model, deploys a single unit of the ubuntu charm, then exits:

Note : Pylibjuju requires an already bootstrapped Juju controller to connect to.

#!/usr/bin/python3

import asyncio
import logging
import sys

from juju.model import Model


async def deploy():
    # Create a Model instance. We need to connect our Model to a Juju api
    # server before we can use it.
    model = Model()

    # Connect to the currently active Juju model
    await model.connect()

    try:
        # Deploy a single unit of the ubuntu charm, using the latest revision
        # from the stable channel of the Charm Store.
        ubuntu_app = await model.deploy(
          'ubuntu',
          application_name='my-ubuntu',
        )

        if '--wait' in sys.argv:
            # optionally block until the application is ready
            await model.wait_for_idle(status='active')

    finally:
        # Disconnect from the api server and cleanup.
        await model.disconnect()


def main():
    logging.basicConfig(level=logging.INFO)

    # If you want to see everything sent over the wire, set this to DEBUG.
    ws_logger = logging.getLogger('websockets.protocol')
    ws_logger.setLevel(logging.INFO)

    # Run the deploy coroutine in an asyncio event loop, using a helper
    # that abstracts loop creation and teardown.
    asyncio.run(deploy())


if __name__ == '__main__':
    main()

More examples can be found in the docs, as well as in the examples/ directory of the source tree which can be run using tox. For example, to run examples/connect_current_model.py, use:

tox -e example -- examples/connect_current_model.py

REPL

To experiment with the library in a REPL, launch python in asyncio mode

$ python3 -m asyncio

and then, to connect to the current model and fetch status:

>>> from juju.model import Model
>>> model = Model()
>>> await model.connect_current()
>>> status = await model.get_status()

Versioning

The current Pylibjuju release policy tracks the Juju release cadence. In particular, whenever Juju makes a latest/stable release, pylibjuju pushes out a release with the same version in the following week. Newly generated schemas will be updated per Juju releases.

Metadata

Release files for juju-resolute 3.6.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for juju-resolute 3.6.1.4
File Size Uploaded Provenance Actions
juju_resolute-3.6.1.4.tar.gz 305.9 kB Without provenance Details for juju_resolute-3.6.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for juju-resolute 3.6.1.4
File Interpreter ABI Platform Actions
juju_resolute-3.6.1.4-py3-none-any.whl Python 3 none any Details for juju_resolute-3.6.1.4-py3-none-any.whl

Total release size: 593.2 kB

Release files / juju_resolute-3.6.1.4.tar.gz

Download URL juju_resolute-3.6.1.4.tar.gz
Size 305.9 kB
Tags Source
SHA-256 checksum
How to use checksums
028938d99bc204590927ba483823d626e3e29e90fed83b4ed2acb6734cf1aa5b
BLAKE2b-256 checksum
How to use checksums
af4002e821581a14655864dbc5d099f63c8cd26cfd6df5cf2669c63a91021000
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / juju_resolute-3.6.1.4-py3-none-any.whl

Download URL juju_resolute-3.6.1.4-py3-none-any.whl
Size 287.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6661ea8b969c72bcb4e8a3947ec47e5d376f845ee0e22b3960b73f235bb31c9f
BLAKE2b-256 checksum
How to use checksums
8462e22c4b0ab6dff51b259699d67d300605529daa96acc80881dd048b0b95aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Security for juju-resolute 3.6.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

3.6.1.4 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page