Skip to content

Conversation

insomniacslk
Copy link

@insomniacslk insomniacslk commented Jul 16, 2017

Exposed interface to specify a custom compressor for tarfile.
To achieve this, a new compression type, "custom", and a new keyword argument compressor have been added. The compressor has to be a callable with the interface as explained below.

This change just exposes the internal interface. Ideally the interface should be simpler, and just require an input and an output streams to compress/decompress and some modifiers. Additionally the classmethod is not necessary and any callable with the below interface should work. This could be done iteratively in a subsequent commit.

The compressor has to be a class method that takes as input cls, name, mode, fileobj, compresslevel and **kwargs. This is exactly the same interface as the open methods referenced by OPEN_METH in tarfile.py, e.g. TarFile.gzipopen or TarFile.bz2open.

The stream interface via the internal _Stream class is not exposed. As a consequence it is not possible to specify a compressor that uses such interface.

https://bugs.python.org/issue31020

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

@insomniacslk
Copy link
Author

Update my account on BPO to include my github handle, should be ok now

@insomniacslk insomniacslk changed the title Added support for custom compressor in tarfile Add support for custom compressor in tarfile Jul 16, 2017
@insomniacslk
Copy link
Author

Any chance this could get a look?

@Mariatta
Copy link
Member

Thanks for the PR. The changes proposed aren't considered trivial, and requires an issue to be created in https://bugs.python.org

Can you first create the issue? Thanks.

@insomniacslk
Copy link
Author

Sure! Just created http://bugs.python.org/issue31020

@insomniacslk insomniacslk changed the title Add support for custom compressor in tarfile bpo-31020: Add support for custom compressor in tarfile Jul 24, 2017
@insomniacslk
Copy link
Author

What are the next steps here? I created the bug on BPO, not sure if now it's just matter of waiting until someone looks at the issue or if there's something to be done on my side. Thanks!

@csabella csabella removed the request for review from gustaebel May 27, 2020 11:40
@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Feb 20, 2022
@github-actions github-actions bot removed the stale Stale PR or inactive for long period of time. label Jul 29, 2022
@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Aug 29, 2022
@encukou
Copy link
Member

encukou commented Dec 19, 2024

To use a custom compressor, pass a file-like object like LZMAFile as fileobj.
Adding dedicated support, as in this PR, would complicate the API and test matrix too much.
See the issue for discussion.

Sorry for the delay in responding. Hopefully, it's better late than never.

@encukou encukou closed this Dec 19, 2024
@picnixz picnixz changed the title bpo-31020: Add support for custom compressor in tarfile gh-75203: Add support for custom compressor in tarfile Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review stale Stale PR or inactive for long period of time.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants