cosl
Utils for COS Lite charms
What it is and what it does
cosl is a utility library for COS Lite charms—Juju charm applications that integrate with the Canonical Observability Stack. It provides three main components: CosTool (bindings to the cos-tool CLI), JujuTopology (logic for generating topology labels used in observability metrics), and LokiHandler (a Python logging handler that sends logs to a Loki push API endpoint). The library depends on ops, diskcache, pydantic, pyyaml, tenacity, and typing-extensions, making it suitable for charm developers who need to instrument their applications with observability without building these integrations from scratch.
The package is actively maintained and has no known vulnerabilities. It targets charm developers and system administrators building observable Juju applications. The coordinated_workers module was moved to a separate package, so if you need that functionality, you should use the coordinated-workers package instead.
Use it for:
- Add structured logging to a Juju charm that forwards logs to a Loki instance for centralized log aggregation
- Generate and apply Juju topology labels to charm metrics for model-driven observability
- Integrate cos-tool functionality into charm code for COS Lite bundle operations
- Build observability into custom charms deployed on Juju models with COS Lite
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides utilities for COS Lite charms, including bindings for cos-tool, Juju topology logic for observability labels, and a Python logging handler that forwards logs to Loki.
Yes, if you are developing Juju charms for COS Lite. The library is actively maintained, has low install friction, carries no security vulnerabilities, and provides essential observability utilities that would otherwise require custom implementation. Not relevant for non-charm Python projects.
Install
cosl on PyPI
pip
pip install cosluv
uv add coslpoetry
poetry add coslInstalling cosl
Before you install
Low install friction with a pure-wheel distribution. Actively maintained with a recent release (2026-08-14), no known vulnerabilities, and straightforward dependencies.
License in practice
Apache License 2.0 is permissive and allows commercial use, modification, and distribution with minimal restrictions—suitable for most projects.
Quickstart
pip install cosl
from cosl.cos_tool import CosTool
from cosl.juju_topology import JujuTopology
from cosl.loki_logger import LokiHandler
# Use CosTool, JujuTopology, or LokiHandler as needed for your charm
Verify before relying
- Whether CosTool requires the external cos-tool binary to be installed on the system
- Specific Loki API endpoint requirements and authentication details for LokiHandler
- Whether JujuTopology requires a running Juju model or works offline
Package facts
| License | Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — ops, diskcache, pydantic, pyyaml, tenacity, typing-extensions |
| Maintenance | actively maintained — 0 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 221,240/month — #9,282 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cosl-1.10.3-py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
opsA Python framework for developing…
permissive · top 15,000 on PyPI
charmcraftlocalPacks Juju charms with local Python package…
unclear · top 15,000 on PyPI
charmlibs-pathopsProvides a pathlib-like interface for reading…
permissive · top 15,000 on PyPI
ops-scenarioops-scenario is a state-transition testing…
permissive · top 15,000 on PyPI
pytest-operatorA pytest plugin that provides fixtures and…
permissive · top 15,000 on PyPI
jubilantJubilant wraps the Juju CLI with a…
permissive · top 15,000 on PyPI
jujuA Python library providing asynchronous…
permissive · top 15,000 on PyPI
python-logging-lokiA Python logging handler that sends log records…
permissive · top 5,000 on PyPI
loki-logger-handlerA logging handler that sends Python log…
permissive · top 15,000 on PyPI
data-platform-helpersProvides version checking and validation…
permissive · top 15,000 on PyPI