forked from mloesch/sickle
-
Notifications
You must be signed in to change notification settings - Fork 2
/
pyproject.toml
248 lines (229 loc) · 7.05 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# hatch
# Ref: https://hatch.pypa.io/latest/config/metadata/
# ------------------------------------------------------------------------------
[build-system]
build-backend = "hatchling.build"
requires = [
"hatchling",
]
[project]
name = "oaipmh-scythe"
description = "A Scythe for harvesting OAI-PMH repositories."
readme = "README.md"
keywords = [
"metadata",
"oai-pmh",
"oai-pmh-client",
]
license = { text = "BSD-3-Clause" }
authors = [
{ name = "Heinz-Alexander Fütterer" },
]
requires-python = ">=3.10"
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Text Processing :: Markup :: XML",
"Typing :: Typed",
]
dynamic = [
"version",
]
dependencies = [
"httpx>=0.27",
"lxml>=5.3",
]
optional-dependencies.dev = [
"pre-commit~=4.0",
]
optional-dependencies.docs = [
"mike~=2.1",
"mkdocs~=1.6",
"mkdocs-include-markdown-plugin~=7.0",
"mkdocs-material~=9.5",
"mkdocs-minify-plugin~=0.7",
"mkdocstrings[python]~=0.25",
]
optional-dependencies.test = [
"pytest~=8.2",
"pytest-cov~=6.0",
"pytest-mock~=3.14",
"pytest-randomly~=3.15",
"pytest-recording~=0.13",
"pytest-xdist~=3.6",
"respx~=0.21",
]
urls.Changelog = "https://github.com/afuetterer/oaipmh-scythe/blob/main/CHANGELOG.md"
urls.Documentation = "https://afuetterer.github.io/oaipmh-scythe"
urls.Issues = "https://github.com/afuetterer/oaipmh-scythe/issues"
urls.Repository = "https://github.com/afuetterer/oaipmh-scythe.git"
[tool.hatch.build.targets.sdist]
include = [
"src",
"CHANGELOG.md",
]
[tool.hatch.build.targets.wheel]
only-packages = true
packages = [ "src/oaipmh_scythe" ]
[tool.hatch.version]
path = "src/oaipmh_scythe/__about__.py"
[tool.hatch.env]
requires = [
"hatch-pip-compile",
]
[tool.hatch.envs.default]
installer = "uv"
features = [ "dev", "test" ]
post-install-commands = [ "pre-commit install" ]
[tool.hatch.envs.default.scripts]
check = [ "lint", "typecheck" ]
lint = "SKIP=mypy pre-commit run --all-files --color=always --show-diff-on-failure"
typecheck = "pre-commit run --all-files --color=always --show-diff-on-failure mypy"
test = "pytest {args:tests}"
cov = "pytest --cov {args:src}"
cov-report-markdown = "python -m coverage report --format=markdown {args:>coverage.md}"
cov-total = """
python -m coverage json --quiet
python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])"
"""
[tool.hatch.envs.ci]
dependencies = [
"build[uv]",
"hatch",
"pip",
]
detached = true # ignore the project installation itself
type = "pip-compile"
pip-compile-hashes = true
pip-compile-installer = "uv"
pip-compile-resolver = "uv"
lock-filename = "requirements/{env_name}" # no .txt suffix, otherwise Dependabot will update this file as well
[tool.hatch.envs.docs]
features = [ "docs" ]
template = "docs"
type = "pip-compile"
pip-compile-hashes = true
pip-compile-installer = "uv"
pip-compile-resolver = "uv"
lock-filename = "requirements/{env_name}" # no .txt suffix, otherwise Dependabot will update this file as well
[tool.hatch.envs.docs.scripts]
build = "mkdocs build --config-file=docs/mkdocs.yml"
serve = "mkdocs serve --verbose --config-file=docs/mkdocs.yml"
deploy = "mike deploy --push --update-aliases $(hatch version) latest --config-file=docs/mkdocs.yml"
[tool.ruff] # Ref: https://docs.astral.sh/ruff/configuration/
line-length = 120
src = [ "src", "tests" ]
# Ref: https://docs.astral.sh/ruff/settings/#format
format.docstring-code-format = true
# Ref: https://docs.astral.sh/ruff/rules/
lint.extend-select = [
"A", # flake8-builtins
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"D", # pydocstyle
"G", # flake8-logging-format
"I", # isort
"PERF", # perflint-perf
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # ruff
"SIM", # flake8-simplify
"T20", # flake8-print
"TCH", # flake8-type-checking
"UP", # pyupgrade
"W", # pycodestyle
"YTT", # flake8-2020
]
lint.ignore = [
"D105", # undocumented-magic-method
"D107", # undocumented-public-init
]
lint.per-file-ignores."src/oaipmh_scythe/__about__.py" = [
"D100", # undocumented-public-module
]
lint.per-file-ignores."src/oaipmh_scythe/client.py" = [
"PLR0913", # too-many-arguments
]
lint.per-file-ignores."tests/**.py" = [
"D", # pydocstyle
"PLR2004", # magic-value-comparison
]
lint.unfixable = [
"F401", # unused-import
]
lint.isort.known-first-party = [ "oaipmh_scythe" ]
lint.pydocstyle.convention = "google"
[tool.repo-review] # Ref: https://github.com/scientific-python/cookie/tree/main#list-of-checks
ignore = [
# Pre-commit
"PC111", # blacken-docs
"PC160", # codespell
"PC170", # pygrep hooks
"PC180", # prettier
"MY", # mypy
"RTD", # read the docs
]
[tool.pytest.ini_options] # Ref: https://docs.pytest.org/en/stable/customize.html
minversion = "8.0"
addopts = [ "-ra", "--showlocals", "--strict-markers", "--strict-config" ]
filterwarnings = [ "error" ]
log_cli_level = "INFO"
xfail_strict = true
testpaths = "tests"
[tool.coverage.run] # Ref: https://coverage.readthedocs.io/en/latest/config.html
branch = true
parallel = true
source = [ "oaipmh_scythe" ]
omit = [
"__about__.py",
]
[tool.coverage.report]
exclude_also = [
"if TYPE_CHECKING:",
"@abstractmethod",
]
fail_under = 90
show_missing = true
skip_covered = true
skip_empty = true
[tool.mypy] # Ref: https://mypy.readthedocs.io/en/stable/config_file.html#using-a-pyproject-toml-file
python_version = "3.10"
pretty = true
show_column_numbers = true
show_error_context = true
enable_error_code = [ "ignore-without-code", "redundant-expr", "truthy-bool" ]
warn_unreachable = true
[tool.licensecheck] # Ref: https://github.com/FHPythonUtils/LicenseCheck/#example-1-pyprojecttoml
using = "PEP631"
format = "ansi"
[tool.semantic_release] # Ref: https://python-semantic-release.readthedocs.io/en/latest/configuration.html#settings
commit_author = "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
commit_message = "chore: release {version}\n\nAutomatically generated by python-semantic-release [skip ci]"
major_on_zero = false
tag_format = "{version}"
version_variables = [
"src/oaipmh_scythe/__about__.py:__version__",
]
build_command = """
sed -i "s/^version: .*/version: $NEW_VERSION/" CITATION.cff
sed -i "s/^date-released: .*/date-released: $(date "+%Y-%m-%d")/" CITATION.cff
git add CITATION.cff
python -m pip install "build[uv]"
python -m build --installer=uv
"""
changelog.template_dir = ".github/templates"
changelog.environment.keep_trailing_newline = true
[tool.typos] # Ref: https://github.com/crate-ci/typos/blob/master/docs/reference.md
# add "spellchecker:disable-line" to ignore specific lines
default.extend-ignore-re = [ "(?Rm)^.*# spellchecker:disable-line$" ]