Skip to content

v0.6.2#9

Merged
HH-MWB merged 12 commits intomainfrom
v0.6.2
Apr 5, 2026
Merged

v0.6.2#9
HH-MWB merged 12 commits intomainfrom
v0.6.2

Conversation

@HH-MWB
Copy link
Copy Markdown
Owner

@HH-MWB HH-MWB commented Apr 5, 2026

🎉 Overview

This release fixes an async correctness bug where a single Timer shared across concurrent asyncio tasks could mix up measurements because threading.local does not isolate between tasks on the same thread. Timer now uses a ContextVar with per-thread (sync) and per-task (async) stack ownership, so concurrent async tasks sharing one Timer get correct timings regardless of finish order.

It also ships a reorganized test suite (split by concern into basics, callbacks, errors, metadata, and reuse), a restructured documentation site (new Quickstart and Cookbook sections), and CI/build improvements (parallel jobs, consolidated dev dependencies, updated pre-commit hooks).

🐛 Bug Fixes

Async Task Isolation

  • ContextVar replaces threading.local — Each asyncio task now gets its own measurement stack via contextvars.ContextVar, keyed by task identity (id(current_task())). Previously, all tasks on the same thread shared a single stack through threading.local, causing incorrect timings when tasks finished out of order.
  • Sync (thread-local) behavior is preserved: stack ownership falls back to id(current_thread()) outside of async contexts.

📖 Documentation

  • Quickstart — New standalone quickstart page with installation and first-use examples.
  • Cookbook — Renamed recipes to cookbook; added new entries for metadata patterns and web-framework integration.
  • Guide — Aligned Timer and Measurement guides with actual API behavior; clarified TimeSpan and Measurement docstrings.
  • Module docstring — Expanded with usage examples and public API summary.
  • Overview — Renamed about section to overview.
  • README — Minor updates to match docs site structure.

🔧 Improvements

CI/CD

  • Parallel jobs — Lint and test jobs now run in parallel instead of sequentially.

Build

  • requirements-dev.txt — Replaced dev and docs optional-dependency groups with a single requirements-dev.txt for simpler contributor setup.
  • pyproject.toml — Aligned project.urls with docs site and GitHub links.

Code Quality

  • Pre-commit — Bumped ruff-pre-commit and semgrep revisions; added detect-private-key and codespell hooks.

Testing

  • Reorganized by concern — Split block_timing.feature and function_timing.feature into five focused feature files: timer_basics, timer_callbacks, timer_errors, timer_metadata, and timer_reuse.
  • Faster test runs — Shortened timer sleeps and aligned BUFFER_NS tolerances across steps.
  • Cleaner imports — Moved type-checking imports behind TYPE_CHECKING guard in step definitions.

📝 Migration Guide

No breaking changes. The fix is internal to Timer's stack management; the public API is unchanged.

@HH-MWB HH-MWB self-assigned this Apr 5, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (7f343ef) to head (412da15).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main        #9   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          107       130   +23     
=========================================
+ Hits           107       130   +23     
Flag Coverage Δ
python3.10 100.00% <100.00%> (ø)
python3.11 100.00% <100.00%> (ø)
python3.12 100.00% <100.00%> (ø)
python3.13 100.00% <100.00%> (ø)
python3.14 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@HH-MWB HH-MWB marked this pull request as ready for review April 5, 2026 00:52
@HH-MWB HH-MWB merged commit 10c2032 into main Apr 5, 2026
9 checks passed
@HH-MWB HH-MWB deleted the v0.6.2 branch April 5, 2026 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant