diff --git a/flake.nix b/flake.nix index c0cfcff..d86915f 100644 --- a/flake.nix +++ b/flake.nix @@ -110,7 +110,13 @@ maturin pdm cargo-msrv + cargo + rustc ]; + + shellHook = '' + ${pkgs.lib.getExe pkgs.patchelf} --set-interpreter ${pkgs.stdenv.cc.bintools.dynamicLinker} $(git rev-parse --show-toplevel)/.venv/bin/ruff + ''; }; } ); diff --git a/pdm.lock b/pdm.lock index 19ce977..d1f957e 100644 --- a/pdm.lock +++ b/pdm.lock @@ -4,11 +4,8 @@ [metadata] groups = ["default", "dev", "docs", "test"] strategy = ["cross_platform"] -lock_version = "4.5.0" -content_hash = "sha256:2a78b6c56fc8d0481d7ba145b06b59f497f5ccd70901bb10adcc24780c60a5e2" - -[[metadata.targets]] -requires_python = ">=3.8" +lock_version = "4.4.1" +content_hash = "sha256:8b7cc282c8c4801227b41b6b680c2c5b71c93c82fb6751cfe23c6241e5815a62" [[package]] name = "babel" @@ -24,46 +21,6 @@ files = [ {file = "Babel-2.13.1.tar.gz", hash = "sha256:33e0952d7dd6374af8dbf6768cc4ddf3ccfefc244f9986d4074704f2fbd18900"}, ] -[[package]] -name = "black" -version = "23.3.0" -requires_python = ">=3.7" -summary = "The uncompromising code formatter." -dependencies = [ - "click>=8.0.0", - "mypy-extensions>=0.4.3", - "packaging>=22.0", - "pathspec>=0.9.0", - "platformdirs>=2", - "tomli>=1.1.0; python_version < \"3.11\"", - "typed-ast>=1.4.2; python_version < \"3.8\" and implementation_name == \"cpython\"", - "typing-extensions>=3.10.0.0; python_version < \"3.10\"", -] -files = [ - {file = "black-23.3.0-cp310-cp310-macosx_10_16_arm64.whl", hash = "sha256:0945e13506be58bf7db93ee5853243eb368ace1c08a24c65ce108986eac65915"}, - {file = "black-23.3.0-cp310-cp310-macosx_10_16_universal2.whl", hash = "sha256:67de8d0c209eb5b330cce2469503de11bca4085880d62f1628bd9972cc3366b9"}, - {file = "black-23.3.0-cp310-cp310-macosx_10_16_x86_64.whl", hash = "sha256:7c3eb7cea23904399866c55826b31c1f55bbcd3890ce22ff70466b907b6775c2"}, - {file = "black-23.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:32daa9783106c28815d05b724238e30718f34155653d4d6e125dc7daec8e260c"}, - {file = "black-23.3.0-cp310-cp310-win_amd64.whl", hash = "sha256:35d1381d7a22cc5b2be2f72c7dfdae4072a3336060635718cc7e1ede24221d6c"}, - {file = "black-23.3.0-cp311-cp311-macosx_10_16_arm64.whl", hash = "sha256:a8a968125d0a6a404842fa1bf0b349a568634f856aa08ffaff40ae0dfa52e7c6"}, - {file = "black-23.3.0-cp311-cp311-macosx_10_16_universal2.whl", hash = "sha256:c7ab5790333c448903c4b721b59c0d80b11fe5e9803d8703e84dcb8da56fec1b"}, - {file = "black-23.3.0-cp311-cp311-macosx_10_16_x86_64.whl", hash = "sha256:a6f6886c9869d4daae2d1715ce34a19bbc4b95006d20ed785ca00fa03cba312d"}, - {file = "black-23.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6f3c333ea1dd6771b2d3777482429864f8e258899f6ff05826c3a4fcc5ce3f70"}, - {file = "black-23.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:11c410f71b876f961d1de77b9699ad19f939094c3a677323f43d7a29855fe326"}, - {file = "black-23.3.0-cp38-cp38-macosx_10_16_arm64.whl", hash = "sha256:48f9d345675bb7fbc3dd85821b12487e1b9a75242028adad0333ce36ed2a6d27"}, - {file = "black-23.3.0-cp38-cp38-macosx_10_16_universal2.whl", hash = "sha256:714290490c18fb0126baa0fca0a54ee795f7502b44177e1ce7624ba1c00f2331"}, - {file = "black-23.3.0-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:064101748afa12ad2291c2b91c960be28b817c0c7eaa35bec09cc63aa56493c5"}, - {file = "black-23.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:562bd3a70495facf56814293149e51aa1be9931567474993c7942ff7d3533961"}, - {file = "black-23.3.0-cp38-cp38-win_amd64.whl", hash = "sha256:e198cf27888ad6f4ff331ca1c48ffc038848ea9f031a3b40ba36aced7e22f2c8"}, - {file = "black-23.3.0-cp39-cp39-macosx_10_16_arm64.whl", hash = "sha256:3238f2aacf827d18d26db07524e44741233ae09a584273aa059066d644ca7b30"}, - {file = "black-23.3.0-cp39-cp39-macosx_10_16_universal2.whl", hash = "sha256:f0bd2f4a58d6666500542b26354978218a9babcdc972722f4bf90779524515f3"}, - {file = "black-23.3.0-cp39-cp39-macosx_10_16_x86_64.whl", hash = "sha256:92c543f6854c28a3c7f39f4d9b7694f9a6eb9d3c5e2ece488c327b6e7ea9b266"}, - {file = "black-23.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3a150542a204124ed00683f0db1f5cf1c2aaaa9cc3495b7a3b5976fb136090ab"}, - {file = "black-23.3.0-cp39-cp39-win_amd64.whl", hash = "sha256:6b39abdfb402002b8a7d030ccc85cf5afff64ee90fa4c5aebc531e3ad0175ddb"}, - {file = "black-23.3.0-py3-none-any.whl", hash = "sha256:ec751418022185b0c1bb7d7736e6933d40bbb14c14a0abcf9123d1b159f98dd4"}, - {file = "black-23.3.0.tar.gz", hash = "sha256:1c7b8d606e728a41ea1ccbd7264677e494e87cf630e399262ced92d4a8dac940"}, -] - [[package]] name = "certifi" version = "2023.5.7" @@ -164,7 +121,6 @@ requires_python = ">=3.7" summary = "Composable command line interface toolkit" dependencies = [ "colorama; platform_system == \"Windows\"", - "importlib-metadata; python_version < \"3.8\"", ] files = [ {file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"}, @@ -209,7 +165,6 @@ version = "0.29.0" requires_python = ">=3.7" summary = "Signatures for entire Python programs. Extract the structure, the frame, the skeleton of your project, to generate API documentation or find breaking changes in your API." dependencies = [ - "cached-property; python_version < \"3.8\"", "colorama>=0.4", ] files = [ @@ -233,7 +188,6 @@ version = "8.5.0" requires_python = ">=3.8" summary = "Read metadata from Python packages" dependencies = [ - "typing-extensions>=3.6.4; python_version < \"3.8\"", "zipp>=3.20", ] files = [ @@ -582,9 +536,6 @@ name = "platformdirs" version = "3.5.1" requires_python = ">=3.7" summary = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." -dependencies = [ - "typing-extensions>=4.5; python_version < \"3.8\"", -] files = [ {file = "platformdirs-3.5.1-py3-none-any.whl", hash = "sha256:e2378146f1964972c03c085bb5662ae80b2b8c06226c54b2ff4aa9483e8a13a5"}, {file = "platformdirs-3.5.1.tar.gz", hash = "sha256:412dae91f52a6f84830f39a8078cecd0e866cb72294a5c66808e74d5e88d251f"}, diff --git a/pyproject.toml b/pyproject.toml index 1b29730..63d56c3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,12 +64,14 @@ venv = "pdm sync -d" mypy = "mypy ." pytest = "python -m pytest tests" clippy = "cargo clippy --all-targets -- --deny warnings" +cargofmt = "cargo fmt" +ruff-format = "ruff format" +ruff-check = "ruff check" test = "cargo test" -all = { composite = ["clippy", "test", "venv", "mypy", "pytest"] } +all = { composite = ["clippy", "cargofmt", "test", "venv", "ruff-check", "ruff-format", "mypy", "pytest"] } [tool.pdm.dev-dependencies] dev = [ - "black ~= 23.3.0", "ruff ~=0.7.4", "mypy ~= 1.2", "towncrier ~=24.8.0", @@ -83,7 +85,7 @@ docs = [ "mkdocs-material>=9.1.14", ] -[tool.ruff] +[tool.ruff.lint] select = [ "A", # flake8-builtins "ARG", # flake8-unused-arguments @@ -97,7 +99,6 @@ select = [ "FBT", # flake8-boolean-trap "G", # flake8-logging-format "I", # isort - "ISC", # flake8-implicit-str-concats "N", # pep8-naming "PIE", # flake8-pie "PYI", # flake8-pyi @@ -127,19 +128,19 @@ ignore = [ "UP007", # non-pep604-annotation: For Python 3.8 compatibility ] -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "tests/*" = [ "S101", # assert: Enable usage of asserts "D1", # undocumented-* ] -[tool.ruff.pydocstyle] +[tool.ruff.lint.pydocstyle] convention = "google" -[tool.ruff.isort] +[tool.ruff.lint.isort] known-first-party = ["lzallright"] -[tool.ruff.flake8-pytest-style] +[tool.ruff.lint.flake8-pytest-style] fixture-parentheses = false mark-parentheses = false parametrize-names-type = "csv" diff --git a/python/lzallright/_lzallright.pyi b/python/lzallright/_lzallright.pyi index 18fd851..80b6ee0 100644 --- a/python/lzallright/_lzallright.pyi +++ b/python/lzallright/_lzallright.pyi @@ -2,7 +2,11 @@ from array import array from mmap import mmap from typing import Optional, Tuple, Union -_BufferType = Union[array[int], bytes, bytearray, memoryview, mmap] +import typing_extensions + +_BufferType: typing_extensions.TypeAlias = Union[ + array[int], bytes, bytearray, memoryview, mmap +] class LZOCompressor: """Object containing the compressor state. @@ -69,7 +73,7 @@ class LZOError(Exception): class InputNotConsumed(LZOError): # noqa: N818 """Decompression finished with leftover data.""" - args: Tuple[EResult, bytes] + args: Tuple[EResult, bytes] # type: ignore[assignment] """Error reason, with decompressed data ``(EResult.InputNotConsumed, decompressed: bytes)``