Skip to content

Commit d3992d9

Browse files
committed
resolve comments from PR
1 parent 9376298 commit d3992d9

5 files changed

Lines changed: 13 additions & 42 deletions

File tree

.gitignore

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,3 @@ __pycache__/
55
.tox
66
venv/
77
src/xopen/_version.py
8-
settings.json
9-
.coverage
10-
coverage.xml
11-
.vscode/*
12-
.DS_Store
13-
build/*
14-
dist/*

README.rst

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Supported compression formats are:
2626
- gzip (``.gz``)
2727
- bzip2 (``.bz2``)
2828
- xz (``.xz``)
29+
- lz4 (``.lz4``)
2930
- Zstandard (``.zst``) (optional)
30-
- lz4 (``.lz4``) (optional)
3131

3232
``xopen`` is compatible with Python versions 3.8 and later.
3333

@@ -141,6 +141,9 @@ built-in support for multithreaded compression.
141141

142142
For bz2 files, `pbzip2 (parallel bzip2) <http://compression.great-site.net/pbzip2/>`_ is used.
143143

144+
For lz4 files, [python lz4](https://python-lz4.readthedocs.io/en/stable/index.html)
145+
package is used.
146+
144147
``xopen`` falls back to Python’s built-in functions
145148
(``gzip.open``, ``lzma.open``, ``bz2.open``)
146149
if none of the other methods can be used.
@@ -181,20 +184,6 @@ program or the Python ``zstandard`` package needs to be installed.
181184
To ensure that you get the correct ``zstandard`` version, you can specify the ``zstd`` extra for
182185
``xopen``, that is, install it using ``pip install xopen[zstd]``.
183186

184-
Optional lz4 support
185-
--------------------------
186-
187-
For reading and writing lz4 (``.lz4``) files, either the ``lz4`` command-line
188-
program or the Python ``lz4`` package needs to be installed.
189-
190-
* If the ``threads`` parameter to ``xopen()`` is ``None`` (the default) or any value greater than 0,
191-
``xopen`` uses an external ``lz4`` process.
192-
* If the above fails (because no ``lz4`` program is available) or if ``threads`` is 0,
193-
the ``lz4`` package is used.
194-
195-
To ensure that ``lz4`` is installed, you can specify the ``lz4`` extra for
196-
``xopen``, that is, install it using ``pip install xopen[lz4]``.
197-
198187

199188
Changelog
200189
---------

pyproject.toml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,30 @@ build-backend = "setuptools.build_meta"
55
[project]
66
name = "xopen"
77
authors = [
8-
{ name = "Marcel Martin", email = "marcel.martin@scilifelab.se" },
9-
{ name = "Ruben Vorderman", email = "r.h.p.vorderman@lumc.nl" },
8+
{name = "Marcel Martin", email = "marcel.martin@scilifelab.se"},
9+
{name = "Ruben Vorderman", email = "r.h.p.vorderman@lumc.nl"}
1010
]
1111
description = "Open compressed files transparently"
1212
readme = "README.rst"
13-
license = { text = "MIT" }
13+
license = {text = "MIT"}
1414
classifiers = [
1515
"Development Status :: 5 - Production/Stable",
1616
"License :: OSI Approved :: MIT License",
17-
"Programming Language :: Python :: 3",
17+
"Programming Language :: Python :: 3"
1818
]
1919
requires-python = ">=3.8"
2020
dynamic = ["version"]
2121
dependencies = [
2222
'isal>=1.6.1; platform.machine == "x86_64" or platform.machine == "AMD64" or platform.machine == "aarch64"',
2323
'zlib-ng>=0.4.1; platform.machine == "x86_64" or platform.machine == "AMD64" or platform.machine == "aarch64"',
24-
'lz4>=4.3.3',
24+
'lz4>4.3.1'
2525
]
2626

2727
[project.urls]
2828
homepage = "https://github.com/pycompression/xopen/"
2929

3030
[project.optional-dependencies]
31-
dev = [
32-
"pytest",
33-
"pytest-timeout",
34-
"tox",
35-
"black",
36-
"flake8",
37-
"mypy",
38-
"twine",
39-
"setuptools_scm[toml]",
40-
]
31+
dev = ["pytest"]
4132
zstd = ["zstandard<1"]
4233

4334
[tool.setuptools_scm]

src/xopen/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class _ProgramSettings:
126126
"zstd": _ProgramSettings(("zstd",), tuple(range(1, 20)), "-T"),
127127
"pigz": _ProgramSettings(("pigz", "--no-name"), tuple(range(0, 10)) + (11,), "-p"),
128128
"gzip": _ProgramSettings(("gzip", "--no-name"), tuple(range(1, 10))),
129-
"lz4": _ProgramSettings(("lz4",), tuple(range(0, 17)), "-T"),
129+
"lz4": _ProgramSettings(("lz4",), tuple(range(0, 17))),
130130
}
131131

132132

@@ -850,7 +850,7 @@ def xopen( # noqa: C901
850850
compresslevel is the compression level for writing to gzip, xz and zst files.
851851
This parameter is ignored for the other compression formats.
852852
If set to None, a default depending on the format is used:
853-
gzip: 6, xz: 6, zstd: 3, lz4: 1.
853+
gzip: 6, xz: 6, zstd: 3, lz4: 0.
854854
855855
When threads is None (the default), compressed file formats are read or written
856856
using a pipe to a subprocess running an external tool such as,

tests/test_xopen.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@
2828
TEST_DIR = Path(__file__).parent
2929
CONTENT_LINES = ["Testing, testing ...\n", "The second line.\n"]
3030
CONTENT = "".join(CONTENT_LINES)
31-
extensions = ["", ".gz", ".bz2", ".xz"]
31+
extensions = ["", ".gz", ".bz2", ".xz", ".lz4"]
3232
if shutil.which("zstd") or zstandard:
3333
extensions += [".zst"]
34-
if shutil.which("lz4") or lz4:
35-
extensions += [".lz4"]
3634
base = os.path.join(os.path.dirname(__file__), "file.txt")
3735
files = [base + ext for ext in extensions]
3836

0 commit comments

Comments
 (0)