uv icon indicating copy to clipboard operation
uv copied to clipboard

Per-platform overrides

Open mjclarke94 opened this issue 1 year ago • 5 comments

Generally speaking, version resolution is platform independent for the majority of dependencies, with only a subset (torch...and others...mostly torch) needing a nudge in the right direction. Cross-platform support is probably the main thing preventing us from adopting uv/rye at the moment, as we build on MacOS but deploy on Linux. There's already an open issue for cross platform support (#2079), but I imagine implementing that is a fairly involved process.

As a short term solution to unblock the adoption of uv until cross-platform version resolution is implemented, overrides.txt could allow the pinning of versions on a per-platform basis.

mjclarke94 avatar Mar 03 '24 21:03 mjclarke94

So in some sense, I think that overrides already do allow this, because you can provide multiple overrides for a single package, like:

pywin32 > 1.0 : sys.platform == 'win32'
pywin32 < 1.0 : sys.platform != 'win32'

With this, whenever we see pywin32, we'll replace it with both of these, so only the one that applies to the given platform will end up being activated.

Would this work for what you're describing?

charliermarsh avatar Mar 03 '24 23:03 charliermarsh

Ah, maybe. I'm dealing with torch specifically, so have to deal with the issue of changing the pypi index url on a per-platform basis.

mjclarke94 avatar Mar 04 '24 10:03 mjclarke94

I'm not sure if my question is the same question or a different one, but it seems related. Does uv already support the functionality of https://pypi.org/project/pip-compile-cross-platform/ ? Can we compile once, and have it keep the markers for different OSes in the resulting requirements.txt file?

pamelafox avatar Mar 05 '24 23:03 pamelafox

@pamelafox -- We don't quite support that yet. That tool looks like a wrapper around Poetry which does a platform-agnostic resolution. We're going to support that in the future, but right now we only lock for a single platform (like pip-compile).

charliermarsh avatar Mar 06 '24 00:03 charliermarsh

@pamelafox -- We don't quite support that yet. That tool looks like a wrapper around Poetry which does a platform-agnostic resolution. We're going to support that in the future, but right now we only lock for a single platform (like pip-compile).

is there somewhere we can track progress towards platform-agnostic resolution?

danieleades avatar Mar 30 '24 09:03 danieleades

Hi @charliermarsh We would like to be able to uv pip compile on requirementes.in file cross platform, i.e. from a same uv install create different txt files for windows, linux, mac. Is this the right issue or should I create a separated one?

inoa-jboliveira avatar Apr 15 '24 18:04 inoa-jboliveira

@inoa-jboliveira -- I think that's best tracked as part of https://github.com/astral-sh/uv/issues/2679. (We're building some prototypes for it now.)

charliermarsh avatar Apr 15 '24 18:04 charliermarsh

See also https://github.com/astral-sh/uv/issues/3347 for cross-platform lock files.

I don't know if there's a clear todo here regarding per-platform overrides so I'm going to close this. Let me know if we're missing something.

zanieb avatar Jun 19 '24 00:06 zanieb