Skip to content

Commit c0499e9

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 c0499e9

File tree

10 files changed

+139
-130
lines changed

10 files changed

+139
-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: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,135 @@
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.build.targets.wheel]
42+
packages = ["src/xz"]
43+
44+
[tool.hatch.version]
45+
source = "vcs"
46+
47+
48+
#
49+
# coverage
50+
#
51+
52+
[tool.coverage.html]
53+
directory = "coverage"
54+
55+
[tool.coverage.paths]
56+
source = [
57+
"src/xz/",
58+
".tox/py*/lib/python*/site-packages/xz/",
59+
".tox/py*/site-packages/xz/",
60+
]
61+
62+
[tool.coverage.report]
63+
exclude_lines = [
64+
"pragma: no cover",
65+
"def __repr__",
66+
"def __str__",
67+
"if __name__ == \"__main__\":",
68+
"@overload",
69+
"if TYPE_CHECKING:",
70+
]
71+
show_missing = true
72+
73+
[tool.coverage.run]
74+
branch = true
75+
source = ["xz"]
76+
77+
#
78+
# mypy
79+
#
80+
81+
[tool.mypy]
82+
# Import discovery
83+
files = "src"
84+
ignore_missing_imports = false
85+
follow_imports = "normal"
86+
# Platform configuration
87+
python_version = "3.11"
88+
# Disallow dynamic typing
89+
disallow_any_unimported = true
90+
disallow_any_decorated = true
91+
disallow_any_generics = true
92+
disallow_subclassing_any = true
93+
# Untyped definitions and calls
94+
disallow_untyped_calls = true
95+
disallow_untyped_defs = true
96+
disallow_incomplete_defs = true
97+
check_untyped_defs = true
98+
disallow_untyped_decorators = true
99+
# None and Optional handling
100+
no_implicit_optional = true
101+
strict_optional = true
102+
# Configuring warning
103+
warn_redundant_casts = true
104+
warn_unused_ignores = true
105+
warn_no_return = true
106+
warn_return_any = true
107+
warn_unreachable = true
108+
# Suppressing errors
109+
ignore_errors = false
110+
# Miscellaneous strictness flags
111+
strict_equality = true
112+
# Configuring error messages
113+
show_error_context = true
114+
show_error_codes = true
115+
# Miscellaneous
116+
warn_unused_configs = true
117+
118+
119+
#
120+
# pytest
121+
#
122+
123+
[tool.pytest.ini_options]
124+
addopts = """
125+
--cov
126+
--strict-markers
127+
"""
128+
filterwarnings = ["error"]
129+
markers = ["generate_integration_files", "integration", "unit"]
130+
testpaths = ["tests"]
131+
132+
1133
#
2134
# ruff
3135
#

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)