perf: scaffold skinny package with __init__.py and pyproject.toml entry #203
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Create
src/perf/as the 12th module inmodule-namelist.Tasks
src/perf/__init__.pywith public API:init(),tracer(),meter(),shutdown()"perf"totool.uv.build-backend.module-namein pyproject.tomlperfoptional-dependency group:opentelemetry-api,opentelemetry-sdk,opentelemetry-exporter-otlp-proto-grpc,opentelemetry-instrumentation-fastapi,opentelemetry-semantic-conventions,psutil[telemetry]section tostack.toml(enabled, endpoint, fallback, sample_rate, service_name)tests/perf/mirror directoryuv sync --extra perfresolves cleanlyStarting work on package scaffold.
Plan:
src/perf/__init__.pywith public API stubs"perf"tomodule-namein pyproject.tomlperfoptional-dependency group[telemetry]section to stack.tomltests/perf/with initial testuv sync --extra perfresolves cleanlyAll tasks complete. Results:
Files created:
src/perf/__init__.py— public API:init(),shutdown(),tracer(),meter(),_enabled()src/perf/_tracer.py—MockTracer/MockSpan+TracerProvidersetup with OTLP gRPC exportersrc/perf/_meter.py—MockMeter+MeterProvidersetup with Prometheus exportersrc/perf/_resource.py— OTel Resource (service.name, version, git SHA, deployment.environment)src/perf/export.py—FileSpanExporterJSONL fallbacktests/perf/__init__.pytests/perf/test_init.py— 20 tests covering all mock objects, public API, config, and exportFiles modified:
pyproject.toml— added"perf"tomodule-name, addedperfoptional-dep group (7 OTel packages + psutil), added toallstack.toml— added[telemetry]section (enabled, endpoint, fallback, sample_rate, service_name)Verification:
uv sync --extra perf— resolved 17 new packages cleanlyruff check src/perf/— 0 errors (8 auto-fixed)pytest tests/perf/— 20/20 passed in 0.04spytest tests/— 11,975 passed in 218s (no regressions)import perf; perf.tracer("test")→MockTracerReady to close.