Skip to content

Conversation

@drbenvincent
Copy link
Collaborator

@drbenvincent drbenvincent commented Nov 22, 2025

This PR modernizes our pyproject.toml configuration and enables stricter linting rules to catch potential bugs and improve code quality.

Changes to pyproject.toml

  • Added project URLs: Documentation, Changelog, and Discussions links for better discoverability
  • Enhanced coverage settings: Added source, branch, show_missing, and fail_under=80 threshold
  • Expanded ruff linting: Added rules to catch bugs (F, B), modernize syntax (UP), and improve code style (C4, SIM)
  • Improved mypy config: Added python_version and check_untyped_defs settings
  • Cleaned up dependencies: Removed pathlib from dev dependencies (standard library)

Code Fixes

Fixed 27 linting errors across the codebase to comply with new stricter rules:

  • B008, B006: Fixed mutable default arguments (common Python pitfall)
  • B028: Added proper stacklevel to warnings
  • B905: Added strict= parameter to zip() calls
  • UP038: Modernized isinstance() calls to use | syntax (Python 3.10+)
  • SIM102, SIM105: Simplified nested conditionals and exception handling
  • C405: Converted list literals to set literals where appropriate

Pre-commit Configuration

  • Added exclude: ^docs/ to ruff pre-commit hook to avoid applying strict rules to example notebooks
  • All pre-commit checks now pass

Testing

  • All 197 tests pass
  • Code coverage threshold set to 80%
  • No breaking changes to public APIs

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

@drbenvincent drbenvincent added the devops DevOps related label Nov 22, 2025
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@juanitorduz
Copy link
Collaborator

Does this one need a rebase?

@drbenvincent drbenvincent force-pushed the pyproject.toml-changes branch from 1769678 to ce23675 Compare November 24, 2025 12:05
@drbenvincent
Copy link
Collaborator Author

Remote tests failing saying test coverage is 0%, which is obviously not true. Debugging...

@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

❌ Patch coverage is 52.80000% with 59 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.72%. Comparing base (c1cd88f) to head (bcc7f46).

Files with missing lines Patch % Lines
...salpy/tests/test_integration_its_new_timeseries.py 26.47% 50 Missing ⚠️
causalpy/pymc_models.py 73.07% 4 Missing and 3 partials ⚠️
causalpy/data/simulate_data.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #571      +/-   ##
==========================================
- Coverage   91.95%   88.72%   -3.24%     
==========================================
  Files          33       33              
  Lines        4776     4844      +68     
  Branches        0      352     +352     
==========================================
- Hits         4392     4298      -94     
- Misses        384      428      +44     
- Partials        0      118     +118     

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

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

Labels

devops DevOps related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants