astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
19.77k stars 582 forks source link

Simplify union of marker expression and negation when split in disjunction #5078

Closed ibraheemdev closed 3 weeks ago

ibraheemdev commented 1 month ago

More complex case of https://github.com/astral-sh/uv/issues/5044, e.g. (platform_machine == 'x86_64' and platform_system == 'Windows') or (platform_machine != 'x86_64' and platform_system == 'Windows') could be simplified to platform_system == 'Windows'.

Shows up with:

--find-links https://download.pytorch.org/whl/torch_stable.html

torch==2.3.1+cpu ; platform_machine == 'x86_64'
torch==2.3.1+cu118 ; platform_machine != 'x86_64'
filelock==3.13.1
    # via torch
fsspec==2024.3.1
    # via torch
intel-openmp==2021.4.0 ; (platform_machine == 'x86_64' and platform_system == 'Windows') or (platform_machine != 'x86_64' and platform_system == 'Windows')
    # via mkl
jinja2==3.1.3
    # via torch
markupsafe==2.1.5
    # via jinja2
mkl==2021.4.0 ; (platform_machine == 'x86_64' and platform_system == 'Windows') or (platform_machine != 'x86_64' and platform_system == 'Windows')
    # via torch
mpmath==1.3.0
    # via sympy
networkx==3.2.1
    # via torch
sympy==1.12
    # via torch
tbb==2021.11.0 ; (platform_machine == 'x86_64' and platform_system == 'Windows') or (platform_machine != 'x86_64' and platform_system == 'Windows')
    # via mkl
torch==2.3.1+cpu ; platform_machine == 'x86_64'
    # via -r requirements.in
torch==2.3.1+cu118 ; platform_machine != 'x86_64'
    # via -r requirements.in
typing-extensions==4.10.0
    # via torch
ibraheemdev commented 1 month ago

Possibly what we should to do here is normalize to CNF or DNF.