Skip to content

Conversation

@juanitorduz
Copy link
Collaborator

@juanitorduz juanitorduz commented Nov 12, 2025

Closes #66

Add MyPy Checks


📚 Documentation preview 📚: https://causalpy--556.org.readthedocs.build/en/556/

@juanitorduz juanitorduz marked this pull request as draft November 12, 2025 09:11
@juanitorduz juanitorduz self-assigned this Nov 12, 2025
@juanitorduz juanitorduz added the devops DevOps related label Nov 12, 2025
@codecov
Copy link

codecov bot commented Nov 12, 2025

Codecov Report

❌ Patch coverage is 94.11765% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.40%. Comparing base (bc2fbae) to head (225a498).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
causalpy/pymc_models.py 82.75% 5 Missing ⚠️
causalpy/data/simulate_data.py 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #556      +/-   ##
==========================================
- Coverage   96.48%   96.40%   -0.09%     
==========================================
  Files          29       29              
  Lines        2703     2724      +21     
==========================================
+ Hits         2608     2626      +18     
- Misses         95       98       +3     

☔ 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.

@juanitorduz juanitorduz mentioned this pull request Nov 12, 2025
@juanitorduz juanitorduz marked this pull request as ready for review November 12, 2025 09:19
@drbenvincent
Copy link
Collaborator

Cool @juanitorduz. This area is a bit fuzzy for me, can you just mention if or how this might impact a plan by @louismagowan to implement type checking by ty #378 (comment) ? Presumably it's one of the other?

@juanitorduz
Copy link
Collaborator Author

Cool @juanitorduz. This area is a bit fuzzy for me, can you just mention if or how this might impact a plan by @louismagowan to implement type checking by ty #378 (comment) ? Presumably it's one of the other?

I think after we merge this one we can simply replace mypy by ty. This PR addresses a more fundamental issue which is making types consistent. The rest is about which tool we use to check it

@juanitorduz
Copy link
Collaborator Author

Also, I missed #378 (comment) 🤦 . Sorry! Do you wanna wait and close this PR?

@drbenvincent
Copy link
Collaborator

Also, I missed #378 (comment) 🤦 . Sorry! Do you wanna wait and close this PR?

No I think what you say here is very sensible.

This PR addresses a more fundamental issue which is making types consistent. The rest is about which tool we use to check it

Just in the middle of something, but will test this out locally and review shortly :)

@juanitorduz
Copy link
Collaborator Author

juanitorduz commented Nov 12, 2025

"trust me bro, it works" 😆

@juanitorduz
Copy link
Collaborator Author

@drbenvincent In #557 I actually add type hints (via GEMINI) to all the code base.

Copy link
Collaborator

@drbenvincent drbenvincent left a comment

Choose a reason for hiding this comment

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

Ran locally and we have 4 errors:

causalpy/data/simulate_data.py:183: error: Unsupported operand types for - ("ExtensionArray" and "int")  [operator]
causalpy/data/simulate_data.py:183: note: Left operand is of type "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]]"
causalpy/data/simulate_data.py:266: error: Argument 1 to "outcome" has incompatible type "Series[Any]"; expected "ndarray[tuple[Any, ...], dtype[Any]]"  [arg-type]
causalpy/data/simulate_data.py:271: error: Argument 6 to "outcome" has incompatible type "Series[Any]"; expected "ndarray[tuple[Any, ...], dtype[Any]]"  [arg-type]
causalpy/data/simulate_data.py:272: error: Argument 7 to "outcome" has incompatible type "Series[Any]"; expected "ndarray[tuple[Any, ...], dtype[Any]]"  [arg-type]
Found 4 errors in 1 file (checked 32 source files)

@juanitorduz
Copy link
Collaborator Author

yes, I will fix this becasue I need to rebase the PR from #544

@juanitorduz
Copy link
Collaborator Author

juanitorduz commented Nov 12, 2025

@drbenvincent Its green now

* init

* rm file

* update badge

* Update causalpy/experiments/regression_kink.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* update docstrings

* fix: apply ruff formatting after rebase

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@juanitorduz
Copy link
Collaborator Author

juanitorduz commented Nov 12, 2025

Ok! Merged the approved PR #557 to this one and I think we are now ready to merge to main 💪

@juanitorduz juanitorduz added enhancement New feature or request major labels Nov 12, 2025
@juanitorduz juanitorduz added the refactor Refactor, clean up, or improvement with no visible changes to the user label Nov 12, 2025
@juanitorduz juanitorduz merged commit 42bfcda into main Nov 12, 2025
9 of 10 checks passed
@juanitorduz juanitorduz deleted the mypy branch November 12, 2025 11:36
@juanitorduz
Copy link
Collaborator Author

Thank you @drbenvincent !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops DevOps related enhancement New feature or request major refactor Refactor, clean up, or improvement with no visible changes to the user

Projects

None yet

Development

Successfully merging this pull request may close these issues.

type hints + mypy

3 participants