Skip to content

Commit c6fee52

Browse files
committed
chore: use pyproject.toml and modern build system
Move configurations in pyproject.toml Use to hatchling and hatch-vcs for build backend
1 parent fd2cc21 commit c6fee52

File tree

10 files changed

+136
-130
lines changed

10 files changed

+136
-130
lines changed

.coveragerc

Lines changed: 0 additions & 20 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ adheres to [Semantic Versioning](https://semver.org/).
1616
### :house: Internal
1717

1818
- Fix test xz files generation for xz-utils 5.5.1+
19+
- Update license metadata as per [PEP 639](https://peps.python.org/pep-0639)
1920
- Freeze dev dependencies versions
21+
- Use `pyproject.toml` and modern build system
2022
- Update dev dependencies
2123
- Update GitHub actions dependencies
2224
- Add tests for PyPy 3.10 and 3.11

mypy.ini

Lines changed: 0 additions & 48 deletions
This file was deleted.

pyproject.toml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,132 @@
1+
[project]
2+
dynamic = ["version"]
3+
name = "python-xz"
4+
authors = [{ name = "Rogdham", email = "[email protected]" }]
5+
description = "Pure Python implementation of the XZ file format with random access support"
6+
readme = { file = "README.md", content-type = "text/markdown" }
7+
keywords = ["xz", "lzma", "compression", "decompression"]
8+
license = "MIT"
9+
license-files = ["LICENSE.txt"]
10+
classifiers = [
11+
"Development Status :: 3 - Alpha",
12+
"Operating System :: OS Independent",
13+
"Programming Language :: Python",
14+
"Programming Language :: Python :: 3",
15+
"Programming Language :: Python :: 3 :: Only",
16+
"Programming Language :: Python :: 3.9",
17+
"Programming Language :: Python :: 3.10",
18+
"Programming Language :: Python :: 3.11",
19+
"Topic :: Utilities",
20+
"Topic :: System :: Archiving",
21+
"Topic :: System :: Archiving :: Compression",
22+
]
23+
requires-python = ">=3.9"
24+
25+
[project.urls]
26+
Homepage = "https://github.com/rogdham/python-xz"
27+
Source = "https://github.com/rogdham/python-xz"
28+
29+
#
30+
# build
31+
#
32+
33+
[build-system]
34+
requires = ["hatchling", "hatch-vcs"]
35+
build-backend = "hatchling.build"
36+
37+
[tool.hatch.build.hooks.vcs]
38+
template = "__version__ = \"{version}\"\n"
39+
version-file = "src/xz/_version.py"
40+
41+
[tool.hatch.version]
42+
source = "vcs"
43+
44+
45+
#
46+
# coverage
47+
#
48+
49+
[tool.coverage.html]
50+
directory = "coverage"
51+
52+
[tool.coverage.paths]
53+
source = [
54+
"src/xz/",
55+
".tox/py*/lib/python*/site-packages/xz/",
56+
".tox/py*/site-packages/xz/",
57+
]
58+
59+
[tool.coverage.report]
60+
exclude_lines = [
61+
"pragma: no cover",
62+
"def __repr__",
63+
"def __str__",
64+
"if __name__ == \"__main__\":",
65+
"@overload",
66+
"if TYPE_CHECKING:",
67+
]
68+
show_missing = true
69+
70+
[tool.coverage.run]
71+
branch = true
72+
source = ["xz"]
73+
74+
#
75+
# mypy
76+
#
77+
78+
[tool.mypy]
79+
# Import discovery
80+
files = "src"
81+
ignore_missing_imports = false
82+
follow_imports = "normal"
83+
# Platform configuration
84+
python_version = "3.11"
85+
# Disallow dynamic typing
86+
disallow_any_unimported = true
87+
disallow_any_decorated = true
88+
disallow_any_generics = true
89+
disallow_subclassing_any = true
90+
# Untyped definitions and calls
91+
disallow_untyped_calls = true
92+
disallow_untyped_defs = true
93+
disallow_incomplete_defs = true
94+
check_untyped_defs = true
95+
disallow_untyped_decorators = true
96+
# None and Optional handling
97+
no_implicit_optional = true
98+
strict_optional = true
99+
# Configuring warning
100+
warn_redundant_casts = true
101+
warn_unused_ignores = true
102+
warn_no_return = true
103+
warn_return_any = true
104+
warn_unreachable = true
105+
# Suppressing errors
106+
ignore_errors = false
107+
# Miscellaneous strictness flags
108+
strict_equality = true
109+
# Configuring error messages
110+
show_error_context = true
111+
show_error_codes = true
112+
# Miscellaneous
113+
warn_unused_configs = true
114+
115+
116+
#
117+
# pytest
118+
#
119+
120+
[tool.pytest.ini_options]
121+
addopts = """
122+
--cov
123+
--strict-markers
124+
"""
125+
filterwarnings = ["error"]
126+
markers = ["generate_integration_files", "integration", "unit"]
127+
testpaths = ["tests"]
128+
129+
1130
#
2131
# ruff
3132
#

pytest.ini

Lines changed: 0 additions & 12 deletions
This file was deleted.

setup.cfg

Lines changed: 0 additions & 35 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/xz/open.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def xz_open(
8080
encoding: Optional[str] = None,
8181
errors: Optional[str] = None,
8282
newline: Optional[str] = None,
83-
) -> XZFile: ... # pragma: no cover
83+
) -> XZFile: ...
8484

8585

8686
@overload
@@ -97,7 +97,7 @@ def xz_open(
9797
encoding: Optional[str] = None,
9898
errors: Optional[str] = None,
9999
newline: Optional[str] = None,
100-
) -> _XZFileText: ... # pragma: no cover
100+
) -> _XZFileText: ...
101101

102102

103103
@overload
@@ -114,7 +114,7 @@ def xz_open(
114114
encoding: Optional[str] = None,
115115
errors: Optional[str] = None,
116116
newline: Optional[str] = None,
117-
) -> Union[XZFile, _XZFileText]: ... # pragma: no cover
117+
) -> Union[XZFile, _XZFileText]: ...
118118

119119

120120
def xz_open(

src/xz/strategy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import time
22
from typing import TYPE_CHECKING
33

4-
if TYPE_CHECKING: # pragma: no cover
4+
if TYPE_CHECKING:
55
# avoid circular dependency
66
from xz.block import XZBlock
77

src/xz/typing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
_LZMAFilenameType = Union[str, bytes, PathLike[str], PathLike[bytes], BinaryIO]
66

77

8-
if TYPE_CHECKING: # pragma: no cover
8+
if TYPE_CHECKING:
99
# avoid circular dependency
1010
from xz.block import XZBlock
1111

0 commit comments

Comments
 (0)