--- id: ops version: "3.8.1" license: Apache-2.0 license_treatment: permissive maintenance: active --- # ops — The Python library behind great charms License: permissive · Maintenance: active · Downloads: 484.8K/mo ## What it is and what it does The ops library is the official Python framework for writing charms—Juju's declarative, event-driven model for managing Kubernetes workloads and machines. It provides a base class (CharmBase) that charm authors subclass to observe Juju events (config changes, pebble readiness, relation changes) and pair them to handler methods. The library abstracts Juju's event model and state management, letting developers focus on charm logic rather than low-level protocol details. Ops includes a testing module (ops.testing) for unit testing charms in isolation, a Pebble API for managing container workloads, and integrations with PyYAML for configuration, websocket-client for Juju communication, and opentelemetry-api for observability. It is actively maintained by Canonical and is the recommended way to write new charms; the framework is production-stable and widely used in the Juju ecosystem. Use it for: - Write a Kubernetes charm to manage a containerized application's lifecycle, configuration, and relations within Juju. - Unit test charm logic using ops.testing.Context to simulate Juju events and verify charm behavior. - Define and manage container workloads via the Pebble API, including service startup, configuration, and health checks. - Handle charm configuration changes and relation events to coordinate multi-charm deployments. - Integrate observability into charms using opentelemetry-api for tracing and metrics. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. A Python framework for developing charms—declarative, event-driven applications that manage Kubernetes workloads and machines in Juju environments. Yes. If you are writing charms for Juju (Kubernetes or machine), ops is the standard, actively maintained framework with low install friction and no security vulnerabilities. It is production-stable and the recommended choice for new charm development. Install it as part of your charm project's dependencies via charmcraft or requirements.txt. ## Install pip install ops uv add ops poetry add ops ## Installing ops Before you install: Low install friction; pure Python wheel with three runtime dependencies (PyYAML, websocket-client, opentelemetry-api). Actively maintained with a recent release and ongoing commits; requires Python 3.10 or above. License in practice: Licensed under Apache-2.0 (permissive); safe for commercial and proprietary use with minimal attribution requirements. Quickstart: pip install ops import ops class MyCharm(ops.CharmBase): def __init__(self, *args): super().__init__(*args) self.framework.observe(self.on.config_changed, self._on_config_changed) def _on_config_changed(self, event): self.unit.status = ops.ActiveStatus() Requires Python 3.10 or above; intended for use within a Juju charm project structure (typically initialized via charmcraft). Verify before relying: - Whether ops 3.8.1 is compatible with all currently supported Juju versions. - Performance characteristics when managing large numbers of containers or relations. - Maturity of opentelemetry-api integration and observability features. ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 484.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags juju charm development python, kubernetes charm framework, juju ops library, charm sdk python, declarative workload management, juju event-driven applications, charm testing framework, juju, charm-development, kubernetes-orchestration [View on SkillFed](https://skillfed.io/packages/ops) · [View on PyPI](https://pypi.org/project/ops/)