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

Allow optional char detection dependencies in post-packaging #6702

Merged
merged 1 commit into from
May 15, 2024

Conversation

nateprewitt
Copy link
Member

This PR is a proposal to relax our requirement to have a character detection library present with all installations of Requests. While we cannot remove our reliance on charset_normalizer or chardet, there are use cases where Requests is repackaged in applications or other tools that do not need our character detection behavior. These changes will enable them to remove those dependencies from their installation.

The current use case for this shift is to allow pip to remove these dependencies entirely. That should slim the package ~2MB in 24.1.0 and avoid the overhead of importing the unneeded dependency.

@sigmavirus24 sigmavirus24 merged commit 0c030f7 into psf:main May 15, 2024
26 checks passed
@nateprewitt nateprewitt deleted the no_char_detection branch May 15, 2024 00:16
@nateprewitt nateprewitt added this to the 2.32.0 milestone May 15, 2024
@nateprewitt nateprewitt mentioned this pull request May 20, 2024
def _resolve_char_detection():
"""Find supported character detection libraries."""
chardet = None
for lib in ("chardet", "charset_normalizer"):
Copy link

Choose a reason for hiding this comment

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

While this keeps the logic of the earlier code, I think that the library which is required on should be tried first. #6714 addresses this.

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

Successfully merging this pull request may close these issues.

3 participants