Repository navigation
encodings module is not documented #136162
Description
Activity
- addedtype-featureA feature request or enhancementA feature request or enhancementdocsDocumentation in the Doc dirDocumentation in the Doc dirstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
on Jul 1, 2025 AFAIR, users should use codecs when possible instead of directly accessing encodings and the submodules are documented but only their name is public I think (I'm on mobile so it's hard to check).
cc @malemburg what do you recommend?
Reacted by Stan UlbrychThe encodings package itself provides codec search functions, which gets registered upon import and a normalization function which is used by the search functions. The search functions not only take care of mapping a codec name to codec module (within the encodings package), but also define the codec module interface which all codec modules in the encodings package have to use.
Those search functions can be used directly as well if you want to bypass the normal codecs.lookup() API for some reason.
If we document these, we should add a note that these functions should normally not be used directly, only in special cases, e.g. for testing purposes or to check whether a particular encodings codec module is available or not (the codecs.lookup() API scans all search functions, so it may well find other such modules elsewhere).
Reacted by Stan Ulbrych- added 3 commits that reference this issue
on Jul 9, 2025
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
- StatusShow more project fieldsTodo
Feature or enhancement
encodingscontains several public and documented (at the module level) functions:cpython/Lib/encodings/__init__.py
Lines 1 to 29 in 23caccf
But, only its submodules are documented in
codecs.rst:cpython/Doc/library/codecs.rst
Lines 1487 to 1491 in 23caccf
Should we add
encodingsitself to the docs?Linked PRs
encodings#136164encodingspackage functions (GH-136164) #136453encodingspackage functions (GH-136164) #136454encodingspackage documentation #136456