Skip to content

Migrate from setuptools to uv with hatch build backend#4

Merged
tofarr merged 1 commit intomainfrom
migrate-to-uv-hatch
Dec 7, 2025
Merged

Migrate from setuptools to uv with hatch build backend#4
tofarr merged 1 commit intomainfrom
migrate-to-uv-hatch

Conversation

@tofarr
Copy link
Owner

@tofarr tofarr commented Dec 7, 2025

🚀 Migration: setuptools → uv + hatch

This PR modernizes the project's build system and dependency management by migrating from setuptools to uv with hatch as the build backend, following the same configuration style as the injecty repository.

📋 Changes Made

Build System Modernization

  • Replaced setup.py with modern pyproject.toml configuration
  • Adopted hatch as the build backend (same as injecty)
  • Removed MANIFEST.in (replaced by hatch build configuration)
  • Added uv.lock for reproducible builds

Dependency Management

  • Migrated to uv for faster dependency resolution
  • Preserved all existing dependencies with same version constraints
  • Updated Python requirement to >=3.10 (required for hatch)
  • Maintained dev dependencies: black, pytest, pytest-cov, pytest-xdist, pylint

CI/CD Improvements

  • Updated GitHub workflows to use uv for all operations
  • Modernized GitHub Actions to v4/v5
  • Updated test matrix to Python 3.10-3.13 (matching new requirement)
  • Improved release workflow with automatic version extraction from git tags

🔧 Technical Details

Build Configuration

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["schemey"]

[tool.hatch.build.targets.sdist]
exclude = ["tests*", "examples", "images"]

Workflow Changes

  • Quality checks: uv run black, uv run pytest, uv run pylint
  • Release process: uv build and uv publish
  • Dependency installation: uv sync --extra dev

Verification

All functionality has been tested and verified:

  • Dependencies install correctly with uv sync --extra dev
  • All tests pass (105/105 tests passed)
  • Code formatting check passes (black --check)
  • Linting passes with perfect score (10.00/10)
  • Package builds successfully (uv build)

🎯 Benefits

  1. ⚡ Faster dependency resolution with uv
  2. 🏗️ Modern build system with hatch
  3. 🔒 Reproducible builds with lock files
  4. 🚀 Simplified CI/CD workflows
  5. 📦 Better dependency management and virtual environment handling
  6. 🔄 Consistency with other projects (injecty style)

🔄 Migration Impact

  • No breaking changes to the public API
  • Same dependencies and version constraints
  • Improved development experience with faster installs
  • Future-proof packaging setup

This migration brings the project in line with modern Python packaging best practices while maintaining full backward compatibility.

@tofarr can click here to continue refining the PR

- Replace setup.py with modern pyproject.toml configuration
- Update to use hatch as build backend (following injecty style)
- Migrate GitHub workflows to use uv for dependency management
- Update Python requirement to >=3.10 (required for hatch)
- Remove legacy MANIFEST.in file (replaced by hatch build config)
- Add uv.lock for reproducible builds
- Update CI to test Python 3.10-3.13
- Modernize GitHub Actions to v4/v5

Co-authored-by: openhands <openhands@all-hands.dev>
@tofarr tofarr marked this pull request as ready for review December 7, 2025 22:39
@tofarr tofarr merged commit fba5ca8 into main Dec 7, 2025
6 checks passed
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.

2 participants