Skip to content

gh-132983: Style improvements for compression.zstd #133547

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

Merged
merged 10 commits into from
May 14, 2025

Conversation

emmatyping
Copy link
Member

@emmatyping emmatyping commented May 7, 2025

Mostly just make both files consistently use single vs double quotes and add spacing as suggested in PEP 8.

  • consistently uses single vs double quotes per PEP 8
  • makes spacing consistent per PEP 8
  • adds a missing space in a multi-line string
  • Moves compression packages that don't have multiple files to modules
  • Adds a missing trailing comma in tarfile

Mostly just make both files consistently use single vs double quotes.
Also add a missing space in a multi-line string.
pythonGH-133479 removed the logic to check for libzstd outside of pkg-config.
This commit adds that logic back with a check for the version so that
users can provide their own libzstd. This is to bring parity with lzma,
bz2, and zlib detection.
@emmatyping emmatyping requested review from AA-Turner and gpshead May 7, 2025 03:23
Copy link
Contributor

@Rogdham Rogdham left a comment

Choose a reason for hiding this comment

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

I am confirming you did not miss any ', except maybe in the docstring of ZstdFile.readline which mentions b''

@emmatyping
Copy link
Member Author

I am confirming you did not miss any ', except maybe in the docstring of ZstdFile.readline which mentions b''

Yeah I left that one intentionally as docs seem to use b'' when talking about empty bytes objects.

@emmatyping
Copy link
Member Author

@AA-Turner @gpshead pinging just to follow up on the request for review on this one.

@merwok
Copy link
Member

merwok commented May 13, 2025

I would argue that the (C)Python house style is to use single quotes, as that matches the output of repr and thus the REPL.

Formatters like black took position for double quotes for various reasons (I think arguing that it’s more common to have apostrophes inside the quotes, and something about qwerty layout), but that’s not universally liked.

So this change could be done (the files already have a non-small git history!), or not done.

@merwok
Copy link
Member

merwok commented May 13, 2025

Bringing here a suggestion from a closed PR: avoid unnecessary packages for the re-exported compression sub-modules (rename Lib/compression/bzip2/__init__.pyLib/compression/bzip2.py)

@emmatyping emmatyping requested a review from ethanfurman as a code owner May 13, 2025 23:52
@emmatyping emmatyping removed the request for review from ethanfurman May 13, 2025 23:53
@emmatyping
Copy link
Member Author

Moved the modules and changed to single quotes! I also added a trailing comma that @merwok noted in an already-merged PR. I also updated the PR description to cover these points.

@emmatyping emmatyping requested a review from merwok May 14, 2025 00:21
@AA-Turner AA-Turner added the needs backport to 3.14 bugs and security fixes label May 14, 2025
@AA-Turner AA-Turner enabled auto-merge (squash) May 14, 2025 10:53
@AA-Turner AA-Turner merged commit b44c824 into python:main May 14, 2025
44 checks passed
@miss-islington-app
Copy link

Thanks @emmatyping for the PR, and @AA-Turner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 14, 2025
…133547)

(cherry picked from commit b44c824)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented May 14, 2025

GH-134001 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label May 14, 2025
AA-Turner added a commit that referenced this pull request May 14, 2025
… (#134001)

gh-132983: Style improvements for `compression.zstd` (GH-133547)
(cherry picked from commit b44c824)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants