Observed since 21 Oct, 11:41 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Boilerplate for asyncio service
This module provides a foundation for building microservices using Python's asyncio library. Key features include:
No dependencies are enforced by default, so you only install what you need. For basic usage, no additional Python modules are required. The table below summarizes which optional dependencies to install based on the features you want to use:
| aiobp Feature | Required Module(s) | Extra |
|---|---|---|
| config (.conf or .json) | msgspec | logging |
| config (.yaml) | msgspec, pyyaml | logging_yaml |
| OpenTelemetry logging | opentelemetry-sdk, opentelemetry-exporter-otlp-proto-grpc | logging_otel |
| OpenTelemetry tracing | opentelemetry-sdk, opentelemetry-exporter-otlp-proto-grpc | tracing_otel |
| HTTP server + Swagger | aiohttp, msgspec | aiohttp |
| NATS message bus | nats-py, msgspec | nats |
Logs and traces share the same dependency set — install aiobp[otel] to get both:
pip install aiobp[otel]
import asyncio
from aiobp import runner
async def main():
try:
await asyncio.sleep(60)
except asyncio.CancelledError:
print('Saving data...')
runner("Basic example", "0.0.0", main())
aiobp supports exporting logs to OpenTelemetry collectors (SigNoz, Jaeger, etc.).
Add OTEL settings to your LoggingConfig:
[log]
level = DEBUG
console = INFO
filename = service.log
otel_endpoint = http://localhost:4317
otel_export_interval = 5
| Option | Default | Description |
|---|---|---|
| level | DEBUG | Log level for file and OTEL output |
| console | INFO | Log level for console output (under systemd it goes to syslog) |
| otel_endpoint | None | OTLP gRPC endpoint (e.g. http://localhost:4317) |
| otel_export_interval | 5 | Export interval in seconds (0 = instant export) |
from dataclasses import dataclass
from aiobp.logging import LoggingConfig, setup_logging, log
@dataclass
class Config:
log: LoggingConfig = None
# ... load config ...
setup_logging("my-service-name", config.log)
log.info("This message goes to console, file, and OTEL collector")
To add custom resource attributes (like location, environment, etc.), set the standard OTEL environment variable before calling setup_logging:
import os
os.environ["OTEL_RESOURCE_ATTRIBUTES"] = "location=datacenter1,environment=production"
setup_logging("my-service-name", config.log)
If otel_endpoint is configured but OpenTelemetry packages are not installed, a warning is logged and the application continues with console/file logging only.
aiobp also supports exporting distributed traces to OpenTelemetry collectors. Call once at startup, then use traced(), current_span(), and start_span() anywhere in the codebase.
from aiobp import __version__
from aiobp.tracing import setup_tracing
setup_tracing("my-service", __version__, config.log.otel_endpoint)
Logging and tracing are independent — call either or both. The common pattern is to reuse the same OTLP endpoint:
from aiobp.logging import setup_logging
from aiobp.tracing import setup_tracing
setup_logging("my-service", config.log) # logs go to OTel if endpoint set
setup_tracing("my-service", __version__, config.log.otel_endpoint) # traces share the endpoint
from aiobp.tracing import traced, current_span
async def do_work():
result = await call_external_api()
# Helper doesn't take the span as an argument — reach for the active one:
current_span().set_attribute("result.id", result.id)
return result
async with traced("operation.name", {"key": "value"}):
await do_work()
traced accepts:
attrs — dict of span attributes.context — an OTel Context for parent propagation.traceparent — W3C traceparent string (alternative to context; the function calls extract() for you).suppress — exception types to log-and-swallow inside the span (defaults to none).errors_only=True — span is created lazily, only when an exception is raised. Useful for noisy event handlers where you only want to surface failures.From any nested function call, current_span() returns the active span so you can attach attributes without threading the span through arguments.
start_spantraced() is a context manager — the span ends when the block exits. For spans that need to outlive a single function call (e.g. "caller is waiting for an agent" — open in one event handler, closed in another), use start_span() and call .end() yourself:
from aiobp.tracing import start_span
# Begin the wait — store the returned span somewhere
wait_span = start_span("queue.wait_for_agent", {"queue.id": 42}, traceparent=caller_traceparent)
self._wait_spans[caller.uuid] = wait_span
# Later, when the wait ends:
span = self._wait_spans.pop(caller.uuid, None)
if span:
span.end()
start_span accepts the same attrs, context, and traceparent parameters as traced. The returned span is not installed as the current context — child spans elsewhere won't auto-nest under it. Use it for pure duration markers.
If tracing isn't configured, start_span returns a no-op span; calling .end() on it is harmless.
If setup_tracing is never called, or the OpenTelemetry packages aren't installed, traced() becomes a no-op. Application code using traced() and current_span() works unchanged whether tracing is on or off.
pypistats · 81 observations shown. Missing days are unknown. Source category: overall: without mirrors.
| Date / source period | Value | Observed at |
|---|---|---|
| 2026-10-20 – 2026-10-20 | 148 | 2026-10-21T15:31:16.0482749Z |
| 2026-10-19 – 2026-10-19 | 177 | 2026-10-21T15:31:16.0482749Z |
| 2026-10-18 – 2026-10-18 | 8 | 2026-10-21T15:31:16.0482749Z |
| 2026-10-17 – 2026-10-17 | 19 | 2026-10-21T15:31:16.0482749Z |
| 2026-10-16 – 2026-10-16 | 14 | 2026-10-21T15:31:16.0482749Z |
| 2026-10-15 – 2026-10-15 | 13 | 2026-10-21T15:31:16.0482749Z |
| 2026-10-14 – 2026-10-14 | 35 | 2026-10-21T15:31:16.0482749Z |
| 2026-10-13 – 2026-10-13 | 191 | 2026-10-21T15:31:16.0482749Z |
| 2026-10-12 – 2026-10-12 | 4 | 2026-10-21T15:31:16.0482749Z |
| 2026-10-11 – 2026-10-11 | 13 | 2026-10-21T15:31:16.0482749Z |
| 2026-10-10 – 2026-10-10 | 34 | 2026-10-21T15:31:16.0482749Z |
| 2026-10-09 – 2026-10-09 | 1 | 2026-10-21T15:31:16.0482749Z |
| 2026-10-08 – 2026-10-08 | 14 | 2026-10-21T15:31:16.0482749Z |
| 2026-10-07 – 2026-10-07 | 5 | 2026-10-21T15:31:16.0482749Z |
| 2026-10-06 – 2026-10-06 | 8 | 2026-10-21T15:31:16.0482749Z |
| 2026-10-05 – 2026-10-05 | 19 | 2026-10-21T15:31:16.0482749Z |
| 2026-10-04 – 2026-10-04 | 7 | 2026-10-21T15:31:16.0482749Z |
| 2026-10-03 – 2026-10-03 | 2 | 2026-10-21T15:31:16.0482749Z |
| 2026-10-02 – 2026-10-02 | 7 | 2026-10-21T15:31:16.0482749Z |
| 2026-10-01 – 2026-10-01 | 4 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-30 – 2026-09-30 | 3 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-29 – 2026-09-29 | 10 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-28 – 2026-09-28 | 3 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-27 – 2026-09-27 | 5 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-26 – 2026-09-26 | 93 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-25 – 2026-09-25 | 5 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-24 – 2026-09-24 | 24 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-23 – 2026-09-23 | 9 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-22 – 2026-09-22 | 127 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-21 – 2026-09-21 | 18 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-20 – 2026-09-20 | 29 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-19 – 2026-09-19 | 7 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-18 – 2026-09-18 | 38 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-17 – 2026-09-17 | 4 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-16 – 2026-09-16 | 124 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-15 – 2026-09-15 | 8 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-14 – 2026-09-14 | 101 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-13 – 2026-09-13 | 8 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-12 – 2026-09-12 | 1 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-11 – 2026-09-11 | 39 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-10 – 2026-09-10 | 18 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-09 – 2026-09-09 | 6 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-08 – 2026-09-08 | 1 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-07 – 2026-09-07 | 34 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-06 – 2026-09-06 | 96 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-04 – 2026-09-04 | 4 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-03 – 2026-09-03 | 5 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-02 – 2026-09-02 | 22 | 2026-10-21T15:31:16.0482749Z |
| 2026-09-01 – 2026-09-01 | 25 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-31 – 2026-08-31 | 5 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-28 – 2026-08-28 | 33 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-25 – 2026-08-25 | 33 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-24 – 2026-08-24 | 59 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-23 – 2026-08-23 | 75 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-22 – 2026-08-22 | 24 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-21 – 2026-08-21 | 22 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-20 – 2026-08-20 | 52 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-19 – 2026-08-19 | 18 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-18 – 2026-08-18 | 21 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-17 – 2026-08-17 | 10 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-15 – 2026-08-15 | 71 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-14 – 2026-08-14 | 12 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-12 – 2026-08-12 | 12 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-11 – 2026-08-11 | 42 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-10 – 2026-08-10 | 4 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-09 – 2026-08-09 | 8 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-07 – 2026-08-07 | 2 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-06 – 2026-08-06 | 29 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-05 – 2026-08-05 | 18 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-04 – 2026-08-04 | 15 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-03 – 2026-08-03 | 4 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-02 – 2026-08-02 | 1 | 2026-10-21T15:31:16.0482749Z |
| 2026-08-01 – 2026-08-01 | 1 | 2026-10-21T15:31:16.0482749Z |
| 2026-07-31 – 2026-07-31 | 8 | 2026-10-21T15:31:16.0482749Z |
| 2026-07-30 – 2026-07-30 | 10 | 2026-10-21T15:31:16.0482749Z |
| 2026-07-29 – 2026-07-29 | 4 | 2026-10-21T15:31:16.0482749Z |
| 2026-07-28 – 2026-07-28 | 17 | 2026-10-21T15:31:16.0482749Z |
| 2026-07-27 – 2026-07-27 | 13 | 2026-10-21T15:31:16.0482749Z |
| 2026-07-26 – 2026-07-26 | 1 | 2026-10-21T15:31:16.0482749Z |
| 2026-07-24 – 2026-07-24 | 73 | 2026-10-21T15:31:16.0482749Z |
| 2026-07-23 – 2026-07-23 | 9 | 2026-10-21T15:31:16.0482749Z |
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 3.1.0 | 20 Oct 2026 | 6 |
This describes our collected data; it is not a security assessment.
Observed since 21 Oct, 11:41 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:2ab70c0e87fece411de40d24578df20577ddfd0af349f3a7842c6d700a344013