Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 88 101 +13
Branches 5 0 -5
=========================================
+ Hits 88 101 +13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Release v0.5.0: New Data Model and BDD Test Suite
🎉 Overview
This release evolves the existing
Timerwith a new data model. Each run now produces aMeasurementwith both wall-clock and CPU time (asTimeSpan), plus optional metadata.ElapsedTime, Stopwatch, and related options (count_sleep, custom storage, Timer.duration/durations) are removed. Tests move from pytest to Behave BDD.
This is a breaking release — migration to the new API is required.
✨ Key Features
🚀 Dual Time per Run (Major Change)
count_sleep.m.wall_timeandm.cpu_time(ormeasurement.cpu_timefor process-only semantics similar to v0.4’scount_sleep=False).📐 Measurement and TimeSpan
with Timer() as m:orasync with Timer() as m:yields a Measurement; on exit,m.wall_timeandm.cpu_timeare TimeSpan instances (with.durationin nanoseconds and.timedelta).@Timer()appends one Measurement per call to the wrapped callable’s measurements deque. Access viafunc.measurements[-1].wall_time/.cpu_time.start,end,duration(nanoseconds), and.timedelta.wall_time,cpu_time(both TimeSpan), and optionalmetadata.Example Usage:
🔧 Improvements
CI/CD
Code Quality
perf_counter_ns, CPU time viaprocess_time_nsMeasurementper block or per callTesting
Documentation
📊 Statistics
🧪 Testing
All behavior is covered by Behave, including:
🔄 Breaking Changes
Yes — Previous API is removed or changed.
Removed:
ElapsedTime,Stopwatch,Timer.duration/Timer.durations,count_sleep,storage,max_lenon Timer (replaced bymaxlenon decorator only),NoDurationCapturedError,TimeRunError,AppendableSequenceprotocol.New: Context manager yields Measurement (with
wall_time,cpu_time,metadata). Decorator adds measurements deque on the wrapped callable. Public types Measurement, TimeSpan. Timer parameters: metadata, maxlen (decorator only).📝 Migration Guide
with Timer() as timerwithwith Timer() as m. Usem.wall_time.timedelta/m.cpu_time.timedelta(orm.wall_time.duration/m.cpu_time.durationfor nanoseconds) instead oftimer.duration.with timer:blocks filledtimer.durations. In v0.5 eachwith Timer() as myields one Measurement; collect them yourself (e.g. append to a list) if you need a history.timer = Timer(); @timerandtimer.durationwith@Timer()andfunc.measurements[-1].wall_time/func.measurements[-1].cpu_time(use.timedeltaor.durationon those for the value).count_sleep=False): v0.5 always records both times; usemeasurement.cpu_timefor process-only time.MeasurementandTimeSpan(and themeasurementsdeque on decorated callables) for the new workflow.See README Quickstart for full examples.