Skip to content

Make pyinfra compatible with uv #1390

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

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from

Conversation

karlicoss
Copy link
Contributor

@karlicoss karlicoss commented Jul 3, 2025

uv is a super fast package/project manager.
Some nice things about using are

  • it's managing the project's virtual env automatically, so you don't need to remember to activate it etc (https://docs.pyinfra.com/en/3.x/contributing.html#dev-setup)
  • it's super easy to swap out any versions simply via uv run arguments (rather than modifying setup.py and recreating venv manually), this even applies to python versions

That said, the change is sort of orthogonal to uv, in the sense that pyproject.toml is a more modern way of describing projects. Ideally everything from setup.py which doesn't need to be dynamic should be in it, at the moment feels like everything could be moved except perhaps get_version_from_changelog. But for now limiting the scope of PR and just forwarding to setup.py via dynamic property.


uv requires pyproject.toml, so previously trying to use uv against pyinfra resulted in:

$ uv run --extra dev mypy -p pyinfra
error: No `project` table found in: `/pyinfra/pyproject.toml`

After adding minimal [project] section to pyproject.toml, uv commands run succesfully.

Testing: to make sure the change doesn't introduce any visible changes to the package:

  • built wheels on current 3.x branch and on my branch via python3 setup.py bdist_wheel
  • unpacked via unzip
  • compared recursively via diff -bur dist_old/ dist_new/

This results in exact match, i.e. all package metadata is unchanged as expected.

  • Pull request is based on the default branch (3.x at this time)
  • Pull request includes tests for any new/updated operations/facts
  • Pull request includes documentation for any new/updated operations/facts
  • Tests pass (see scripts/dev-test.sh)
  • Type checking & code style passes (see scripts/dev-lint.sh)

`uv` requires `pyproject.toml`, so previously trying to use `uv` against pyinfra resulted in:

```
$ uv run --extra dev mypy -p pyinfra
error: No `project` table found in: `/pyinfra/pyproject.toml`
```

After adding minimal `[project]` section to `pyproject.toml`, `uv` commands run succesfully.

Testing: to make sure the change doesn't introduce any visible changes to the package:

- built wheels on current `3.x` branch and on my branch via `python3 setup.py bdist_wheel`
- unpacked via `unzip`
- compared recursively via `diff -bur dist_old/ dist_new/`

This results in exact match, i.e. all package metadata is unchanged as expected.
@karlicoss karlicoss force-pushed the make-uv-compatible branch from 4bbe7f7 to bf7139b Compare July 3, 2025 01:14
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.

1 participant