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

Markers under universal resolution could have more concise representation #5992

Open
notatallshaw opened this issue Aug 10, 2024 · 1 comment
Labels
wish Not on the immediate roadmap

Comments

@notatallshaw
Copy link
Contributor

uv 0.2.35

Markers are looking much better in general, but here's an example that popped up for me that felt a little too verbose:

$ echo -e "sqlalchemy>=2" | uv pip compile --universal --annotation-style line - 2>/dev/null | grep "greenlet=="
greenlet==3.0.3 ; (python_version < '3.13' and platform_machine == 'AMD64') or (python_version < '3.13' and platform_machine == 'WIN32') or (python_version < '3.13' and platform_machine == 'aarch64') or (python_version < '3.13' and platform_machine == 'amd64') or (python_version < '3.13' and platform_machine == 'ppc64le') or (python_version < '3.13' and platform_machine == 'win32') or (python_version < '3.13' and platform_machine == 'x86_64')  # via sqlalchemy

This could have been more neatly represented as:

greenlet==3.0.3 ; python_version < '3.13'  and (platform_machine == 'AMD64' or platform_machine == 'WIN32' or platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'ppc64le' or platform_machine == 'win32' or platform_machine == 'x86_64')  # via sqlalchemy

This is fairly small and not that big of a deal.

@ibraheemdev
Copy link
Member

Hmm yeah this is a consequence of us strictly writing in DNF form. Your example does seem like it would be much simpler in CNF.. it's possible that we want more aggressive simplification. However, having a stable representation of markers is also important (see #5179), so if we do decide to simplify more we should use an established algorithm instead of continuously adding heuristics (as we were before #5898).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wish Not on the immediate roadmap
Projects
None yet
Development

No branches or pull requests

3 participants