punt-observe
Shared private diagnostics and privacy-safe local telemetry for Punt Labs Python tools. Python 3.13+, Linux and macOS. Licensed under MIT.
Install
uv add punt-observe
# Optional network exporter:
uv add 'punt-observe[otlp]'
Diagnostics
Each CLI, MCP, hook, daemon and detached worker configures its own role. Libraries only create module loggers. No output is written to stdout.
import logging
from punt_observe.logging import configure_logging
configure_logging("my-tool", "cli")
logger = logging.getLogger(__name__)
logger.info("Completed operation: items=%d", 3)
Files live at ~/.punt-labs/my-tool/logs/my-tool.log, UTF-8, INFO by default,
5 MiB plus five backups. Directories are 0700; files and backups are 0600.
Rotation is safe across cooperating processes using a stable flock lock.
Setup permission failures raise LoggingSetupError; append failures are best-effort.
Final formatted records are redacted, control-escaped and bounded to 64 KiB including
their newline. Redaction is defense in depth: never log content or secrets.
Telemetry
Declare schemas once; instrument through the facade, never an exporter.
from punt_observe.telemetry import (
EnumAttr,
HashAttr,
SignalSchema,
TelemetryConfig,
open_telemetry,
)
schemas = [
SignalSchema(
"my-tool.cli.run",
1,
"span",
{
"outcome": EnumAttr(("ok", "error")),
"item": HashAttr(),
},
)
]
telemetry = open_telemetry("my-tool", schemas, TelemetryConfig())
with telemetry.span("my-tool.cli.run", 1, item=telemetry.hash_id("local-id")):
pass # Perform the operation. Exceptions propagate without recording text.
telemetry.shutdown(timeout_s=2)
Use event(name, version, **attrs), count(name, version, n=1, **attrs) or
record(name, version, value, **attrs) with matching event/counter/histogram schemas.
Attribute types: closed EnumAttr, BoolAttr, IntAttr, DurationAttr (ms), CountAttr,
SizeAttr (By), LengthAttr and HashAttr. Unknown attributes/versions, wrong types,
free text and arbitrary strings posing as hashes are dropped before OTel.
Only explicit schema-derived lengths and salted hashes may derive from content.
Local SQLite capture defaults on at ~/.punt-labs/my-tool/telemetry.db, separate
from diagnostics. Store and SQLite sidecars are private, retained 90 days by
default (configurable 1–3650); startup and hourly export-triggered pruning reclaim
space incrementally. Per-install salt is ~/.punt-labs/telemetry.salt (0600).
Any off switch wins: PUNT_TELEMETRY=off, MY_TOOL_TELEMETRY=off, or
TelemetryConfig(enabled=False). Also accepts 0/false/no, case-insensitively.
Disabled telemetry creates no store, salt, provider or worker.
Network export requires TelemetryConfig(exporter="otlp", otlp_consent=True, otlp_endpoint="https://collector.example"). Environment variables
PUNT_TELEMETRY_EXPORTER and PUNT_TELEMETRY_OTLP_ENDPOINT may select the
exporter/endpoint but cannot grant consent. Missing optional OTLP dependency
falls back to SQLite. Instrumentation stays identical.
Providers are private, never process-global. Pending span export is bounded at
2048; saturation drops records, not tool results. Shutdown bounds waiting; a
misbehaving exporter may finish on a daemon thread after the deadline.
shutdown(timeout_s=2) force-flushes pending metrics, spans and events without
waiting for their periodic export interval. As a fallback, normal Python exit
(including sys.exit or an uncaught KeyboardInterrupt) flushes pending live
providers through one atexit registry, with a two-second total wait across
all instances. Explicitly shut-down instances and forked children that have not
emitted do no exit work. Explicit shutdown remains the preferred lifecycle.
The library never installs signal handlers. A SIGTERM with its default
disposition skips atexit, as do SIGKILL and os._exit. Daemons must convert
SIGTERM into normal Python unwinding (for example, raise SystemExit), or call
shutdown before terminating. A server that restores and re-raises default
SIGTERM before an outer telemetry context unwinds still skips that context and
atexit; move explicit shutdown into its graceful lifecycle instead.
Development
uv sync --frozen; make check; make build. CI checks Linux and macOS.
make help lists targets. The original append protocol is from punt-labs/vox;
redaction and URL grammar are from punt-labs/quarry (MIT, Punt Labs).
Metadata
Release files for punt-observe 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| punt_observe-0.1.0.tar.gz | 36.2 kB | With provenance | Details for punt_observe-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| punt_observe-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for punt_observe-0.1.0-py3-none-any.whl |
Total release size: 81.7 kB
Release files / punt_observe-0.1.0.tar.gz
| Download URL | punt_observe-0.1.0.tar.gz |
|---|---|
| Size | 36.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6f7303ddf3a3c4be652d5256959b75d34d2bbcce71837413213c64c0281a385
|
|
BLAKE2b-256 checksum How to use checksums |
7b792d331e922bc56a18c33f63518981970c164ee0148033b68014fc6945defe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logRelease files / punt_observe-0.1.0-py3-none-any.whl
| Download URL | punt_observe-0.1.0-py3-none-any.whl |
|---|---|
| Size | 45.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba0fa482c08ac362df734d69db507b5700f9ce2b0d78b53409798eb25ec58d31
|
|
BLAKE2b-256 checksum How to use checksums |
f442e3a57a51742a3554342f1ce667c9ad026f24506610ac186c253c72d3435d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logSecurity for punt-observe 0.1.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for punt_observe-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logA 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.