Skip to content
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

uv pip compile perf regression in 0.2.6 #4040

Closed
blueraft opened this issue Jun 5, 2024 · 3 comments · Fixed by #4058
Closed

uv pip compile perf regression in 0.2.6 #4040

blueraft opened this issue Jun 5, 2024 · 3 comments · Fixed by #4058
Assignees
Labels
great writeup A wonderful example of a quality contribution 💜 performance Potential performance improvement

Comments

@blueraft
Copy link
Contributor

blueraft commented Jun 5, 2024

There's a significant performance regression in uv 0.2.6 for projects that rely on setuptools_scm.

MRE

  1. Initialize a blank git repo.
  2. Copy the following pyproject.toml.
[build-system]
requires = ["setuptools<69.3.0", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
name = 'foobar'
dynamic = ["version"]
requires-python = ">=3.9"

dependencies = ["flask"]

[tool.setuptools_scm]

Benchmarks from an Ubuntu machine (I am able to reproduce this on MacOS too):

  1. uv 0.2.6
❯ uv --version
uv 0.2.6
❯ hyperfine 'uv pip compile pyproject.toml'
Benchmark 1: uv pip compile pyproject.toml
  Time (mean ± σ):     604.1 ms ±   5.2 ms    [User: 515.1 ms, System: 96.1 ms]
  Range (min … max):   596.4 ms … 611.8 ms    10 runs
  1. uv 0.2.5
❯ uv --version
uv 0.2.5
❯ hyperfine 'uv pip compile pyproject.toml'
Benchmark 1: uv pip compile pyproject.toml
  Time (mean ± σ):      58.2 ms ±   1.3 ms    [User: 41.6 ms, System: 23.7 ms]
  Range (min … max):    55.1 ms …  61.0 ms    50 runs
@konstin konstin added performance Potential performance improvement great writeup A wonderful example of a quality contribution 💜 labels Jun 5, 2024
@konstin
Copy link
Member

konstin commented Jun 5, 2024

The cause of this regression is we unified some code paths and now require a static version field to read a pyproject.toml statically, instead we're now building the package to get the metadata including the version.

@charliermarsh
Copy link
Member

We can fix this though it's sort of a pain.

@charliermarsh charliermarsh self-assigned this Jun 5, 2024
@blueraft
Copy link
Contributor Author

blueraft commented Jun 5, 2024

Thank you!

charliermarsh added a commit that referenced this issue Jun 5, 2024
## Summary

This PR separates "gathering the requirements" from the rest of the
metadata (e.g., version), which isn't required when installing a
package's _dependencies_ (as opposed to installing the package itself).
It thus ensures that we don't need to build a package when a static
`pyproject.toml` is provided in `pip compile`.

Closes #4040.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
great writeup A wonderful example of a quality contribution 💜 performance Potential performance improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants