-
Notifications
You must be signed in to change notification settings - Fork 87
Add type hints to all code base #557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## mypy #557 +/- ##
==========================================
- Coverage 95.54% 95.52% -0.03%
==========================================
Files 29 29
Lines 2695 2705 +10
==========================================
+ Hits 2575 2584 +9
- Misses 120 121 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds comprehensive type hints to the entire CausalPy codebase, following up on PR #556. The changes improve code maintainability and enable better static type checking.
Key Changes:
- Added type annotations to function parameters and return types across all modules
- Updated type hint syntax to use modern Python union syntax (
X | Noneinstead ofOptional[X]) - Added type hints to experiment classes, model classes, and utility functions
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 27 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/source/_static/interrogate_badge.svg | Updated documentation coverage badge from 95.8% to 95.1% |
| causalpy/utils.py | Added type hints to utility functions including round_num, _format_sig_figs, and convert_to_string |
| causalpy/skl_models.py | Added type hints to scikit-learn model adaptor classes and methods |
| causalpy/pymc_models.py | Added comprehensive type hints to PyMC model classes including LinearRegression, InstrumentalVariableRegression, and PropensityScore |
| causalpy/plot_utils.py | Updated type hints in plotting utility functions using modern union syntax |
| causalpy/experiments/synthetic_control.py | Added type hints to synthetic control experiment class methods |
| causalpy/experiments/regression_kink.py | Added type hints to regression kink experiment class methods |
| causalpy/experiments/regression_discontinuity.py | Added type hints to regression discontinuity experiment class methods |
| causalpy/experiments/prepostnegd.py | Added type hints to pre-post NEGD experiment class methods |
| causalpy/experiments/inverse_propensity_weighting.py | Added type hints to inverse propensity weighting experiment class methods |
| causalpy/experiments/interrupted_time_series.py | Added type hints to interrupted time series experiment class methods |
| causalpy/experiments/instrumental_variable.py | Added type hints to instrumental variable experiment class methods |
| causalpy/experiments/diff_in_diff.py | Added type hints to difference-in-differences experiment class methods |
| causalpy/experiments/base.py | Added type hints to base experiment class including abstract methods |
| causalpy/data/simulate_data.py | Added comprehensive type hints to all data simulation functions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
drbenvincent
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving. Assuming this is auto run remotely as part of the pre-commit checks? As in, we don't need to add to the GitHub actions?
|
Exactly, I will rebase and merge |
1ddf7f8 to
92c791e
Compare
* init * gemini * rm unwanted change * do not use assert and raise instead * add info to AGENTG.md * fix mypy * Add type hints to all code base (#557) * init * rm file * update badge * Update causalpy/experiments/regression_kink.py Co-authored-by: Copilot <[email protected]> * update docstrings * fix: apply ruff formatting after rebase --------- Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
Add type hints to all code base following on #556
📚 Documentation preview 📚: https://causalpy--557.org.readthedocs.build/en/557/