Skip to content
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

xopen should support filehandles #149

Closed
rhpvorderman opened this issue Feb 6, 2024 · 3 comments
Closed

xopen should support filehandles #149

rhpvorderman opened this issue Feb 6, 2024 · 3 comments

Comments

@rhpvorderman
Copy link
Collaborator

This is what gzip.open does for instance: https://github.com/python/cpython/blob/d7334e2c2012defaf7aae920d6a56689464509d1/Lib/gzip.py#L60

I also made sure the threaded libraries do this: https://github.com/pycompression/python-isal/blob/970c141a4976276c8254310474db1038d63000ce/src/isal/igzip_threaded.py#L78

PipedCompressionProgram can also do this for writing files. For reading files, it is not possible however.

In any case, for most of the backends, processing a filehandle rather than a file is possible. This will make it easier to chain xopen to other open methods. See: marcelm/cutadapt#761

@geertvandeweyer
Copy link
Contributor

see : #150

@rhpvorderman
Copy link
Collaborator Author

Fixed by #152. Thanks again for reporting! I am planning to release 2.0.0 as soon as I have the time. I also have a use case for this feature. However, it is not critical and I do not want to rush Marcel to see my latest PR. So I cannot provide an ETA.

@rhpvorderman
Copy link
Collaborator Author

2.0.0 is released! https://pypi.org/project/xopen/2.0.0/

Xopen now supports filehandles!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants