astral-sh / uv

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

uv pip installs all requirements in --override even though nothing depends on them #4826

Closed sbidoul closed 2 months ago

sbidoul commented 2 months ago

In some cases, which I have difficulties to narrow down, it seems uv is installing everything specified in --override even though nothing depends on them.

I can reproduce with uv 0.2.21 with python 3.10 on Ubuntu 22.04 with the following bits.

Assume the following pyproject.toml

[project]
name = "demo"
version = "1.0"
dependencies = [
    "urllib3"
]

and the following override.txt (sorry, I could not narrow it down to something smaller):

alabaster==0.7.12
cachecontrol==0.12.11
cachetools==5.2.0
ebaysdk==2.2.0
firebase-admin==2.17.0
google-api-core==1.33.2
google-api-python-client==1.11.0
googleapis-common-protos==1.56.4
google-auth==2.13.0
google-auth-httplib2==0.1.0
google-cloud-core==2.3.2
google-cloud-firestore==2.7.2
google-cloud-storage==2.5.0
google-crc32c==1.5.0
google-resumable-media==2.4.0
grpcio==1.49.1
grpcio-status==1.48.2
imagesize==1.4.1
inotify==0.2.10
msgpack==1.0.4
nose==1.3.7
pip==24.1
protobuf==3.20.3
proto-plus==1.22.1
rsa==4.9
snowballstemmer==2.2.0
sphinx==1.6.7
sphinxcontrib-websupport==1.1.0
uritemplate==3.0.1
appdirs==1.4.4
asn1crypto==1.4.0
attrs==21.2.0
babel==2.8.0
backcall==0.2.0
bcrypt==3.2.0
beautifulsoup4==4.10.0
beniget==0.4.1
blessed==1.19.0
bottleneck==1.3.2
brotli==1.0.9
cached-property==1.5.2
certifi==2020.6.20
chardet==4.0.0
charset-normalizer==2.0.6
crudini==0.9.3
cryptography==3.4.8
cycler==0.11.0
dbfread==2.0.7
dbus-python==1.2.18
decorator==4.4.2
defusedxml==0.7.1
docopt==0.6.2
docutils==0.17.1
entrypoints==0.4
et-xmlfile==1.0.1
feedparser==6.0.8
fonttools==4.29.1
freezegun==1.0.0
fs==2.4.12
gast==0.5.2
geoip2==2.9.0
gevent==21.8.0
greenlet==1.1.2
gyp==0.1
html2text==2020.1.16
html5lib==1.1
httpie==2.6.0
httplib2==0.20.2
humanize==0.0.0
idna==3.3
importlib-metadata==4.6.4
iniconfig==1.1.1
iniparse==0.4
ipykernel==6.7.0
ipython==7.31.1
ipython-genutils==0.2.0
isodate==0.6.1
jdcal==1.0
jedi==0.18.0
jinja2==3.0.3
jupyter-client==7.1.2
jupyter-core==4.9.1
kiwisolver==1.3.2
libsass==0.20.1
llvmlite==0.38.0
lxml==4.8.0
lz4==3.1.3+dfsg
markdown==3.3.6
markupsafe==2.0.1
matplotlib==3.5.1
matplotlib-inline==0.1.3
maxminddb==2.0.3
mock==4.0.3
more-itertools==8.10.0
mpmath==0.0.0
nest-asyncio==1.5.4
netifaces==0.11.0
num2words==0.5.10
numba==0.55.1
numexpr==2.8.1
numpy==1.21.5
odfpy==1.4.2
ofxparse==0.21
olefile==0.46
packaging==21.3
pandas==1.3.5
paramiko==2.9.3
parso==0.8.1
passlib==1.7.4
pbr==5.8.0
pexpect==4.8.0
pg-activity==2.2.1
phonenumbers==8.12.1
pickleshare==0.7.5
pillow==9.0.1
pluggy==0.13.0
ply==3.11
polib==1.1.1
prompt-toolkit==3.0.28
psutil==5.9.0
psycogreen==1.0.1
psycopg2==2.9.2
ptyprocess==0.7.0
pudb==2020.1
py==1.10.0
pyasn1==0.4.8
pyasn1-modules==0.2.1
pycurl==7.44.1
pydot==1.4.2
pygments==2.11.2
pygobject==3.42.0
pyinotify==0.9.6
pyjwt==2.3.0
pynacl==1.5.0
pyopenssl==21.0.0
pyp==2.12
pyparsing==2.4.7
pypdf2==1.26.0
pysimplesoap==1.16.2
pysocks==1.7.1
pytest==6.2.5
python3-openid==3.2.0
python-apt==2.3.0+ubuntu2
python-dateutil==2.8.1
python-ldap==3.2.0
python-slugify==4.0.0
python-stdnum==1.17
pythran==0.10.0
pytz==2022.1
pyzbar==0.1.8
pyzmq==22.3.0
qrcode==7.3.1
reportlab==3.6.8
requests==2.25.1
requests-file==1.5.1
requests-toolbelt==0.9.1
rjsmin==1.1.0
roman==3.3
scipy==1.8.0
setproctitle==1.2.2
setuptools==59.6.0
sgmllib3k==1.0.0
simplejson==3.17.6
six==1.16.0
soupsieve==2.3.1
suds-community==1.0.0
sympy==1.9
tables==3.7.0
toml==0.10.2
tornado==6.1
traitlets==5.1.1
ubuntu-advantage-tools==27.7
ufolib2==0.13.1
unicodedata2==14.0.0
unidecode==1.3.3
unittest2==1.1.0
urllib3==1.26.5
urwid==2.1.2
vobject==0.9.6.1
wand==0.6.7
watchdog==2.1.6
wcwidth==0.2.5
webencodings==0.5.1
websocket-client==1.2.3
werkzeug==2.0.2
wheel==0.37.1
xlrd==1.2.0
xlsxwriter==3.0.2
xlwt==1.3.0
xmlsec==1.3.12
zeep==4.1.0
zipp==1.0.0
zope-event==4.4
zope-interface==5.4.0

then

uv venv -p 3.10 ; uv pip install --override override.txt . installs everything that is in override.txt even though the project does not depend on them.

konstin commented 2 months ago

The problem occurs with an override of pysocks==1.7.1. pysocks is an optional dependency of urllib3 (pysocks!=1.5.7,<2.0,>=1.5.6; extra == 'socks') and it seems we're doing the extras check wrong when applying overrides.

sbidoul commented 2 months ago

Thanks for the fix!