Open BeeGass opened 2 weeks ago
[project]
dependencies = [
"common-dep1",
"common-dep2",
"jax>=0.4.18,<0.5.0; sys_platform == 'darwin'",
"jax[cuda12_pip]>=0.4.18,<0.5.0; sys_platform == 'linux'"
]
Does this not work as-is?
[project] dependencies = [ "common-dep1", "common-dep2", "jax>=0.4.18,<0.5.0; sys_platform == 'darwin'", "jax[cuda12_pip]>=0.4.18,<0.5.0; sys_platform == 'linux'" ]
Does this not work as-is?
@charliermarsh This works and works really well. Cant believe I wrote this out and never actually tried this on my own. I swore I did, but anyways. Sorry for the needless feature request. Thanks so much.
Great feature by the way
No worries! Thanks for following up.
Mind if I keep this open? We should add some documentation around this, I've seen it a couple times.
Feature Description
Currently, uv doesn't support specifying platform-specific dependencies directly in the
pyproject.toml
file. It would be incredibly useful to have the ability to define different dependencies for various platforms (e.g., Linux, macOS, Windows) within the samepyproject.toml
file.Use Case
As a developer working on a project that needs to run on multiple platforms (specifically Linux and macOS with M1 chip), I need to specify different dependencies for each platform. For example, I need to install the CUDA-enabled version of JAX on Linux, but the standard version on macOS.
Proposed Solution
Add support for platform-specific dependency sections in
pyproject.toml
. This could be implemented similar to howpip
handles it withsys_platform
markers, or as a new section under[tool.uv]
. For example:Or alternatively:
Benefits
Additional Context
This feature would align uv more closely with other packaging tools and standards in the Python ecosystem, making it easier for developers to transition to using uv in their projects.