-
Notifications
You must be signed in to change notification settings - Fork 308
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
urllib3 2.0.0 breaks twine #989
Comments
In twine/setup.cfg: |
See urllib3/urllib3#2997 (comment) No upper cap here is not an issue since requests has one itself. Something else is forcing your installation higher, not twine. |
Had the same problem today in Azure DevOps. Maybe the default With that in mind, I think it makes sense to put an upper restriction from within |
Signed-off-by: bigcat88 <[email protected]>
Broken CI and dependency conflicts are a bummer, but I don't think adding As @sigmavirus24 noted, there's already an implicit upper bound from requests:
Since
That said, I'm surprised to see |
By that logic, we shouldn't depend on pip to resolve dependencies either. Clearly that's not working. Furthermore, @tra-github seems to be doing something very bizarre based on the output. For one thing, they're using pip to install ... something (they haven't given us what pip was trying to install in Jenkins) and they're executing Without other information, there's no way to guess at what others are running into. Aside from that, I don't remember why we added |
Sorry, let me clarify my point. If your library explicitly uses In fact, if you are not using
This is the case for me in Azure DevOps.
This suggests that
This might suggest that if you don't use Since I don't know how your library is using |
To emphasize the confusion that can be caused, I noticed this issue was already reported in #981. I don't mean to prescribe a solution, but I think omitting |
So to be clear, a modern version of pip would solve this issue, but twine is responsible because some environments default to a version published over 3 years ago. Exactly how long is the ecosystem supposed to support these otherwise unsupported versions and their bad behavior? |
Sure, that's one way to think about it. But the core of the problem seems useful to address regardless? If you don't use urllib3 or your usage is not dependent on the urllib3 version, you can just say so and do whatever you want versioning wise. If you use it in a way that is dependent on an older version, then you should set an upper bound. I'm not sure why you are being so combative. Even though this issue was caused by out-of-date environments, that's tangential to whether your versioning can or should be improved from a purely principled perspective. Frankly, it doesn't matter to me what you decide to do since finding this issue was enough for me to figure out how to fix my pipeline, but it is a little odd that the tone for this discussion is so negative. I'm definitely sorry for initially suggesting that the lack of upper bound is your fault without any insight into how you use urllib3, but surely that's a minor misunderstanding, and you can easily clarify one way or the other to resolve the discussion more amicably. Edit: I mainly started commenting because the initial response was that versioning in requests should have prevented this, which didn't make sense to me so I just remarked on it. If you said something like "twine doesn't have an explicit upper requirement so we chose not to list it", I would've bought that as an explanation and left the versioning statement out of my comment. Sorry if it felt too much like an accusation :) |
@lynshi Out of curiosity, I tried installing Twine in fresh venv with an old version of pip:
Upgrading pip resolves the error:
I don't know if it's documented anywhere, but I think it's generally a good practice to It looks like Twine only uses urllib3 directly for retries: Lines 69 to 77 in 7c8d616
I'm guessing that functionality isn't broken in Furthermore, the root cause of this issue seems to be a bug in requests-toolbelt, that is resolved and is pending release. |
Thanks for the clarification! Totally agree with you then :) I was just making an offhand comment because it didn't sound right to me that the responsibility for setting an upper bound was punted to
Yep, thanks for the suggestion! It's just that the pipeline I had was a tiny one so I didn't bother going for total correctness which is completely my fault 😅 |
requests-toolbelt 1.0.0 is out with urllib3 2.0 support: https://pypi.org/project/requests-toolbelt/1.0.0/ Fun fact: I uploaded the release with twine 4.0.2, requests 2.29.0, requests-toolbelt 1.0.0 and urllib3 2.0.1. I also agree that twine should not enforce the upper bound of urllib3, but I made the release quickly anyway because requests will allow urllib3 2.0 soon. I believe this issue can be closed now. |
Your Environment
Thank you for taking the time to report an issue.
To more efficiently resolve this issue, we'd like to know some basic information about your system and setup.
Your operating system: Ubuntu 20.04.5 LTS
Version of python you are running: Python 3.8.10
How did you install twine? Did you use your operating system's package manager or pip or something else?
python3 -m pip install --upgrade twine
Version of twine you have installed (include complete output of): twine-4.0.2
Which package repository are you targeting? Nexus
The Issue
Excerpt from our Jenkins pipeline console log:
16:55:44 Successfully installed Pygments-2.15.1 SecretStorage-3.3.3 bleach-6.0.0 cffi-1.15.1 cryptography-40.0.2 docutils-0.19 importlib-metadata-6.6.0 importlib-resources-5.12.0 jaraco.classes-3.2.3 jeepney-0.8.0 keyring-23.13.1 markdown-it-py-2.2.0 mdurl-0.1.2 more-itertools-9.1.0 pkginfo-1.9.6 pycparser-2.21 readme-renderer-37.3 requests-toolbelt-0.10.1 rfc3986-2.0.0 rich-13.3.5 twine-4.0.2 typing-extensions-4.5.0 urllib3-2.0.0 webencodings-0.5.1 zipp-3.15.0
16:55:44 /usr/lib/python3/dist-packages/requests/init.py:89: RequestsDependencyWarning: urllib3 (2.0.0) or chardet (3.0.4) doesn't match a supported version!
16:55:44 warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
16:55:44 Traceback (most recent call last):
16:55:44 File "/usr/local/lib/python3.8/dist-packages/requests_toolbelt/_compat.py", line 48, in
16:55:44 from requests.packages.urllib3.contrib import appengine as gaecontrib
16:55:44 ImportError: cannot import name 'appengine' from 'urllib3.contrib' (/usr/local/lib/python3.8/dist-packages/urllib3/contrib/init.py)
16:55:44
16:55:44 During handling of the above exception, another exception occurred:
16:55:44
16:55:44 Traceback (most recent call last):
16:55:44 File "/usr/local/bin/twine", line 8, in
16:55:44 sys.exit(main())
16:55:44 File "/usr/local/lib/python3.8/dist-packages/twine/main.py", line 33, in main
16:55:44 error = cli.dispatch(sys.argv[1:])
16:55:44 File "/usr/local/lib/python3.8/dist-packages/twine/cli.py", line 121, in dispatch
16:55:44 main = registered_commands[args.command].load()
16:55:44 File "/usr/local/lib/python3.8/dist-packages/importlib_metadata/init.py", line 210, in load
16:55:44 module = import_module(match.group('module'))
16:55:44 File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
16:55:44 return _bootstrap._gcd_import(name[level:], package, level)
16:55:44 File "", line 1014, in _gcd_import
16:55:44 File "", line 991, in _find_and_load
16:55:44 File "", line 975, in _find_and_load_unlocked
16:55:44 File "", line 671, in _load_unlocked
16:55:44 File "", line 848, in exec_module
16:55:44 File "", line 219, in _call_with_frames_removed
16:55:44 File "/usr/local/lib/python3.8/dist-packages/twine/commands/upload.py", line 26, in
16:55:44 from twine import settings
16:55:44 File "/usr/local/lib/python3.8/dist-packages/twine/settings.py", line 22, in
16:55:44 from twine import repository
16:55:44 File "/usr/local/lib/python3.8/dist-packages/twine/repository.py", line 18, in
16:55:44 import requests_toolbelt
16:55:44 File "/usr/local/lib/python3.8/dist-packages/requests_toolbelt/init.py", line 12, in
16:55:44 from .adapters import SSLAdapter, SourceAddressAdapter
16:55:44 File "/usr/local/lib/python3.8/dist-packages/requests_toolbelt/adapters/init.py", line 12, in
16:55:44 from .ssl import SSLAdapter
16:55:44 File "/usr/local/lib/python3.8/dist-packages/requests_toolbelt/adapters/ssl.py", line 16, in
16:55:44 from .._compat import poolmanager
16:55:44 File "/usr/local/lib/python3.8/dist-packages/requests_toolbelt/_compat.py", line 50, in
16:55:44 from urllib3.contrib import appengine as gaecontrib
16:55:44 ImportError: cannot import name 'appengine' from 'urllib3.contrib' (/usr/local/lib/python3.8/dist-packages/urllib3/contrib/init.py)
Steps to Reproduce
If the issue is predictable and consistently reproducible, please list the steps here.
The text was updated successfully, but these errors were encountered: