-
Notifications
You must be signed in to change notification settings - Fork 4
Transition from setuptools to hatchling #657
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
WalkthroughThis update migrates the project's build and versioning system from setuptools and versioneer to hatchling and hatch-vcs. All related configuration files, environment definitions, and workflow scripts are updated to remove versioneer and setuptools, add hatchling and hatch-vcs, and adjust version handling to use static variables and hatch-vcs integration. Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant GitHub Actions
participant Hatchling
participant executorlib/_version.py
Developer->>GitHub Actions: Push code/update version
GitHub Actions->>Hatchling: Build package (hatchling build)
Hatchling->>executorlib/_version.py: Read static version variables
executorlib/_version.py-->>Hatchling: Provide __version__, version_tuple
Hatchling-->>GitHub Actions: Package built with static version
Possibly related PRs
Poem
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 30th. To opt out, configure ✨ Finishing Touches
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. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #657 +/- ##
=======================================
Coverage 96.81% 96.81%
=======================================
Files 29 29
Lines 1288 1288
=======================================
Hits 1247 1247
Misses 41 41 ☔ 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: 1
🧹 Nitpick comments (2)
executorlib/__init__.py (1)
14-21
: Consider exporting__version__
in__all__
Including"__version__"
in__all__
would make it available for wildcard imports, e.g.from executorlib import *
.__all__: list[str] = [ "get_cache_data", "FluxJobExecutor", "FluxClusterExecutor", "SingleNodeExecutor", "SlurmJobExecutor", "SlurmClusterExecutor", + "__version__", ]
executorlib/_version.py (1)
8-11
: Usetuple
instead ofTuple
for type annotations.The static analysis tool correctly identified that
typing.Tuple
is deprecated. Usetuple
instead for type annotations.- from typing import Tuple + from typing import Union - VERSION_TUPLE = Tuple[Union[int, str], ...] + VERSION_TUPLE = tuple[Union[int, str], ...]🧰 Tools
🪛 Ruff (0.11.9)
8-8:
typing.Tuple
is deprecated, usetuple
instead(UP035)
11-11: Use
tuple
instead ofTuple
for type annotationReplace with
tuple
(UP006)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (15)
.ci_support/environment-docs.yml
(1 hunks).ci_support/environment-integration.yml
(1 hunks).ci_support/environment-mini.yml
(1 hunks).ci_support/environment-mpich.yml
(1 hunks).ci_support/environment-old.yml
(1 hunks).ci_support/environment-openmpi.yml
(1 hunks).ci_support/environment-win.yml
(1 hunks).github/workflows/deploy.yml
(1 hunks).github/workflows/pipeline.yml
(5 hunks).readthedocs.yml
(0 hunks)binder/environment.yml
(1 hunks)executorlib/__init__.py
(2 hunks)executorlib/_version.py
(1 hunks)pyproject.toml
(2 hunks)setup.py
(0 hunks)
💤 Files with no reviewable changes (2)
- .readthedocs.yml
- setup.py
🧰 Additional context used
🪛 Ruff (0.11.9)
executorlib/_version.py
8-8: typing.Tuple
is deprecated, use tuple
instead
(UP035)
11-11: Use tuple
instead of Tuple
for type annotation
Replace with tuple
(UP006)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: benchmark (ubuntu-latest, 3.13, .ci_support/environment-openmpi.yml)
- GitHub Check: benchmark (ubuntu-latest, 3.13, .ci_support/environment-mpich.yml)
- GitHub Check: notebooks_integration
🔇 Additional comments (18)
.ci_support/environment-old.yml (1)
14-15
: Add hatchling and hatch-vcs dependencies
This correctly replaces the previoussetuptools
/versioneer
entries withhatchling
andhatch-vcs
(v1.27.0 and v0.4.0) per the PR objectives, ensuring the new build backend is available in the CI environment..ci_support/environment-win.yml (1)
14-15
: Add hatchling and hatch-vcs dependencies
These additions align the Windows CI environment with the transition to Hatch’s tooling. Pinning to 1.27.0 and 0.4.0 respectively maintains reproducibility..ci_support/environment-mpich.yml (1)
15-16
: Add hatchling and hatch-vcs dependencies
This update completes the MPICH CI setup by including the required Hatch build/versioning packages. Version pins are appropriate for stability..ci_support/environment-openmpi.yml (1)
15-16
: Add hatchling and hatch-vcs dependencies
The OpenMPI CI environment now correctly includes Hatch’s build backend and VCS plugin, consistent with the other environment files..ci_support/environment-integration.yml (1)
12-13
: Add hatchling and hatch-vcs dependencies
This completes the integration environment’s migration away fromversioneer
tohatchling
/hatch-vcs
, matching the project-wide build system overhaul.binder/environment.yml (1)
12-13
: Pinnedhatchling
andhatch-vcs
versions
The explicit version pins (1.27.0
and0.4.0
) match other CI environments, ensuring consistency..ci_support/environment-mini.yml (1)
8-9
: Pinnedhatchling
andhatch-vcs
dependencies
Addinghatchling =1.27.0
andhatch-vcs =0.4.0
aligns this minimal CI environment with the new build tooling.executorlib/__init__.py (2)
12-12
: Switch to static version module import
Importing the_version
module directly replaces the dynamic Versioneer logic, matching the new hatch-vcs approach.
23-23
: Assign__version__
from static_version
Using__version__ = _version.__version__
correctly surfaces the static version declared in_version.py
..github/workflows/deploy.yml (2)
35-36
: Update build commands to use Hatchling
Replacingpython setup.py
and Versioneer withhatchling build -t sdist -t wheel
aligns the release workflow with the new build backend.
33-36
:✅ Verification successful
Verify
environment-old.yml
includes the new dependencies
The workflow copies.ci_support/environment-old.yml
before building; ensure it hashatchling
andhatch-vcs
to avoid missing tooling.
🏁 Script executed:
#!/bin/bash # Check that environment-old.yml has hatchling & hatch-vcs pinned rg -nE 'hatchling|hatch-vcs' .ci_support/environment-old.ymlLength of output: 119
#!/bin/bash set -euo pipefail # Safely search for hatchling and hatch-vcs in the old environment file grep -En 'hatchling|hatch-vcs' .ci_support/environment-old.yml || echo "No matches found"
🏁 Script executed:
#!/bin/bash set -euo pipefail # Ensure the file exists if [[ ! -f .ci_support/environment-old.yml ]]; then echo "ERROR: .ci_support/environment-old.yml not found" exit 1 fi # Search for hatchling and hatch-vcs entries in the YAML dependencies list grep -En '^\s*-\s*(hatchling|hatch-vcs)' .ci_support/environment-old.yml || echo "No matches found"Length of output: 184
Confirmed dependencies in environment-old.yml
Verified that.ci_support/environment-old.yml
includes:
- hatchling =1.27.0 (line 14)
- hatch-vcs =0.4.0 (line 15)
No changes required.
.github/workflows/pipeline.yml (3)
97-97
: LGTM: Simplified dependency installation.The versioneer package has been removed from the installation step as part of transitioning from setuptools/versioneer to hatchling/hatch-vcs.
206-207
: LGTM: Removed versioneer dependency from environment file.The versioneer package is correctly removed from the environment file as it's no longer needed with the new build system.
237-238
: LGTM: Removed versioneer dependency from environment file.The versioneer package is correctly removed from the environment file, keeping only the necessary dependencies for testing.
executorlib/_version.py (1)
1-22
: LGTM: Simplified version management with static declaration.The file has been completely rewritten from a complex dynamic versioning implementation to a simple static version declaration that will be managed by hatch-vcs. This aligns with the migration from versioneer to hatchling/hatch-vcs.
🧰 Tools
🪛 Ruff (0.11.9)
8-8:
typing.Tuple
is deprecated, usetuple
instead(UP035)
11-11: Use
tuple
instead ofTuple
for type annotationReplace with
tuple
(UP006)
pyproject.toml (3)
1-8
: LGTM: Successfully migrated build system to hatchling.The build system has been properly updated to use hatchling and hatch-vcs instead of setuptools and versioneer. The specified versions for the dependencies provide reproducible builds.
103-120
: LGTM: Proper hatchling build configuration.The build configuration for hatchling is correctly set up to include only the necessary package and specify build targets for sdist and wheel.
121-123
: LGTM: Correct hatch-vcs versioning configuration.The versioning configuration is properly set up to use VCS as the source and points to the version file. This completes the migration from versioneer to hatch-vcs for version management.
- hatchling | ||
- hatch-vcs |
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.
🛠️ Refactor suggestion
Pin hatchling
and hatch-vcs
versions for reproducibility
Unpinned dependencies can drift and lead to inconsistencies across CI runs. Please specify explicit versions (e.g., align with other environments at hatchling =1.27.0
and hatch-vcs =0.4.0
).
- - hatchling
- - hatch-vcs
+ - hatchling =1.27.0
+ - hatch-vcs =0.4.0
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
- hatchling | |
- hatch-vcs | |
- hatchling =1.27.0 | |
- hatch-vcs =0.4.0 |
🤖 Prompt for AI Agents
In .ci_support/environment-docs.yml around lines 4 to 5, the dependencies
'hatchling' and 'hatch-vcs' are listed without version pins. To ensure
reproducibility and consistency across CI runs, update these entries to specify
explicit versions, such as 'hatchling=1.27.0' and 'hatch-vcs=0.4.0', matching
the versions used in other environments.
Summary by CodeRabbit