Skip to content

Comments

Enforce type hinting and remove redundant numpydoc type annotations#717

Merged
dylanhmorris merged 17 commits intomainfrom
copilot/enforce-type-hinting-removal
Feb 24, 2026
Merged

Enforce type hinting and remove redundant numpydoc type annotations#717
dylanhmorris merged 17 commits intomainfrom
copilot/enforce-type-hinting-removal

Conversation

Copy link
Contributor

Copilot AI commented Feb 19, 2026

  • Configure ruff to enforce type hinting (add ANN to ruff select, ignore ANN401)
  • Add missing type hints to pyrenew/ source files
  • Verify numpydoc config already ignores PR04
  • Remove type annotations from numpydoc docstring Parameters sections
  • Change **kwargs: Any / *args: Any to use object instead of Any
  • Remove now-unused from typing import Any imports
  • Apply reviewer suggestions (better types for censorednormal.py, multisignal_model.py, pyrenew_builder.py, observation/base.py, ar.py, math.py)
  • Fix remaining ANN401 error with # noqa: ANN401 for genuinely-Any argument in differencedprocess.py
  • Exclude test/ from ANN ruff checks via [tool.ruff.lint.per-file-ignores]
  • All ruff checks pass for both pyrenew/ and test/
Original prompt

This section details on the original issue you should resolve

<issue_title>Enforce type hinting and remove redundant type annotations from numpydoc docstrings</issue_title>
<issue_description>Steps to implement

  • Ensure ruff is configured to enforce type hinting
  • Add type hints to functions wherever they are missing
  • Configure numpydoc pre-commit hook not to require type annotation in docstrings
  • Remove type hints from docstrings</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.91%. Comparing base (923fda8) to head (356341c).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #717   +/-   ##
=======================================
  Coverage   97.91%   97.91%           
=======================================
  Files          51       51           
  Lines        1580     1583    +3     
=======================================
+ Hits         1547     1550    +3     
  Misses         33       33           
Flag Coverage Δ
unittests 97.91% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link

github-actions bot commented Feb 19, 2026

Thank you for your contribution @copilot 🚀! Your github-pages is ready for download 👉 here 👈!
(The artifact expires on 2026-03-03T15:56:00Z. You can re-generate it by re-running the workflow here.)

- Update pyproject.toml to add ANN rules (ignoring ANN401)
- Add missing type hints to all pyrenew/ source files
- Remove type annotations from numpydoc docstring Parameters sections
  (redundant now that code-level type hints are in place)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI changed the title [WIP] Enforce type hinting and clean up numpydoc docstrings Enforce type hinting and remove redundant numpydoc type annotations Feb 19, 2026
Copilot AI requested a review from dylanhmorris February 19, 2026 17:44
@dylanhmorris
Copy link
Collaborator

@copilot please revise so that **kwargs are type-hinted as object rather than as Any

Co-authored-by: dylanhmorris <8032117+dylanhmorris@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 23, 2026

@copilot please revise so that **kwargs are type-hinted as object rather than as Any

Done in 4c767e9. All **kwargs (and *args) across pyrenew/ are now typed as object instead of Any. The now-unused from typing import Any imports were also removed (kept only where Any is genuinely needed, e.g. dict[str, Any] in pyrenew_builder.py and differencing_order: Any in differencedprocess.py).

@dylanhmorris dylanhmorris marked this pull request as ready for review February 24, 2026 00:50
@dylanhmorris
Copy link
Collaborator

@copilot please run ruff-check and resolve any remaining errors. If there are instances in which an argument should genuinely be typed as Any, add a one-off ignore for ANN401

…ss.py

Co-authored-by: dylanhmorris <8032117+dylanhmorris@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 24, 2026

@copilot please run ruff-check and resolve any remaining errors. If there are instances in which an argument should genuinely be typed as Any, add a one-off ignore for ANN401

Done in d2b026a. The only remaining ANN401 was in differencedprocess.py:73assert_valid_differencing_order(differencing_order: Any) — where Any is intentional (the function exists to validate whatever type is passed). Added # noqa: ANN401 there. All other ruff checks now pass cleanly.

@dylanhmorris
Copy link
Collaborator

@damonbayer @cdc-mitzimorris pre-commit is now failing because of lack of type annotation in the test suite. Going back and forth on whether we should enforce it. Thoughts before I we either turn off that rule for the tests or ask copilot to type-annotate the test suite?

@damonbayer
Copy link
Collaborator

either turn off that rule for the tests or ask copilot to type-annotate the test suite?

I think we can exclude the tests.

@dylanhmorris
Copy link
Collaborator

That was my inclination too.

@copilot, please exclude all files within the tests directory from the ANN ruff check for type annotation, but retain other ruff checks for those files.

Co-authored-by: dylanhmorris <8032117+dylanhmorris@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 24, 2026

That was my inclination too.

@copilot, please exclude all files within the tests directory from the ANN ruff check for type annotation, but retain other ruff checks for t...

Done in 356341c. Added [tool.ruff.lint.per-file-ignores] to pyproject.toml to suppress ANN checks for test/**, while all other ruff rules remain enforced for those files.

Copy link
Collaborator

@dylanhmorris dylanhmorris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reviewed all changes. This LGTM.

@dylanhmorris dylanhmorris merged commit 927603f into main Feb 24, 2026
8 checks passed
@dylanhmorris dylanhmorris deleted the copilot/enforce-type-hinting-removal branch February 24, 2026 16:24
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.

Enforce type hinting and remove redundant type annotations from numpydoc docstrings

3 participants