migrate-to-uv
This skills documents how to migrate a Python package from the PEP-517 style
using setup.cfg to using pyproject.toml with uv.
When to use
This should be used anytime the user requests to migrate a Python package
repository structure to a format compliant with uv.
Instructions
- Move the contents of
setup.cfgtopyproject.tomland deletesetup.cfg - Add a
.python-versionspecifying the version as 3.11 - Import the dependencies from
requirements-dev.txtintopyproject.tomlusing theuvCLI (i.e.uv add -r requirements-dev.txt) - Switch the build system to use
uv_build, and removebuildfrom the dev dependencies. - Configure the version provider for Commitizen to be
uv - Remove
pylint,flake8,isort,blackfrom the dev dependencies and replace it withruff. Remove all the associated configuration files i.e.pylintrc,.flake8as well as any configuration insetup.cfgand / orpyproject.toml - Configure
ruffto force single line imports using the guidance below. - Move the configuration from
pytest.initopyproject.toml - Replace the pre-commit hooks for
black,pylint,isort,flake8withruff - Remove
pre-commitfrom the dependencies, and replace it withprek - Run
ruff formatandruff check --fixon the codebase. - Update any of the CI / CD pipelines to use
uv.
Configuring ruff to force single line imports
[tool.ruff.lint.isort]
force-single-line = true
[tool.ruff.lint]
select = ["F", "I"]