GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — docs should mention that compression.zstd and other modules are optional · Issue #139707 · python/cpython

docs should mention that compression.zstd and other modules are optional #139707

New issue
Copy link
New issue
Copy link
Closed
Closed
docs should mention that compression.zstd and other modules are optional#139707
Copy link
Assignees
encukou
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir

Description

@ShaneHarvey
ShaneHarvey
opened on Oct 7, 2025
Issue body actions

Documentation

The compression.zstd docs page and 3.14 what's new changelog entry neglect to mention that compression.zstd is an optional build time dependency. The import will fail when cpython is built without libzstd:

    import compression.zstd  # noqa: I900
    ^^^^^^^^^^^^^^^^^^^^^^^
/opt/python/3.14/lib/python3.14/compression/zstd/__init__.py:29: in <module>
    import _zstd
E   ModuleNotFoundError: No module named '_zstd'

https://docs.python.org/3/library/compression.zstd.html#module-compression.zstd

Linked PRs

  • gh-139707: Add docs for optional modules #140171
  • gh-139707: Better ModuleNotFoundError message for missing stdlib modules #140219
  • gh-139707: Add mechanism for distributors to supply error messages for missing stdlib modules #140783
  • [3.14] gh-139707: Add docs for optional modules (GH-140171) #141204
  • gh-139707: Specify winreg, msvcrt and winsound module availability in docs #140429
  • [3.14] gh-139707: Specify winreg, msvcrt and winsound module availability in docs (GH-140429) #141351
  • [3.13] gh-139707: Specify winreg, msvcrt and winsound module availability in docs (GH-140429) #141350
  • gh-139707: Fix example for configure option #142153
  • gh-139707: Copy-strip change to idle.rst into idlelib #143718
  • [3.14] gh-139707: Copy-strip change to idle.rst into idlelib (GH-143718) #143744
  • [3.13] gh-139707: Copy-strip change to idle.rst into idlelib #143767
Reacted by Jacob Henner, Johannes (Joey) Nicholas and Oleg Korsak

Activity

Next
  1. ShaneHarvey
    added
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    on Oct 7, 2025
  2. github-project-automation
    added this to docs issueson Oct 7, 2025
  3. github-project-automation
    moved this to Todo in docs issueson Oct 7, 2025
  4. StanFromIreland commented on Oct 7, 2025

    @StanFromIreland
    StanFromIreland
    on Oct 7, 2025
    Member
    More actions

    The import will fail when cpython is built without libzstd

    Note that this is the same for several other modules when built without their dependency, e.g. zlib and is not done there. This is a more general issue.
    This could be a good thing to add to the agenda for today's docs community meeting.

    cc @emmatyping

  5. ShaneHarvey commented on Oct 7, 2025

    @ShaneHarvey
    ShaneHarvey
    on Oct 7, 2025
    ContributorAuthor
    More actions

    Thanks. It would be great if the docs included this info from the PEP:

    The libzstd library will become an optional dependency of CPython. If the library is not available, the compression.zstd module will be unavailable. This is handled automatically on Unix platforms as part of the normal build environment detection.

    On Windows, libzstd will be added to the source dependencies used to build libraries CPython depends on for Windows.

    https://peps.python.org/pep-0784/#libzstd-optional-dependency

  6. AA-Turner commented on Oct 7, 2025

    @AA-Turner
    AA-Turner
    on Oct 7, 2025
    Member
    More actions

    I agree with Stan, note that many extension modules are similarly optional, and CPython can be built without them. Worse, some Linux distributions (notably Debian/Ubuntu) intentionally split up 'python' into several OS level packages.

    I don't think anything needs to change here, I'd suggest closing.

    A

    Reacted by Emma Smith
  7. AA-Turner
    added
    pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
    on Oct 7, 2025
  8. ShaneHarvey commented on Oct 7, 2025

    @ShaneHarvey
    ShaneHarvey
    on Oct 7, 2025
    ContributorAuthor
    More actions

    Not mentioning that it's optional is intentionally misleading because library developers don't know they need to guard against the import error.

    Reacted by Jan Dolecek, Peter Schneider and dolfies
  9. AA-Turner commented on Oct 7, 2025

    @AA-Turner
    AA-Turner
    on Oct 7, 2025
    Member
    More actions

    In that vein, you should guard against importing eg threading as OS support might not exist.

    We aren't generally in the business of documenting all the ways that different configuration options can change what exists at runtime, given if building Python from source we expect the user to manage their own environment etc, which includes ensuring all the required/desired system libraries are installed.

    A

    Reacted by Stan Ulbrych
  10. ShaneHarvey commented on Oct 7, 2025

    @ShaneHarvey
    ShaneHarvey
    on Oct 7, 2025
    ContributorAuthor
    More actions

    I think the difference is that threading is a core component that doesn't really have a fallback option so libraries that depend on it can't do anything if it doesn't exist. Compression however is often an optional feature that can be ignored. aio-libs/aiohttp#11603 is a real example of a bug that likely could have been avoided if the docs were more clear.

    That said I understand either outcome here and don't really have anything else to add. Thank you for the consideration.

  11. StanFromIreland
    assigned
    encukou
    on Oct 7, 2025
  12. StanFromIreland commented on Oct 7, 2025

    @StanFromIreland
    StanFromIreland
    on Oct 7, 2025
    Member
    More actions

    Note that this has been discussed at today's docs community meeting.

  13. emmatyping commented on Oct 8, 2025

    @emmatyping
    emmatyping
    on Oct 8, 2025
    Member
    More actions

    @ShaneHarvey out of curiosity, did you build CPython yourself?

  14. GalaxySnail commented on Oct 8, 2025

    @GalaxySnail
    GalaxySnail
    on Oct 8, 2025
    Contributor
    More actions

    In that vein, you should guard against importing eg threading as OS support might not exist.

    According to the documentation and PEP 11, threading is no longer optional as of python 3.7.

  15. emmatyping commented on Oct 8, 2025

    @emmatyping
    emmatyping
    on Oct 8, 2025
    Member
    More actions

    Another example is that the ecosystem depends on the zlib module to install wheel packages and many other uses, but even that is optional and may be missing in some environments.

    Pretty much no code that I know of guards against zlib missing but it is optional.

    I will also mention that you could always build zstandard yourself and pass the right configure arguments to build with zstandard support (c.f.

    cpython/configure.ac

    Line 5505 in d9cb191

    LIBZSTD_CFLAGS=${LIBZSTD_CFLAGS-""}
    ). Specifically LIBZSTD_CFLAGS and LIBZSTD_LIBS.

    Reacted by Gregory P. Smith
  16. 24 remaining items

  17. StanFromIreland
    added 4 commits that reference this issue on Dec 6, 2025

    pythongh-139707: Add docs for optional modules (pythonGH-140171)

    1d8bbf1

    pythongh-139707: Specify `winreg`, `msvcrt` and `winsound` module ava…

    5a5b0c6

    pythongh-139707: Add mechanism for distributors to supply error messa…

    2ac75e1

    pythongh-139707: Fix example for configure option (pythonGH-142153)

    7eccf23
  18. terryjreedy
    added a commit that references this issue on Jan 12, 2026

    pythongh-139707: Copy-strip change to idle.rst into idlelib

    56192a8
  19. terryjreedy commented on Jan 12, 2026

    @terryjreedy
    terryjreedy
    on Jan 12, 2026
    Member
    More actions

    When I reviewed the first PR (#140171), I forgot to mention that changes to idle.rst and hence idle.html need to be copied in idlelib. The command to do so is in the commit message of my new PR, which fixes this oversight. (Stan and I are working to add an auto reminder.) This PR will be auto backported to 3.14 but not 3.13, even though relevant, as the include file did not get backported to 3.13.

    I may manually backport the net text addition to 3.13. The diff includes a separate change that I believe is entirely due to a Sphinx change. I expect it would appear in a 3.13 PR. EDIT: I did the backport, which had the extraneous html change before editing.

    I checked that the addition looks fine in the IDLE doc display for both main and 3.13.

  20. terryjreedy
    added a commit that references this issue on Jan 12, 2026

    gh-139707: Copy-strip change to idle.rst into idlelib (#143718)

    ec254e2
  21. miss-islington
    added a commit that references this issue on Jan 12, 2026

    pythongh-139707: Copy-strip change to idle.rst into idlelib (pythonGH…

    19ac4a0
  22. terryjreedy
    added a commit that references this issue on Jan 12, 2026

    [3.14] gh-139707: Copy-strip change to idle.rst into idlelib (GH-143718…

    110a77b
  23. reidenong
    added a commit that references this issue on Jan 12, 2026

    pythongh-139707: Copy-strip change to idle.rst into idlelib (python#1…

    bc68b8d
  24. terryjreedy
    added 2 commits that reference this issue on Jan 13, 2026

    [3.13] pythongh-139707: Copy-strip change to idle.rst into idlelib

    09916c6

    [3.13] gh-139707: Copy-strip change to idle.rst into idlelib (#143767)

    92d80c6
  25. thunder-coding
    added a commit that references this issue on Feb 15, 2026

    pythongh-139707: Copy-strip change to idle.rst into idlelib (python#1…

    78b17c0
  26. zetaloop
    added a commit that references this issue on Mar 17, 2026

    [3.13] gh-139707: Copy-strip change to idle.rst into idlelib (#143767)

    e401c2a
  27. zetaloop
    added a commit that references this issue on Mar 30, 2026

    [3.13] gh-139707: Copy-strip change to idle.rst into idlelib (#143767)

    1ee2cf9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @encukou
    encukou

Labels

docsDocumentation in the Doc dirDocumentation in the Doc dir

Projects

  • docs issues
    Status
    Todo
    Show more project fields

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.