FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: add missing packaging dependency for feature requiring urllib3 by harkamaljot · Pull Request #1732 · googleapis/google-auth-library-python · GitHub

This repository was archived by the owner on Mar 6, 2026. It is now read-only.

fix: add missing packaging dependency for feature requiring urllib3 - #1732

Merged
harkamaljot merged 8 commits into
mainfrom
add-dependency
Apr 7, 2025
Merged

fix: add missing packaging dependency for feature requiring urllib3#1732
harkamaljot merged 8 commits into
mainfrom
add-dependency

Conversation

Copy link
Copy Markdown
Contributor

Resolves an ImportError: No module named 'packaging' encountered when using functionality in the urllib3.py file.

The code paths relying on urllib3 transport also have a runtime dependency on the packaging library. This dependency was introduced in PR #1390.

However, packaging was not explicitly listed as a requirement for the urllib3 in setup.py. This was masked during development because nox often installs packaging transitively. Users installing the library without having nox or its dependencies installed separately would face an ImportError when the urllib3 dependent code executes.

This PR fixes the issue by explicitly adding packaging alongside urllib3 in the extras group definition. This ensures that installing the optional feature via the extra correctly pulls in all its necessary runtime dependencies.

harkamaljot requested review from a team April 6, 2025 22:46
harkamaljot requested a review from sai-sunder-s April 6, 2025 23:01
Comment thread setup.py
"reauth": "pyu2f>=0.1.5",
"enterprise_cert": ["cryptography", "pyopenssl"],
"pyjwt": ["pyjwt>=2.0", "cryptography>=38.0.3"],
"urllib3": ["urllib3", "packaging"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

how does user know to install this extra?

Maybe update the error msg in the try catch and tell users about this extra.

Also move packaging into the try?

from packaging import version # type: ignore

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

installing dependency like pip install google-auth[urllib3] should install all the dependencies defined for urlllib3. I was thinking about updating error message, however I saw similar error in other modules, but this is definitely confusing. let me update the message to include google-auth[urllib3] command to avoid user installing directly from pip.

harkamaljot requested a review from sai-sunder-s April 7, 2025 18:04
Comment thread google/auth/transport/urllib3.py Outdated
raise ImportError(
"The urllib3 library is not installed from please install the "
"urllib3 package to use the urllib3 transport."
"Error: Missing 'urllib3' dependency for 'google-auth'."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

same error msg for packaging as well.

Does the caught_exc have the name of the missing library?

harkamaljot requested a review from sai-sunder-s April 7, 2025 20:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL