Skip to content

Add python-timer materials folder - #966

Open
realpython-bot wants to merge 1 commit into
masterfrom
maintenance/python-timer-20261201
Open

realpython-bot wants to merge 1 commit 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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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