G
YouTube TikTok Games
Skip to content

pyzstd and stdlib (PEP 784) #45

Closed
Closed

Description

@Rogdham

Python 3.14 introduces the compression.zstd module, adding Zstandard support to the standard library (PEP 784). The CPython implementation was adapted from the pyzstd codebase. As the maintainer of pyzstd, I was contacted by @emmatyping and contributed to this effort.

I believe the future of Zstandard in Python lies in the stdlib, with additional libraries offering extra functionality in pure Python (without the need for a C module). A shared codebase maintained by CPython core developers will mutualize the work (updates, security, performance, etc.), and benefit the entire community.

As a result, below is my personal plan of action:

  • Help with PEP 784 and the integration of pyzstd into stdlib ➡️ was done in the last few months.
  • Backport the code from stdlib to support for Python versions before 3.14 ➡️ backports.zstd is available.
  • Promote adoption of the stdlib and help with migration.
  • Use stdlib in pyzstd.

For pyzstd specifically, I am working on the following points:

  • Update the readme and documentation to recommend the standard library for new users and provide a migration guide for existing users.
  • Deprecate parts of the pyzstd public API that cannot be reimplemented using the standard library.
  • Refactor the pyzstd codebase to use stdlib instead of C/CFFI bindings, making pyzstd a pure Python module.

This ticket will be used to gather feedback and track progress on the above plan.

Activity

  1. pinned this issue on Sep 21, 2025
  2. Rogdham commented on Sep 24, 2025

    @Rogdham
    OwnerAuthor

    Update the readme and documentation to recommend the standard library for new users and provide a migration guide for existing users.

    This is now live on the git master branch and the latest version of the documentation.

    It will become automatically promoted to the stable version of the documentation on the next release of pyzstd.

  3. Rogdham commented on Oct 4, 2025

    @Rogdham
    OwnerAuthor

    Deprecate parts of the pyzstd public API that cannot be reimplemented using the standard library.

    This has been done in #47. Very few deprecations!

  4. Rogdham commented on Nov 30, 2025

    @Rogdham
    OwnerAuthor

    Refactor the pyzstd codebase to use stdlib instead of C/CFFI bindings, making pyzstd a pure Python module.

    The refactor is happening in #56! There may still be some rough edges, but it is usable at this point.

    Image

    This took longer than anticipated, due to the SeekableZstdFile class being intertwine with ZstdFile. I managed to get away with this by… refactoring it out in #55.

  5. Rogdham commented on Dec 7, 2025

    @Rogdham
    OwnerAuthor

    Version 0.19.0 of pyzstd has been released! 🚀

    pyzstd is now a pure-python module, relying on compression.zstd (or backports.zstd for Python before 3.14), without any public API changes.

    This completes the plan created last September. :shipit:

  6. ThomasWaldmann commented on Jan 21, 2026

    @ThomasWaldmann

    @Rogdham @emmatyping Thanks much to you both for moving this into py314 stdlib (and providing that backport for older Pythons).

    Now we can remove our Cython-based binding to libzstd from Borg Backup. \o/

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions