Conversation
added 2 commits
February 4, 2026 21:32
Optimize scope timing by using an explicit context manager class instead of @contextmanager decorator. This reduces overhead from generator-based context managers and avoids lambda allocation in no-op decorators.
seanbrar
added a commit
that referenced
this pull request
Feb 5, 2026
## Summary Adds test coverage, performance benchmarks, and documentation for the v0.2.0 ergonomics features (decorators, lifecycle hooks, async safety, strict mode). Core implementation was landed in #1. ## Notes - Performance benchmarks were pulled forward from the v0.4.0 roadmap to v0.2.0—they were needed to validate the `_Scope` class optimization and establish baselines. - `NULLSCOPE_STRICT` is documented only in the README env var table for now; design.md addition deferred unless users request clarification. - `uv.lock` is now tracked for reproducible CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@timeddecorator supporting both sync and async functions@contextmanagerwith an explicit_Scopeclass and using an_identityfunction to avoid lambda allocation in no-op decoratorsNotes
_Scopeclass uses__slots__for memory efficiency and avoids the overhead of generator-based context managersflush,shutdown) are optional and fail gracefully if not implementedNULLSCOPE_STRICT=1to preserve backwards compatibility