Skip to content

Add python-timer materials folder - #966

Merged
realpython-bot merged 2 commits into
masterfrom
maintenance/python-timer-20261201
Dec 2, 2026
Merged

realpython-bot merged 2 commits into
masterfrom
maintenance/python-timer-20261201

Conversation

@realpython-bot

Copy link
Copy Markdown
Collaborator

Adds the companion code for Python Timer Functions: Three Ways to Monitor Your Code, which had no folder in this repo.

  • timer.py: the final Timer class from "The Python Timer Code" section (two placeholder-free f-strings made plain strings for ruff F541)
  • latest_tutorial*.py: the article's download example without timing, with perf_counter(), and with Timer as a class, context manager, and decorator, plus the codetiming variant
  • latest_tutorials.py: the named-timer accumulation example
  • requirements.txt: pinned to the article's dependencies field (codetiming==1.4.0, realpython-reader==1.1.4)

Update draft: https://realpython.com/pbjt/blog/post/2590/change/
Trello card: https://trello.com/c/22EXBSXc

Verification: built a Python 3.14 venv on the pins and ran every script; each downloaded the latest tutorial and printed timings in the article's format (Elapsed time: 0.2359 seconds, Downloaded 10 tutorials in 0.21 seconds). Also ran the decorator script on Python 3.15, exercised Timer's repr, TimerError, and named timers, and profiled with cProfile. ruff@0.14.1 format --check, ruff check, and dircheck.py pass. vermin reports a 3.7 minimum; the README states the article's 3.9 floor.

🤖 Generated with Claude Code

@realpython-bot
realpython-bot merged commit b8168cb into master Dec 2, 2026
1 check passed
@realpython-bot
realpython-bot deleted the maintenance/python-timer-20261201 branch December 2, 2026 07:08
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