diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index cea27e1..0000000 --- a/.coveragerc +++ /dev/null @@ -1,20 +0,0 @@ -[html] -directory = coverage - -[paths] -source = - src/xz/ - .tox/py*/lib/python*/site-packages/xz/ - .tox/py*/site-packages/xz/ - -[report] -exclude_lines = - pragma: no cover - def __repr__ - def __str__ - if __name__ == "__main__": -show_missing = True - -[run] -branch = True -source = xz diff --git a/CHANGELOG.md b/CHANGELOG.md index f4497ed..a4e58c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,9 @@ adheres to [Semantic Versioning](https://semver.org/). ### :house: Internal - Fix test xz files generation for xz-utils 5.5.1+ +- Update license metadata as per [PEP 639](https://peps.python.org/pep-0639) - Freeze dev dependencies versions +- Use `pyproject.toml` and modern build system - Update dev dependencies - Update GitHub actions dependencies - Add tests for PyPy 3.10 and 3.11 diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index cd48e59..0000000 --- a/mypy.ini +++ /dev/null @@ -1,48 +0,0 @@ -[mypy] -# section names refer to the documentation -# https://mypy.readthedocs.io/en/stable/config_file.html - -# Import discovery -files = src -ignore_missing_imports = False -follow_imports = normal - -# Platform configuration -python_version = 3.11 - -# Disallow dynamic typing -disallow_any_unimported = True -disallow_any_decorated = True -disallow_any_generics = True -disallow_subclassing_any = True - -# Untyped definitions and calls -disallow_untyped_calls = True -disallow_untyped_defs = True -disallow_incomplete_defs = True -check_untyped_defs = True -disallow_untyped_decorators = True - -# None and Optional handling -no_implicit_optional = True -strict_optional = True - -# Configuring warning -warn_redundant_casts = True -warn_unused_ignores = True -warn_no_return = True -warn_return_any = True -warn_unreachable = True - -# Suppressing errors -ignore_errors = False - -# Miscellaneous strictness flags -strict_equality = True - -# Configuring error messages -show_error_context = True -show_error_codes = True - -# Miscellaneous -warn_unused_configs = True diff --git a/pyproject.toml b/pyproject.toml index 32118f4..7decf25 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,135 @@ +[project] +dynamic = ["version"] +name = "python-xz" +authors = [{ name = "Rogdham", email = "contact@rogdham.net" }] +description = "Pure Python implementation of the XZ file format with random access support" +readme = { file = "README.md", content-type = "text/markdown" } +keywords = ["xz", "lzma", "compression", "decompression"] +license = "MIT" +license-files = ["LICENSE.txt"] +classifiers = [ + "Development Status :: 3 - Alpha", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Utilities", + "Topic :: System :: Archiving", + "Topic :: System :: Archiving :: Compression", +] +requires-python = ">=3.9" + +[project.urls] +Homepage = "https://github.com/rogdham/python-xz" +Source = "https://github.com/rogdham/python-xz" + +# +# build +# + +[build-system] +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" + +[tool.hatch.build.hooks.vcs] +template = "__version__ = \"{version}\"\n" +version-file = "src/xz/_version.py" + +[tool.hatch.build.targets.wheel] +packages = ["src/xz"] + +[tool.hatch.version] +source = "vcs" + + +# +# coverage +# + +[tool.coverage.html] +directory = "coverage" + +[tool.coverage.paths] +source = [ + "src/xz/", + ".tox/py*/lib/python*/site-packages/xz/", + ".tox/py*/site-packages/xz/", +] + +[tool.coverage.report] +exclude_lines = [ + "pragma: no cover", + "def __repr__", + "def __str__", + "if __name__ == \"__main__\":", + "@overload", + "if TYPE_CHECKING:", +] +show_missing = true + +[tool.coverage.run] +branch = true +source = ["xz"] + +# +# mypy +# + +[tool.mypy] +# Import discovery +files = "src" +ignore_missing_imports = false +follow_imports = "normal" +# Platform configuration +python_version = "3.11" +# Disallow dynamic typing +disallow_any_unimported = true +disallow_any_decorated = true +disallow_any_generics = true +disallow_subclassing_any = true +# Untyped definitions and calls +disallow_untyped_calls = true +disallow_untyped_defs = true +disallow_incomplete_defs = true +check_untyped_defs = true +disallow_untyped_decorators = true +# None and Optional handling +no_implicit_optional = true +strict_optional = true +# Configuring warning +warn_redundant_casts = true +warn_unused_ignores = true +warn_no_return = true +warn_return_any = true +warn_unreachable = true +# Suppressing errors +ignore_errors = false +# Miscellaneous strictness flags +strict_equality = true +# Configuring error messages +show_error_context = true +show_error_codes = true +# Miscellaneous +warn_unused_configs = true + + +# +# pytest +# + +[tool.pytest.ini_options] +addopts = """ + --cov + --strict-markers + """ +filterwarnings = ["error"] +markers = ["generate_integration_files", "integration", "unit"] +testpaths = ["tests"] + + # # ruff # diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 89e354b..0000000 --- a/pytest.ini +++ /dev/null @@ -1,12 +0,0 @@ -[pytest] -addopts = - --cov - --strict-markers -filterwarnings = - error -markers = - generate_integration_files - integration - unit -testpaths = - tests diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index f04061b..0000000 --- a/setup.cfg +++ /dev/null @@ -1,35 +0,0 @@ -[metadata] -name = python-xz -author = Rogdham -author_email = contact@rogdham.net -description = Pure Python implementation of the XZ file format with random access support -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/rogdham/python-xz -project_urls = - Source = https://github.com/rogdham/python-xz -keywords = xz lzma compression decompression -license = MIT -license_files = LICENSE.txt -platform = any -classifiers = - Development Status :: 3 - Alpha - License :: OSI Approved :: MIT License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Topic :: Utilities - Topic :: System :: Archiving - Topic :: System :: Archiving :: Compression - -[options] -include_package_data = True -package_dir = =src -packages = xz -python_requires = >=3.9 -setup_requires = - setuptools_scm==9.2.0 diff --git a/setup.py b/setup.py deleted file mode 100755 index e5cd3e9..0000000 --- a/setup.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python - -from setuptools import setup - -setup( - use_scm_version={ - "write_to": "src/xz/_version.py", - "write_to_template": '__version__ = "{version}"\n', - } -) diff --git a/src/xz/open.py b/src/xz/open.py index 6f52040..1608a14 100644 --- a/src/xz/open.py +++ b/src/xz/open.py @@ -80,7 +80,7 @@ def xz_open( encoding: Optional[str] = None, errors: Optional[str] = None, newline: Optional[str] = None, -) -> XZFile: ... # pragma: no cover +) -> XZFile: ... @overload @@ -97,7 +97,7 @@ def xz_open( encoding: Optional[str] = None, errors: Optional[str] = None, newline: Optional[str] = None, -) -> _XZFileText: ... # pragma: no cover +) -> _XZFileText: ... @overload @@ -114,7 +114,7 @@ def xz_open( encoding: Optional[str] = None, errors: Optional[str] = None, newline: Optional[str] = None, -) -> Union[XZFile, _XZFileText]: ... # pragma: no cover +) -> Union[XZFile, _XZFileText]: ... def xz_open( diff --git a/src/xz/strategy.py b/src/xz/strategy.py index 1479a5a..49115ea 100644 --- a/src/xz/strategy.py +++ b/src/xz/strategy.py @@ -1,7 +1,7 @@ import time from typing import TYPE_CHECKING -if TYPE_CHECKING: # pragma: no cover +if TYPE_CHECKING: # avoid circular dependency from xz.block import XZBlock diff --git a/src/xz/typing.py b/src/xz/typing.py index a8fdeee..5d1c722 100644 --- a/src/xz/typing.py +++ b/src/xz/typing.py @@ -5,7 +5,7 @@ _LZMAFilenameType = Union[str, bytes, PathLike[str], PathLike[bytes], BinaryIO] -if TYPE_CHECKING: # pragma: no cover +if TYPE_CHECKING: # avoid circular dependency from xz.block import XZBlock