Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-113924: Add copy from zipfile without decompress/recompressing data#125718

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
sunrisesarsaparilla wants to merge16 commits intopython:main
base:main
Choose a base branch
Loading
fromsunrisesarsaparilla:zipfile/write/copy

Conversation

sunrisesarsaparilla
Copy link

@sunrisesarsaparillasunrisesarsaparilla commentedOct 19, 2024
edited
Loading

Addedzipfile.ZipFile.copy_files to allow copying from a zipfile without decompressing and recompressing the data.

The commits in this PR are structured to make reading the PR on a commit-by-commit basis straightforward.

Issue:#113924
Discussion:https://discuss.python.org/t/add-copy-between-zipfiles-without-recompressing-files/67544

@ghost
Copy link

ghost commentedOct 19, 2024
edited by ghost
Loading

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply theskip news label instead.

f"{caller_name}() requires mode 'w', 'x', or 'a', but "
f"mode is '{self.mode}'")

def _copy_file(self, source_zipfile, source_zinfo):
Copy link
Contributor

Choose a reason for hiding this comment

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

This is very strange. In fact, there is not much difference between these methods. What I want to say is that maybe they can be integrated (suggestion, you don't have to take it).

sunrisesarsaparilla reacted with thumbs up emoji
Copy link
Author

@sunrisesarsaparillasunrisesarsaparillaOct 20, 2024
edited
Loading

Choose a reason for hiding this comment

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

I've updated the PR with this alternative API design:

ZipFile.copy_from(source_zipfile, files=None)

Iffiles=None, then copy all files from thesource_zipfile
Iffiles is provided, then copy every file infiles

@@ -0,0 +1 @@
Added `zipfile.ZipFile.copy_files` to allow copying from a zipfile.
Copy link
Member

@merwokmerwokFeb 10, 2025
edited
Loading

Choose a reason for hiding this comment

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

A few things:

  1. This is reST, not markdown, so backticks should be used with a role: :meth:`zipfile.ZipFile.copy_files` – this is probably the CI failure of sphinx-lint (I guess, because the CI job does not show details!)
  2. This only works if the target exists: this is the CI failure for docs build
  3. The new method needs to be documented

@bedevere-app
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phraseI have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

mgorny added a commit to mgorny/variantlib that referenced this pull requestApr 17, 2025
Rather than unpacking the wheel into a temporary directory and thenrepacking it, use zipfile to stream the contents of the original wheelto the new wheel, altering the METADATA in the process.  This shouldbe more efficient, especially when dealing with large wheels.Ideally, we would copy other files without recompressing them at all,but unfortunately the zipfile module does not offer such a functionright now (seepython/cpython#125718).
mgorny added a commit to mgorny/variantlib that referenced this pull requestApr 17, 2025
Rather than unpacking the wheel into a temporary directory and thenrepacking it, use zipfile to stream the contents of the original wheelto the new wheel, altering the METADATA in the process.  This shouldbe more efficient, especially when dealing with large wheels.  It alsoremoves the dependency on `wheel` package.Ideally, we would copy other files without recompressing them at all,but unfortunately the zipfile module does not offer such a functionright now (seepython/cpython#125718).
DEKHTIARJonathan pushed a commit to wheelnext/variantlib that referenced this pull requestApr 17, 2025
* Use zipfile to copy files on-the-fly in make_variantRather than unpacking the wheel into a temporary directory and thenrepacking it, use zipfile to stream the contents of the original wheelto the new wheel, altering the METADATA in the process.  This shouldbe more efficient, especially when dealing with large wheels.  It alsoremoves the dependency on `wheel` package.Ideally, we would copy other files without recompressing them at all,but unfortunately the zipfile module does not offer such a functionright now (seepython/cpython#125718).* Update RECORD file
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@rruuaanngrruuaanngrruuaanng left review comments

@merwokmerwokmerwok requested changes

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@sunrisesarsaparilla@merwok@rruuaanng

[8]ページ先頭

©2009-2025 Movatter.jp