diff --git a/pyproject.toml b/pyproject.toml index 8e6e44f..9930065 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,9 @@ testing = [ "mypy", "lxml", # for mypy html coverage ] +zstd = [ + "zstandard", +] [build-system] diff --git a/src/kompress/__init__.py b/src/kompress/__init__.py index 296a098..cd2d665 100644 --- a/src/kompress/__init__.py +++ b/src/kompress/__init__.py @@ -43,10 +43,10 @@ def is_compressed(p: PathIsh) -> bool: def _zstd_open(path: Path, *args, **kwargs) -> IO: - import zstandard as zstd # type: ignore + import zstandard fh = path.open('rb') - dctx = zstd.ZstdDecompressor() + dctx = zstandard.ZstdDecompressor() reader = dctx.stream_reader(fh) mode = kwargs.get('mode', 'rt') diff --git a/tox.ini b/tox.ini index f71168c..5a7d990 100644 --- a/tox.ini +++ b/tox.ini @@ -38,7 +38,7 @@ commands = [testenv:mypy] commands = - {envpython} -m pip install --use-pep517 -e .[testing] + {envpython} -m pip install --use-pep517 -e .[testing,zstd] {envpython} -m mypy --install-types --non-interactive \ -p {[testenv]package_name} \ # txt report is a bit more convenient to view on CI