GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||
GeezerVison is showing github.com — Update dependency chardet to v7 by renovate[bot] · Pull Request #1117 · pixee/codemodder-python Conversation
|
| Package | Change | Age | Confidence |
|---|---|---|---|
| chardet (changelog) | ~=5.2.0 → ~=7.7.0 |
v7.7.0Big release: raising max_bytes to cover a huge input no longer makes detect() slow, every answer now decodes the window it was detected from, and markup declarations are read the way browsers read them. A lot of this came from new contributors, so thank you all!
max_bytes on large inputs no longer gets slow. On compiled wheels, detect(data, max_bytes=len(data)) on 272 MiB takes about 0.2s for cp1252 and 0.5s for Shift_JIS, down from several seconds. UTF-8 validation and a final decode of the winner still read the whole window, and the other stages stop at a 256 KiB evidence cap (ADR-0006). The default 200 KB cap is still the fastest path, and default calls are unchanged.operator.itemgetter instead of a Python loop, making detect() about 1.25x faster and detect_all() about 1.35x faster. (#404, thanks @deadstrobe5)+ scan on line-wrapped base64 (128 KiB went from 5.4s to 1.2ms), unclosed <meta and <?xml tags in the markup scan, and the EBCDIC charset-declaration regex. (#403, thanks @Samin061)<meta charset> declarations used to be trusted without decoding the rest of the window, so a confident answer could still raise further in. The 5.x/6.x display names (EUC-JP, SHIFT_JIS, Big5, ISO-2022-JP) are only used when those narrower codecs decode it too. (#394 and #396, thanks @Samin061)charset= inside another attribute (like a refresh URL) no longer beats a real <meta charset>, quoted or spaced content charsets work, and an ASCII page declaring utf-16le no longer comes back as UTF-16-LE. (#389 and #398, thanks @SashaMIT and @xiehuanyi)tokenize.detect_encoding resolves them, including only counting a line-2 cookie when line 1 is blank or a comment. (#391, thanks @xiehuanyi)max_bytes cuts a code unit. (#405, thanks @AryanRG)Ö detecting as HP-Roman8, and English with a lone É detecting as MacRoman. (#383, thanks @aadsm)find -print0 output coming back as UTF-16-LE with Chinese as the language.prefer_superset=True no longer swaps in a code page that can't decode the data, and now respects include_encodings/exclude_encodings. (#393, thanks @00200200)chardetect and UniversalDetector no longer mistake input cut exactly at the byte cap for the whole stream. (#392, thanks @00200200)lookup_encoding's cache is capped at 1024 entries, since charset names come from untrusted markup. (#390, thanks @Samin061)detect_all() ranking, EBCDIC XML MIME types, and the deprecated chardet.equivalences shim. The changelog has the full list.-m/--mime-type flag for chardetect shows the MIME type next to the encoding, like file -i. (#384, thanks @smi11 for the request)EncodingInfo.is_multibyte is now is_multibyte_cjk. The old name still works with a DeprecationWarning and goes away in 8.0.pipeline/markup.py is now compiled by mypyc (15 modules total), and CI enforces 100% test coverage.Full Changelog: chardet/chardet@7.6.0...7.7.0
v7.6.0Big release: a Cython scoring kernel joins mypyc in compiled wheels, every model retrained on a deduplicated corpus, UTF-7 fixed in both directions, and a guarantee that detect() never returns an encoding that can't decode your complete input.
_kernel.py stays plain Python (PyPy and pure wheels run it interpreted, unchanged), and detection output is bit-identical. The kernel declares itself safe without the GIL, so free-threaded CPython scales instead of silently re-enabling the GIL on import: 3.14t runs the whole suite in ~340ms across 8 threads, the fastest configuration measured. Compiled builds now need both hooks: HATCH_BUILD_HOOK_ENABLE_MYPYC=true HATCH_BUILD_HOOK_ENABLE_CUSTOM=true.detect() no longer returns an encoding that cannot decode the input it was given (#380, thanks @yarikoptic). When the whole input has been examined and the winner's only multi-byte evidence is an incomplete trailing sequence, the best candidate that decodes the input completely wins instead. Genuinely truncated data keeps its answer.|NAME,+LAY| misdetecting as UTF-7 (#371 follow-up, thanks @agreenburg). The whole buffer must now actually decode as UTF-7, and a lone shifted character must land in a plausible script range.Full Changelog: chardet/chardet@7.5.1...7.6.0
v7.5.1Patch release: three detection fixes found while benchmarking against charset-normalizer's char-dataset.
Shift_JIS but using CP932 extension characters (like ①) came back as SHIFT_JIS, which fails .decode() on those same bytes. Superset promotion (CP932, CP949) now always fires when the reported name can't decode the data but the superset can.<meta charset="iso-8859-1"> came back as ISO-8859-1, which decodes to mojibake. Valid multi-byte UTF-8 now wins over a conflicting declaration.Full Changelog: chardet/chardet@7.5.0...7.5.1
v7.5.0Accuracy and speed release: truncation-proof byte validity, statistical pruning worth ~2.9x, and half the peak memory.
max_bytes and _SCAN_LIMIT slicing. Validity checks now decode incrementally with final=False. (#376, thanks @aadsm)compat_names (the default) leaking internal Python codec names for seven encodings (ISO-8859-2, ISO-8859-6, ISO-8859-13, Windows-1250, Windows-1256, Windows-1257, CP874). (#374, thanks @aadsm)compat_names leaking the internal cp932 codec name; detect() now returns CP932. (#375, thanks @uttam12331)bytes (native array indexing under mypyc) and the model blob is decompressed in chunks: peak process memory dropped from 53.9 to 27.4 MiB.bytes.translate prefilters instead of per-byte Python scans.prefer_superset=True is now documented as the recommended mode and will become the default in chardet 8.0. Callers that depend on subset names should start passing prefer_superset=False explicitly.chardet.equivalences is now a deprecation shim: evaluation predicates moved to chardet.evaluation, output-name remapping to chardet.output_names. Removal in 8.0.Full Changelog: chardet/chardet@7.4.3...7.5.0
v7.4.3Patch release: fixes a crash when input contains null bytes inside a <meta charset> declaration.
ValueError: embedded null character crash when input contained a <meta charset> declaration with a null byte in the encoding name (e.g. b'<meta charset="\x00utf-8">'). codecs.lookup() raises ValueError on embedded nulls, and lookup_encoding() was only catching LookupError. Also added defensive ValueError catches in _validate_bytes() and _to_utf8() for completeness. (#369, thanks @DRMacIver for the report)Full Changelog: chardet/chardet@7.4.2...7.4.3
v7.4.2Patch release: fixes a crash on short inputs and closes a bunch of WHATWG/IANA alias gaps.
RuntimeError: pipeline must always return at least one result on ~2% of all possible two-byte inputs (e.g. b"\xf9\x92"). Multi-byte encodings like CP932 and Johab could score above the structural confidence threshold on very short inputs, but then statistical scoring would return nothing, leaving an empty result list instead of falling through to the fallback. (#367, #368, thanks @jasonwbarnett)<meta charset> labels like x-cp1252, x-sjis, dos-874, csUTF8, and the cswindows* family all resolve correctly through the markup detection stage. Every alias was driven by a failing spec-compliance test, not speculative. (#366)Full Changelog: chardet/chardet@7.4.1...7.4.2
v7.4.1utf-16/utf-32 instead of utf-16-le/utf-16-be/utf-32-le/utf-32-be. The endian-specific codecs don't strip the BOM on decode, so callers were getting a stray U+FEFF at the start of their text. BOM-less detection is unchanged. (#364, #365)Full Changelog: chardet/chardet@7.4.0...7.4.1
v7.4.0.post2v7.4.0.post1v7.3.0mime_type field to detection results — identifies file types for both binary (via magic number matching) and text content. Returned in all detect(), detect_all(), and UniversalDetector results. (#350)pipeline/magic.py module detects 40+ binary file formats including images, audio/video, archives, documents, executables, and fonts. ZIP-based formats (XLSX, DOCX, JAR, APK, EPUB, wheel, OpenDocument) are distinguished by entry filenames. (#350)dataclasses.replace() with direct DetectionResult construction on hot paths, eliminating ~354k function calls per full test suite runv7.2.0: chardet 7.2.0include_encodings and exclude_encodings parameters to detect(), detect_all(), and UniversalDetector — restrict or exclude specific encodings from the candidate set, with corresponding -i/--include-encodings and -x/--exclude-encodings CLI flags (#343)no_match_encoding (default "cp1252") and empty_input_encoding (default "utf-8") parameters — control which encoding is returned when no candidate survives the pipeline or the input is empty, with corresponding CLI flags (#343)-l/--language flag to chardetect CLI — shows the detected language (ISO 639-1 code and English name) alongside the encoding (#342)Full changelog: https://chardet.readthedocs.io/en/latest/changelog.html
v7.1.0: chardet 7.1.0# -*- coding: ... -*- and # coding=... declarations on lines 1–2 of Python source files are now recognized with confidence 0.95 (#249)chardet.universaldetector backward-compatibility stub so that from chardet.universaldetector import UniversalDetector works with a deprecation warning (#341)++ or +word patterns (#332)detect() call — model norms are now computed during loading instead of lazily iterating 21M entries (#333)detect() now returns chardet 5.x-compatible names by default (#338)iter_unpack yielded fewer tuples instead of raising)load_models()struct.iter_unpack for bulk entry extraction (eliminates ~305K individual unpack calls)compat_names parameter (default True) to detect(), detect_all(), and UniversalDetector — set to False to get raw Python codec names instead of chardet 5.x/6.x compatible display namesprefer_superset parameter (default False) — remaps legacy ISO/subset encodings to their modern Windows/CP superset equivalents (e.g., ASCII → Windows-1252, ISO-8859-1 → Windows-1252). This will default to True in the next major version (8.0).should_rename_legacy in favor of prefer_superset — a deprecation warning is emitted when used"utf-8" instead of "UTF-8"), with compat_names controlling the public output formatlookup_encoding() to registry for case-insensitive resolution of arbitrary encoding name input to canonical namesFull changelog: https://chardet.readthedocs.io/en/latest/changelog.html
v7.0.1+4bafdea3...) were misdetected as UTF-7, breaking tools like tox_SINGLE_LANG_MAP missing aliases for single-language encoding lookup (e.g., big5 → big5hkscs)TypeError in UTF-7 codec handlingv7.0.0Ground-up, MIT-licensed rewrite of chardet. Same package name, same public API — drop-in replacement for chardet 5.x/6.x. Just way faster and more accurate!
Highlights:
detect() and detect_all() with no measurable overhead; scales on free-threaded Python 3.13t+Breaking changes vs 6.0.0:
detect() and detect_all() now default to encoding_era=EncodingEra.ALL (6.0.0 defaulted to MODERN_WEB)LanguageFilter is accepted but ignored (deprecation warning emitted)chunk_size is accepted but ignored (deprecation warning emitted)v6.0.0.post16.0.0dev0. Otherwise identical to 6.0.0.v6.0.0Latin1Prober and MacRomanProber heuristics for Western encodings, chardet now treats all single-byte charsets the same way: every encoding gets proper language-specific bigram models trained on CulturaX corpus data. This means chardet can now accurately detect both the encoding and the language for all supported single-byte encodings.EncodingEra filtering: New encoding_era parameter to detect allows filtering by an EncodingEra flag enum (MODERN_WEB, LEGACY_ISO, LEGACY_MAC, LEGACY_REGIONAL, DOS, MAINFRAME, ALL) allows callers to restrict detection to encodings from a specific era. detect() and detect_all() default to MODERN_WEB. The new MODERN_WEB default should drastically improve accuracy for users who are not working with legacy data. The tiers are:
MODERN_WEB: UTF-8/16/32, Windows-125x, CP874, CJK multi-byte (widely used on the web)LEGACY_ISO: ISO-8859-x, KOI8-R/U (legacy but well-known standards)LEGACY_MAC: Mac-specific encodings (MacRoman, MacCyrillic, etc.)LEGACY_REGIONAL: Uncommon regional/national encodings (KOI8-T, KZ1048, CP1006, etc.)DOS: DOS/OEM code pages (CP437, CP850, CP866, etc.)MAINFRAME: EBCDIC variants (CP037, CP500, etc.)--encoding-era CLI flag: The chardetect CLI now accepts -e/--encoding-era to control which encoding eras are considered during detection.max_bytes and chunk_size parameters: detect(), detect_all(), and UniversalDetector now accept max_bytes (default 200KB) and chunk_size (default 64KB) parameters for controlling how much data is examined. (#314, @bysiber)chardet.metadata.charsets module provides structured metadata about all supported encodings, including their era classification and language filter.should_rename_legacy now defaults intelligently: When set to None (the new default), legacy renaming is automatically enabled when encoding_era is MODERN_WEB.SJISDistributionAnalysis discarding valid second-byte range >= 0x80. (#315, @bysiber)MIN_RATIO threshold alongside the existing EXPECTED_RATIO.get_charset crash: Resolved a crash when looking up unknown charset names.char_len_table: Corrected the character length table for GB18030 multi-byte sequences.detect_all() returning inactive probers: Results from probers that determined "definitely not this encoding" are now excluded.Latin1Prober and MacRomanProber: These special-case probers have been replaced by the unified model-based approach described above. Latin-1, MacRoman, and all other single-byte encodings are now detected by SingleByteCharSetProber with trained language models, giving better accuracy and language identification.LanguageFilter.NONE removed: Use specific language filters or LanguageFilter.ALL instead.InputState, ProbingState, MachineState, SequenceLikelihood, and CharacterCategory are now IntEnum (previously plain classes or Enum). LanguageFilter values changed from hardcoded hex to auto().detect() default behavior change: detect() now defaults to encoding_era=EncodingEra.MODERN_WEB and should_rename_legacy=None (auto-enabled for MODERN_WEB), whereas previously it defaulted to considering all encodings with no legacy renaming.hatch-vcs for version management.create_language_model.py training script was rewritten to use the CulturaX multilingual corpus instead of Wikipedia, producing higher quality bigram frequency models.Language class converted to frozen dataclass: The language metadata class now uses @dataclass(frozen=True) with num_training_docs and num_training_chars fields replacing wiki_start_pages.pytest-timeout and pytest-xdist for faster parallel test execution. Reorganized test data directories.Thank you to everyone who contributed to this release!
And a special thanks to @helour, whose earlier Latin-1 prober work from an abandoned PR helped inform the approach taken in this release.
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
174ca5c to
45ac04d
Compare
b8bc193 to
4f1e974
Compare
a077158 to
ad45fe1
Compare
8bf9d86 to
a08c722
Compare
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
c4ef6d6 to
4853ad4
Compare
4853ad4 to
c443d9b
Compare
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
c443d9b to
adc8d44
Compare
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
At least 1 approving review is required to merge this pull request.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.