Remove Hatch completely and replace with UV + setuptools#892
Merged
Conversation
Copilot
AI
changed the title
[WIP] Remove Hatch completly
Remove Hatch completely and replace with UV + setuptools
Jul 11, 2025
benoit-cty
approved these changes
Jul 12, 2025
f32c937 to
2baba87
Compare
3b462c5 to
2baba87
Compare
Co-authored-by: benoit-cty <6603048+benoit-cty@users.noreply.github.com>
Co-authored-by: benoit-cty <6603048+benoit-cty@users.noreply.github.com>
2baba87 to
619d041
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR completely removes Hatch from the codecarbon repository and replaces it with UV for dependency management and setuptools for building, addressing the migration from Hatch to UV.
Key Changes
Build System Migration
pyproject.tomlbuild system fromhatchlingtosetuptools[tool.hatch.*]sections (environments, scripts, version, build targets)setuptoolsinstead ofhatchlingDependency Management
requirements.txtusinguv exportinstead ofhatch-pip-compilerequirements/requirements-api.txtfor Docker builds using UVCI/CD Fixes
uv run pythoninstead ofuv pip install --systempackage.ymlandpython-publish.ymlworkflowsDocumentation Updates
hatch runcommands withuv runVerification
✅ All functionality preserved:
uv builduv run task test-packageuv run codecarbon --helpanduv run codecarbon --versionuv run task formatuv run python .github/check_version.py✅ No breaking changes - All existing UV-based workflows continue to work as expected
✅ Complete Hatch removal - No remaining references to Hatch in the codebase (except in generated lock files)
The repository now uses UV as the sole package manager and build tool, resolving the GitHub Actions failure with externally managed Python environments.
Fixes #887.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
astral.shcurl -LsSf REDACTED(dns block)get.geojs.io/home/REDACTED/work/codecarbon/codecarbon/.venv/bin/python /home/REDACTED/work/codecarbon/codecarbon/.venv/bin/pytest --ignore=tests/test_viz_data.py -vv -m not integ_test tests/(dns block)ip-api.com/home/REDACTED/work/codecarbon/codecarbon/.venv/bin/python /home/REDACTED/work/codecarbon/codecarbon/.venv/bin/pytest --ignore=tests/test_viz_data.py -vv -m not integ_test tests/(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.