Skip to content

MAINT: tidy tic/tac/toc deprecation follow-ups (stacked on #833) - #958

Open
quantecon-services wants to merge 4 commits into
mainfrom
claude/quantecon-pr-833-review-3ibe6f
Open

MAINT: tidy tic/tac/toc deprecation follow-ups (stacked on #833)#958
quantecon-services wants to merge 4 commits into
mainfrom
claude/quantecon-pr-833-review-3ibe6f

Conversation

@quantecon-services

Copy link
Copy Markdown
Collaborator

Stacked on #833 — please merge that PR first. Once it lands, the diff here reduces to the single commit MAINT: tidy tic/tac/toc deprecation follow-ups; until then GitHub shows #833's commits as part of this PR because its head branch lives on a fork.

Small review follow-ups to the tic/tac/toc/loop_timer deprecation (#786, Step 1):

  • Module docstring: state the v1.0 removal target explicitly so it matches the warning text and the .. deprecated:: 0.12.0 directives (rendered docs read "deprecated since 0.12.0, removed in v1.0").
  • Tests: use @pytest.mark.filterwarnings("ignore::DeprecationWarning") on the four behavioural tests that exercise the deprecated timers, replacing the nested warnings.catch_warnings() blocks. The TestDeprecation tests for tac/toc keep their local catch_warnings() since they need to silence only the preceding tic() while asserting on the next call.
  • Drop a stray # noqa: comment that carried prose rather than a code.

No behaviour change. pytest quantecon/util/tests/test_timing.py -W error::DeprecationWarning passes (33 tests).

🤖 Generated with Claude Code

https://claude.ai/code/session_01A58YqvGkFvFkgtxg7PAsBt


Generated by Claude Code

Builder106 and others added 4 commits July 18, 2026 15:41
Emit a DeprecationWarning from the public `tic`, `tac`, `toc` and
`loop_timer` functions, pointing users to the modern `Timer` context
manager and `timeit` function added in #783/#794. Removal is targeted
for v0.12.0.

- `__Timer__.loop_timer` now calls its own methods (`self.tic`/`tac`/
  `toc`) instead of the public wrappers, so a single `loop_timer` call
  emits exactly one warning rather than one per run.
- The warning uses `stacklevel=3` so it is attributed to the user's
  call site rather than the wrapper.
- Added `.. deprecated:: 0.12.0` directives to the module and the
  affected docstrings.
- Added tests asserting each function warns, that `loop_timer` warns
  only once, and that the warning points at the caller.

Note: the original issue mentioned removal in 0.9.*, but the library is
already at v0.11.2, so this targets v0.12.0 instead.
- State the v1.0 removal target in the module docstring so it matches
  the warning text and the `.. deprecated:: 0.12.0` directives.
- Use `@pytest.mark.filterwarnings("ignore::DeprecationWarning")` on the
  behavioural tests that exercise the deprecated timers, replacing the
  nested `warnings.catch_warnings()` blocks.
- Drop a stray `# noqa:` comment that carried prose instead of a code.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A58YqvGkFvFkgtxg7PAsBt
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 90.895% (+0.01%) from 90.884% — claude/quantecon-pr-833-review-3ibe6f into main

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.

5 participants