Repository navigation
First release since 2.1.0 (2017). Full modernization of the project.
Breaking changes
- Python >= 3.10 required. Python 2 support removed.
- Validation errors now raise real exceptions instead of
AssertionError.Timerstate misuse raisesRuntimeError, and
non-numericGaugevalues raiseTypeError. Connection.sendonly swallowsOSError(returningFalse), so
other exceptions now propagate.- The nose-specific
setup_package/teardown_packagehooks were
removed from thestatsdpackage. statsd.__about__was removed. Usestatsd.__version__and the
package metadata instead.- The statsd.compat module (Python 2 helpers) was removed.
Bugfixes
- The
Timer.time()context manager now sends the metric even when
the timed block raises an exception, matching the behavior of
with Timer(...)and@timer.decorate. - Timer measurements use the monotonic
time.perf_counter()instead
of the wall clock, so clock adjustments can't produce negative or
wildly wrong timings. - Passing
bytesmetric names no longer crashes on Python 3. Raw.senddefault timestamps no longer rely on the non-portable
strftime('%s').Connection.__del__no longer raises when construction failed
before the socket existed.Timer.time()now yields the inner timer instance (wasNone).
Modernization
- Packaging:
pyproject.tomlwith theuv_buildbackend
(setup.py/setup.cfgremoved). - Fully type annotated with a
py.typedmarker, checked with strict
mypy, basedpyright, pyrefly and ty. - Tests: pytest with 100% line and branch coverage enforced, nose
removed. - Linting/formatting: ruff.
- CI: GitHub Actions (Travis removed) with releases published to PyPI
via Trusted Publishing. - Docs: sphinx + furo on readthedocs, with the README written in
Markdown, a getting-started and user-guide tree, and every code
sample in the README and the docs executed by the test suite. - Repo: CodeQL, stale-issue and dependabot workflows, plus
CONTRIBUTING.mdandSECURITY.md.
For older releases, see the git history.