-
-
Notifications
You must be signed in to change notification settings - Fork 554
Update pre-commit: add pyproject-fmt #2814
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
Summary by CodeRabbit
WalkthroughAdds a pyproject-fmt pre-commit hook and substantially rewrites pyproject.toml: enables dynamic versioning (version sourced from holidays.version.version), reorganizes project metadata (authors, license, requires-python, classifiers, urls), adds python-dateutil as a dependency, and refactors tooling configs (setuptools, mypy, ruff, pytest, coverage). Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~18 minutes Suggested reviewers
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #2814 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 286 286
Lines 17120 17120
Branches 2255 2255
=========================================
Hits 17120 17120 ☔ 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.
Actionable comments posted: 3
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
.pre-commit-config.yaml
(1 hunks)pyproject.toml
(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: PPsyrius
PR: vacanza/holidays#2398
File: holidays/groups/islamic.py:301-301
Timestamp: 2025-04-01T14:14:01.519Z
Learning: Running `make pre-commit` in the holidays project can automatically fix common code style issues like whitespace in blank lines.
Learnt from: PPsyrius
PR: vacanza/holidays#2599
File: holidays/countries/__init__.py:193-193
Timestamp: 2025-06-05T09:31:22.753Z
Learning: For the holidays Python library, when encountering line length or formatting issues, suggest contributors run `make pre-commit` to auto-format their files instead of providing specific manual formatting fixes like line splitting or noqa comments.
Learnt from: PPsyrius
PR: vacanza/holidays#2594
File: holidays/countries/micronesia.py:25-30
Timestamp: 2025-06-04T11:06:21.179Z
Learning: In the holidays repository, line length formatting should defer to pre-commit formatting checks rather than manual suggestions. If pre-commit allows it, the formatting is acceptable per project policy.
Learnt from: PPsyrius
PR: vacanza/holidays#2615
File: tests/countries/test_anguilla.py:20-24
Timestamp: 2025-06-16T15:48:33.931Z
Learning: The holidays project uses `make pre-commit` test which includes `ruff` as the primary linter. If `ruff` passes, then Pylint warnings that don't appear in `ruff` are considered acceptable and can be ignored.
📚 Learning: 2025-04-26T19:55:09.581Z
Learnt from: KJhellico
PR: vacanza/holidays#2501
File: scripts/docs/gen_index.py:1-12
Timestamp: 2025-04-26T19:55:09.581Z
Learning: The holidays project uses a standard header for all Python (.py) files in the repository that describes the overall holidays library, including authors, website and license information, regardless of the specific purpose of individual script files.
Applied to files:
pyproject.toml
📚 Learning: 2025-06-21T16:30:12.749Z
Learnt from: KJhellico
PR: vacanza/holidays#2654
File: holidays/countries/cape_verde.py:1-12
Timestamp: 2025-06-21T16:30:12.749Z
Learning: The holidays project does not use module docstrings in country holiday files. All country files start directly with the copyright header comment block without module docstrings, maintaining a consistent coding style across the project.
Applied to files:
pyproject.toml
🔇 Additional comments (5)
.pre-commit-config.yaml (1)
58-62
: Solid addition: pyproject-fmt hook is correctly integrated and pinned.Hook is pinned to v2.6.0 and doesn’t overlap with other formatters. Nice.
Given prior learnings for this repo, please run
make pre-commit
locally to auto-fix any formatting that pyproject-fmt enforces on pyproject.toml before CI.pyproject.toml (4)
59-65
: isort + ruff coexistence is fine here.You didn’t include the ruff “I” rules, so there’s no conflict with isort. Config matches ruff-format’s Black compatibility.
1-3
: Ensure [build-system] is present.The file view doesn’t show a
[build-system]
table. Without it, PEP 517 builds/installs from source can break. If it’s missing, add:[build-system] requires = ["setuptools>=68", "wheel"] build-backend = "setuptools.build_meta"
37-46
: Dynamic versioning verified — no action requiredholidays/version.py defines a plain string: version = "0.79" and contains only comments — no imports or side-effectful calls were detected.
- holidays/version.py — line 13: version = "0.79"
53-57
: Ruff lint. keys are supported — no action required*Verified the repo files: lint.* keys in pyproject.toml are supported by the pinned Ruff versions.
- pyproject.toml: [tool.ruff] uses lint.select, lint.per-file-ignores, etc.
- .pre-commit-config.yaml: astral-sh/ruff-pre-commit rev = v0.12.8 (ruff-check, ruff-format)
- requirements/dev.txt: ruff==0.12.7
- Note: lint.* was introduced in Ruff v0.2.0, so the pinned versions (0.12.x) support these keys. The sandbox couldn't run pre-commit (command not found), but the file evidence confirms compatibility.
No change required.
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
.pre-commit-config.yaml
(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: PPsyrius
PR: vacanza/holidays#2398
File: holidays/groups/islamic.py:301-301
Timestamp: 2025-04-01T14:14:01.519Z
Learning: Running `make pre-commit` in the holidays project can automatically fix common code style issues like whitespace in blank lines.
Learnt from: PPsyrius
PR: vacanza/holidays#2599
File: holidays/countries/__init__.py:193-193
Timestamp: 2025-06-05T09:31:22.753Z
Learning: For the holidays Python library, when encountering line length or formatting issues, suggest contributors run `make pre-commit` to auto-format their files instead of providing specific manual formatting fixes like line splitting or noqa comments.
Learnt from: PPsyrius
PR: vacanza/holidays#2594
File: holidays/countries/micronesia.py:25-30
Timestamp: 2025-06-04T11:06:21.179Z
Learning: In the holidays repository, line length formatting should defer to pre-commit formatting checks rather than manual suggestions. If pre-commit allows it, the formatting is acceptable per project policy.
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Test Python 3.10 on windows-latest
- GitHub Check: Test Python 3.13 on windows-latest
🔇 Additional comments (1)
.pre-commit-config.yaml (1)
58-62
: LGTM on adding pyproject-fmt.Good pin to v2.6.0 and clean placement alongside other formatting hooks. This will keep pyproject.toml consistent with the repo’s tooling.
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.
LGTM.
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.
LGTM 🛠️
Proposed change
Add pyproject.toml automatic formatting.
Type of change
holidays
functionality in general)Checklist
make check
locally; all checks and tests passed.