Skip to content

Add optional LZ4 frame support (refresh #168) - #181

Open
Dev-iL wants to merge 2 commits into
pycompression:mainfrom
Dev-iL:lz4-pr168-refresh
Open

Dev-iL wants to merge 2 commits into
pycompression:mainfrom
Dev-iL:lz4-pr168-refresh

Conversation

@Dev-iL

@Dev-iL Dev-iL commented Sep 23, 2026 •

Copy link
Copy Markdown

Summary

Refreshes the LZ4 work from #168 on current main (0818f20).

  • Adds standard LZ4 frame reading and writing, including .lz4 extension and frame-header detection.
  • Keeps Python LZ4 optional via pip install xopen[lz4], with the lz4 program as a fallback when subprocesses are allowed. PyPy uses the CLI.
  • Avoids passing -T to older LZ4 binaries, adds a frame fixture and CLI/binding CI coverage, and makes Ruff's existing basic rule set explicit for newer Ruff releases.

The original work was done by @gnzsnz, with contributions from @marcelm and others in #168. The commit preserves contributor credit.

AI Disclosure

Codex (GPT-6-Sol) was used to author this PR.

Refresh the LZ4 work from pycompression#168 against current main.

Co-authored-by: gonzo <gonzalosaenz@gmail.com>

Co-authored-by: Marcel Martin <marcel.martin@scilifelab.se>
@Dev-iL

Dev-iL commented Sep 27, 2026

Copy link
Copy Markdown
Author

@marcelm @rhpvorderman Can you take a look please?

@rhpvorderman rhpvorderman left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There are some obvious issues with the compression level ranges. I found this because I wondered if lz4 supported a "0" mode (uncompressed data), like zlib does. It turns out it is not even in the range.

EDIT: Removal of false assumptions.

Comment thread src/xopen/__init__.py Outdated
Comment thread src/xopen/__init__.py Outdated
@Dev-iL
Dev-iL requested a review from rhpvorderman September 28, 2026 11:00
@rhpvorderman

Copy link
Copy Markdown
Collaborator

I apologize for my previous comment about the AI code being unchecked. That was based on false assumptions and I should have been more wise than to make these.

@rhpvorderman rhpvorderman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me. @marcelm any thoughts?

@Dev-iL Dev-iL closed this Sep 29, 2026
@Dev-iL Dev-iL reopened this Sep 29, 2026
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

Successfully merging this pull request may close these issues.

2 participants