Skip to content

gh-132983: Add documentation for compression.zstd #133911

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

emmatyping
Copy link
Member

@emmatyping emmatyping commented May 12, 2025

This PR adds docs for the compression and compression.zstd modules.


📚 Documentation preview 📚: https://cpython-previews--133911.org.readthedocs.build/

@emmatyping emmatyping added the needs backport to 3.14 bugs and security fixes label May 12, 2025
Copy link
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntactic review

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Copy link
Contributor

@StanFromIreland StanFromIreland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some grammar notes.

Code block directives need a line after.

Please settle on gaps between descriptions for the file, currently it seems random, some parts use two and others one.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
@AA-Turner
Copy link
Member

cc @python/proofreaders, I think the text here could benefit from a close reading, Stan has already noted several English grammar/syntax points.

@StanFromIreland
Copy link
Contributor

@python/proofreaders

Are there any active members, out of curiosity? I do not know of any nor have seen any around.

I think the text here could benefit from a close reading

I will go through it again later.


--------------

This module provides classes and convenience functions for compressing and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This module provides classes and convenience functions for compressing and
This module provides classes and functions for compressing and

Unnecessary and awkward

This module provides classes and convenience functions for compressing and
decompressing data using the Zstandard (or "zstd") compression algorithm. Also
included is a file interface supporting reading and writing contents of ``.zst``
files created from the :program:`zstd` utility, as well as raw zstd compressed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
files created from the :program:`zstd` utility, as well as raw zstd compressed
files created with the :program:`zstd` utility, as well as raw zstd compressed
Suggested change
files created from the :program:`zstd` utility, as well as raw zstd compressed
files created by the :program:`zstd` utility, as well as raw zstd compressed

Grammar

--------------

This module provides classes and convenience functions for compressing and
decompressing data using the Zstandard (or "zstd") compression algorithm. Also
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
decompressing data using the Zstandard (or "zstd") compression algorithm. Also
decompressing data using the Zstandard (or *zstd*) compression algorithm. Also

Italics are more fitting here


This module provides classes and convenience functions for compressing and
decompressing data using the Zstandard (or "zstd") compression algorithm. Also
included is a file interface supporting reading and writing contents of ``.zst``
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
included is a file interface supporting reading and writing contents of ``.zst``
included is a file interface that supports reading and writing the contents of ``.zst`` files.

:class:`Strategy` classes for setting advanced (de)compression parameters.


.. exception:: ZstdError
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should get a little introduction like other modules.

"This module provides the following exception: "

Or something along those lines.

argument should not be used.

When opening a file for writing, the *options* argument can be a dictionary
providing advanced decompression parameters, see
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
providing advanced decompression parameters, see
providing advanced decompression parameters; see

*zstd_dict* argument is a :class:`ZstdDict` instance to be used during
compression.

For binary mode, this function is equivalent to the :class:`ZstdFile`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For binary mode, this function is equivalent to the :class:`ZstdFile`
In binary mode, this function is equivalent to the :class:`ZstdFile`

constructor: ``ZstdFile(file, mode, ...)``. In this case, the
*encoding*, *errors* and *newline* parameters must not be provided.

For text mode, a :class:`ZstdFile` object is created, and wrapped in an
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For text mode, a :class:`ZstdFile` object is created, and wrapped in an
In text mode, a :class:`ZstdFile` object is created, and wrapped in an


For text mode, a :class:`ZstdFile` object is created, and wrapped in an
:class:`io.TextIOWrapper` instance with the specified encoding, error handling
behavior, and line ending(s).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
behavior, and line ending(s).
behavior, and line endings.

Unnecessary IMO


For binary mode, this function is equivalent to the :class:`ZstdFile`
constructor: ``ZstdFile(file, mode, ...)``. In this case, the
*encoding*, *errors* and *newline* parameters must not be provided.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
*encoding*, *errors* and *newline* parameters must not be provided.
*encoding*, *errors*, and *newline* parameters must not be provided.

@bskinn
Copy link
Contributor

bskinn commented May 12, 2025

@python/proofreaders

Are there any active members, out of curiosity? I do not know of any nor have seen any around.

🙋

I at least look at all pings to the group. Will usually weigh in if I have time, and as long as no one else has beaten me to what I'd have to say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review docs Documentation in the Doc dir needs backport to 3.14 bugs and security fixes skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

4 participants