Registry / devops / juju
library3.6.1.3pypypi✓ verified 85d ago

The `juju` library provides a Pythonic interface for interacting with Juju controllers and models, allowing programmatic control over Juju deployments. As of version 3.6.1.3, the library is not under active development and primarily receives critical bug fixes. Releases are infrequent and typically address specific issues rather than introducing new features.

pip install juju
INSTALL
IMPORT
SIG · JUJU
J
juju
devopspythonv3.6.1.3
Install
7.5s avg
Import
2634ms
Disk
99MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.6.1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 7.53s
py 3.11
✓ —
✓ 7.23s
py 3.12
✓ —
✓ 6.63s
py 3.13
✕ build_error
✕ build_error
py 3.9
✓ —
✓ 8.63s
99MB installed
● package 99MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Model
from juju.model import Model
Controller
from juju.controller import Controller
run
from juju.loop import run
from juju.jasyncio import run
juju.jasyncio.run was deprecated in 3.6.1.0; use juju.loop.run or asyncio.run directly.

This quickstart demonstrates how to connect to a Juju model using the `juju` library and retrieve information about deployed applications. It uses `asyncio` for asynchronous operations, which is the native way to interact with `libjuju`. Ensure you have a Juju controller configured and are logged in via the `juju` CLI.

import asyncio import os from juju.model import Model async def main(): model_name = os.environ.get('JUJU_MODEL', 'controller:default') # e.g., 'controller:my-model' model = Model() try: # Connect to a specific Juju model await model.connect(model_name=model_name) print(f"Connected to Juju model: {model.name}") # Example: Get applications applications = await model.get_applications() print(f"Applications in model: {[app.name for app in applications]}") except Exception as e: print(f"Error connecting to Juju: {e}") finally: if model.is_connected: await model.disconnect() print("Disconnected from Juju model.") if __name__ == '__main__': # Ensure you have a Juju controller running and are logged in (e.g., via 'juju login') # Optionally set JUJU_MODEL environment variable to connect to a specific model asyncio.run(main())
juju --version
Debug
Known issues
breakingDirect dependency `websockets` version 14.0 breaks `python-libjuju` versions below 3.5.2.1 due to internal API changes and dropped Python 3.8 support.
fix
Upgrade `python-libjuju` to version 3.5.2.1 or newer, or explicitly pin `websockets<14.0,>=8.1` in your project dependencies if you must use an older `libjuju`.
affects: <3.5.2.1
deprecatedThe `juju.jasyncio` module, particularly `juju.jasyncio.run`, was deprecated in favor of `juju.loop.run` or using `asyncio.run` directly.
fix
Replace imports and calls to `juju.jasyncio.run` with `from juju.loop import run` or `asyncio.run`.
affects: >=3.6.1.0
gotchaA bug in earlier versions incorrectly stripped trailing 'P', 'Q', and '=' characters from secret values when fetched or processed.
fix
Upgrade to `juju` version 3.6.1.3 or newer to resolve the secret value corruption issue.
affects: <3.6.1.3
gotchaThe library is in maintenance mode, receiving only critical bug fixes. For Juju charm integration testing, it's recommended to migrate from `pytest-operator` to `jubilant` for better future compatibility and support.
fix
Consider migrating integration tests to the `jubilant` library as per the official recommendations.
affects: All versions
Errors
Common errors & fixes
AttributeError: '_WebSocketConnection' object has no attribute 'open' (or similar during connection)
Using `python-libjuju` version older than 3.5.2.1 with `websockets` version 14.0 or higher.
fix
Upgrade `python-libjuju` to 3.5.2.1 or newer. Alternatively, restrict `websockets` to version `<14.0,>=8.1` in your `requirements.txt`.
ImportError: cannot import name 'run' from 'juju.jasyncio'
Attempting to import `run` from `juju.jasyncio` after it was deprecated and potentially removed or refactored.
fix
Update your import statement to `from juju.loop import run` or use `asyncio.run` directly for running async functions.
Secret value appears truncated or modified (e.g., ends in 'P', 'Q', or '=')
A bug in `python-libjuju` versions prior to 3.6.1.3 incorrectly stripped certain trailing characters from secret values.
fix
Upgrade `python-libjuju` to version 3.6.1.3 or a later release.
Upgrade
Version history
3.6.1.3latest on PyPI · released Jul 11, 2025
Audit
Dependencies
websocketsrequiredUsed for communication with Juju controller. Specific version ranges required for compatibility.
Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
juju — pip install juju · libregistry