Skip to content

Remove Hatch completely and replace with UV + setuptools#892

Merged
benoit-cty merged 7 commits into
masterfrom
copilot/fix-887
Jul 12, 2025
Merged

Remove Hatch completely and replace with UV + setuptools#892
benoit-cty merged 7 commits into
masterfrom
copilot/fix-887

Conversation

Copilot AI commented Jul 11, 2025

Copy link
Copy Markdown
Contributor

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

  • Updated pyproject.toml build system from hatchling to setuptools
  • Removed all [tool.hatch.*] sections (environments, scripts, version, build targets)
  • Added proper setuptools configuration for dynamic versioning and package discovery
  • Updated conda recipe to use setuptools instead of hatchling

Dependency Management

  • Generated new requirements.txt using uv export instead of hatch-pip-compile
  • Generated new requirements/requirements-api.txt for Docker builds using UV
  • Updated documentation to reflect UV-managed dependencies

CI/CD Fixes

  • Fixed the externally managed Python issue: Updated GitHub workflows to use uv run python instead of uv pip install --system
  • Updated both package.yml and python-publish.yml workflows
  • Verified version checking works correctly with the new approach

Documentation Updates

  • Updated all documentation files to replace hatch run commands with uv run
  • Updated CONTRIBUTING.md, testing documentation, README files, and example scripts
  • Fixed taskipy task syntax for ruff command

Verification

All functionality preserved:

  • Package builds successfully with uv build
  • All tests pass: 118 tests passed with uv run task test-package
  • CLI works correctly: uv run codecarbon --help and uv run codecarbon --version
  • Code formatting works: uv run task format
  • Version checking works: uv 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.sh
    • Triggering command: curl -LsSf REDACTED (dns block)
  • get.geojs.io
    • Triggering command: /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
    • Triggering command: /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.

Copilot AI changed the title [WIP] Remove Hatch completly Remove Hatch completely and replace with UV + setuptools Jul 11, 2025
Copilot AI requested a review from benoit-cty July 11, 2025 17:41
Comment thread docs/edit/test_on_scaleway.rst Outdated
@benoit-cty benoit-cty marked this pull request as ready for review July 12, 2025 15:35
@benoit-cty benoit-cty requested review from SaboniAmine and inimaz July 12, 2025 15:35

@inimaz inimaz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@benoit-cty benoit-cty merged commit 46df5e4 into master Jul 12, 2025
11 checks passed
@benoit-cty benoit-cty deleted the copilot/fix-887 branch July 12, 2025 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove Hatch completly

3 participants