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

Accept list of sources with markers in uv.tool.sources #3397

Closed
konstin opened this issue May 6, 2024 · 1 comment · Fixed by #7745
Closed

Accept list of sources with markers in uv.tool.sources #3397

konstin opened this issue May 6, 2024 · 1 comment · Fixed by #7745
Assignees
Labels
enhancement New feature or improvement to existing functionality help wanted Contribution especially encouraged projects Related to project management capabilities

Comments

@konstin
Copy link
Member

konstin commented May 6, 2024

tool.uv.sources should accept a list of dicts instead of a single dict, too, to support splitting for different python versions (detailed design TBD):

[project]
dependencies = [
    "idna>=2.8; python_version > '3.11'",
    "idna<2.8; python_version <= '3.11'"
]

[tool.uv.sources]
idna = [
  { url = "https://example.org/idna-2.8.zip, python = "<3.11" },
  { url = "https://example.org/idna-2.7.zip, python = ">=3.11" },
]
@konstin konstin added the preview Experimental behavior label May 6, 2024
@konstin konstin changed the title uv source: Accept list instead of dict Uv sources: Accept list instead of dict May 6, 2024
@zanieb zanieb added the projects Related to project management capabilities label Jun 27, 2024
@zanieb zanieb added enhancement New feature or improvement to existing functionality and removed preview Experimental behavior labels Aug 20, 2024
@zanieb zanieb changed the title Uv sources: Accept list instead of dict Accept list of sources with markers in uv.tool.sources Aug 23, 2024
@charliermarsh charliermarsh added the help wanted Contribution especially encouraged label Sep 10, 2024
@charliermarsh charliermarsh self-assigned this Sep 27, 2024
@charliermarsh
Copy link
Member

In review here: #7745

charliermarsh added a commit that referenced this issue Sep 30, 2024
…7745)

## Summary

This PR enables users to provide multiple source entries in
`tool.uv.sources`, e.g.:

```toml
[tool.uv.sources]
httpx = [
  { git = "https://github.com/encode/httpx", tag = "0.27.2", marker = "sys_platform == 'darwin'" },
  { git = "https://github.com/encode/httpx", tag = "0.24.1", marker = "sys_platform == 'linux'" },
]
```

The implementation is relatively straightforward: when we lower the
requirement, we now return an iterator rather than a single requirement.
In other words, the above is transformed into two requirements:

```txt
httpx @ git+https://github.com/encode/httpx@0.27.2 ; sys_platform == 'darwin'
httpx @ git+https://github.com/encode/httpx@0.24.1 ; sys_platform == 'linux'
```

We verify (at deserialization time) that the markers are
non-overlapping.

Closes #3397.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement to existing functionality help wanted Contribution especially encouraged projects Related to project management capabilities
Projects
No open projects
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants