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

recognizing uv.sources when building .whl files #10602

Closed
VaasuDevanS opened this issue Jan 14, 2025 · 3 comments
Closed

recognizing uv.sources when building .whl files #10602

VaasuDevanS opened this issue Jan 14, 2025 · 3 comments

Comments

@VaasuDevanS
Copy link

I think uv run --with or uv pip install doesn't recognize tool.uv.sources in pyproject.toml file. I used the following commands to create and build a package.

uv init my-package --package --python 3.11
cd my-package
uv add gdal@https://github.com/cgohlke/geospatial-wheels/releases/download/v2024.9.22/GDAL-3.9.2-cp311-cp311-win_amd64.whl
uv build

uv automatically creates a section tool.uv.sources in pyproject.toml and includes the url to the .whl file like below (which I absolutely like btw)

gdal = [
  { url = "https://github.com/cgohlke/geospatial-wheels/releases/download/v2024.9.22/GDAL-3.9.2-cp311-cp311-win_amd64.whl" },
]

The dependencies looks like

dependencies = [
  "gdal",
]

However, when I use the built .whl like uv run --with my-package-0.1.0-py3-none-any.whl or uv pip install my-package-0.1.0-py3-none-any.whl, it tries to download the latest version of gdal (v3.10.1) and tries to build it since there are no pre-built wheels that are available directly in PyPI.

Is this the intended behavior?

@charliermarsh
Copy link
Member

This is correct -- we don't include sources in the built wheel metadata. You might be interested in #8729.

@VaasuDevanS
Copy link
Author

Thanks @charliermarsh for pointing me to the issue.

The built wheel needs to use the declared project metadata, not the resolved application versions. It might also violate the spec in some sense.

I do understand this when using uv pip install .whl or uploading to PyPI and installing from there but say, I use something like uv run --with my-package-0.1.0.tar.gz which as per my understanding has the pyproject.toml with all uv related config. How about adding a flag (or similar) to support this when installing via .tar.gz when it's a uv managed project?

@charliermarsh
Copy link
Member

I think we can track it in the linked issue.

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

No branches or pull requests

2 participants