Skip to content

Denote required platforms in [tool.uv] metadata#10017

Closed
charliermarsh wants to merge 1 commit intocharlie/incompletefrom
charlie/required-platforms
Closed

Denote required platforms in [tool.uv] metadata#10017
charliermarsh wants to merge 1 commit intocharlie/incompletefrom
charlie/required-platforms

Conversation

@charliermarsh
Copy link
Copy Markdown
Member

Summary

This is an extension of #9928 that makes the set of "required platforms" configurable, thereby making the resolver less tightly-coupled to the list of platforms.

I'm wondering if there's a way for us to reuse environments for this somehow.

@charliermarsh charliermarsh force-pushed the charlie/required-platforms branch from f1ae91a to 25296f7 Compare December 19, 2024 01:48
]
"#
)]
pub required_platforms: Option<SupportedEnvironments>,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@charliermarsh charliermarsh force-pushed the charlie/required-platforms branch from 999b68c to 4c2d493 Compare December 19, 2024 03:37
/// By default, uv will require that each package includes at least one wheel for Linux, macOS,
/// and Windows. The `required-platforms` setting can be used to make those requirements more
/// or less strict. For example, an empty `required-platforms` list avoid enforcing any such
/// requirements on binary-only packages.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make clearer that the specific requirement is that for each marker, there exists at least one wheel that can be installed in the marker's environment.

@charliermarsh
Copy link
Copy Markdown
Member Author

We merged #10046 instead for now. We may return to this later.

charliermarsh added a commit that referenced this pull request Feb 14, 2025
## Summary

This PR revives #10017, which might
be viable now that we _don't_ enforce any platforms by default.

The basic idea here is that users can mark certain platforms as required
(empty, by default). When resolving, we ensure that the specified
platforms have wheel coverage, backtracking if not.

For example, to require that we include a version of PyTorch that
supports Intel macOS:

```toml
[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.11"
dependencies = ["torch>1.13"]

[tool.uv]
required-platforms = [
    "sys_platform == 'darwin' and platform_machine == 'x86_64'"
]
```

Other than that, the forking is identical to past iterations of this PR.

This would give users a way to resolve the tail of issues in #9711, but
with manual opt-in to supporting specific platforms.
loic-lescoat pushed a commit to loic-lescoat/uv that referenced this pull request Mar 2, 2025
…l-sh#10067)

## Summary

This PR revives astral-sh#10017, which might
be viable now that we _don't_ enforce any platforms by default.

The basic idea here is that users can mark certain platforms as required
(empty, by default). When resolving, we ensure that the specified
platforms have wheel coverage, backtracking if not.

For example, to require that we include a version of PyTorch that
supports Intel macOS:

```toml
[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.11"
dependencies = ["torch>1.13"]

[tool.uv]
required-platforms = [
    "sys_platform == 'darwin' and platform_machine == 'x86_64'"
]
```

Other than that, the forking is identical to past iterations of this PR.

This would give users a way to resolve the tail of issues in astral-sh#9711, but
with manual opt-in to supporting specific platforms.
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.

2 participants