Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .coveragerc

This file was deleted.

2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
48 changes: 0 additions & 48 deletions mypy.ini

This file was deleted.

132 changes: 132 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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
#
Expand Down
12 changes: 0 additions & 12 deletions pytest.ini

This file was deleted.

35 changes: 0 additions & 35 deletions setup.cfg

This file was deleted.

10 changes: 0 additions & 10 deletions setup.py

This file was deleted.

6 changes: 3 additions & 3 deletions src/xz/open.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/xz/strategy.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/xz/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down