🐛 fix(deps): drop chardet for req file decoding#3820
Merged
gaborbernat merged 2 commits intotox-dev:mainfrom Feb 24, 2026
Merged
🐛 fix(deps): drop chardet for req file decoding#3820gaborbernat merged 2 commits intotox-dev:mainfrom
gaborbernat merged 2 commits intotox-dev:mainfrom
Conversation
chardet v6 has critical performance regressions (chardet/chardet#321) causing test pipelines to slow down by orders of magnitude. Replace chardet with BOM detection and UTF-8 decoding with locale fallback, matching pip's own `_decode_req_file` implementation.
ssbarnea
added a commit
to ansible/molecule
that referenced
this pull request
Feb 25, 2026
Avoids critical bug tox-dev/tox#3820 related to newer chardet, older versions might still bring the buggy version and this one no longer lists it as a dependency. Fixes collection pipeline which was getting stuck due to this bug.
sergei-maertens
added a commit
to maykinmedia/django-common
that referenced
this pull request
Mar 9, 2026
See tox-dev/tox#3820 - chardet 6 was indeed causing massive performance regressions. Tox 4.46+ does not rely on it any longer.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
chardet v6 introduced critical performance regressions (chardet/chardet#321) that cause test pipelines to slow down by orders of magnitude — tests going from ~0.2s to ~70s each. Since tox 4.45.0 requires
chardet>=6.0.0.post1, this forces all users onto the broken version. Fixes #3818.The
chardetlibrary was only used in one place: detecting the encoding of requirements files viachardet.detect(). This is replaced with BOM detection and UTF-8 decoding with a locale-based fallback, matching pip's own_decode_req_fileimplementation. This handles UTF-8, UTF-16, and UTF-32 (with BOM) and falls back to the system locale encoding for non-UTF-8 files — the same strategy pip uses to read requirements files.This removes
chardetfrom the dependency tree entirely, eliminating the performance regression and reducing tox's install footprint.