-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathpyproject.toml
More file actions
222 lines (203 loc) · 8.7 KB
/
Copy pathpyproject.toml
File metadata and controls
222 lines (203 loc) · 8.7 KB
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
# Copyright (c) 2024-2026 CRS4
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
[tool.poetry]
name = "roc-validator"
version = "0.11.2"
description = "A Python package to validate RO-Crates"
authors = [
"Marco Enrico Piras <kikkomep@crs4.it>",
"Luca Pireddu <luca.pireddu@crs4.it>",
"Simone Leo <simleo@crs4.it>",
]
readme = "README.md"
license = "Apache-2.0"
# Links to the GitHub repository and the project homepage/documentation
repository = "https://github.com/crs4/rocrate-validator"
homepage = "https://github.com/crs4/rocrate-validator"
documentation = "https://github.com/crs4/rocrate-validator"
# Keywords and classifiers
keywords = [
"RO-Crate",
"validation",
"metadata",
"research object",
"data management",
"scientific data",
"Python"
]
classifiers = [
"Development Status :: 4 - Beta",
"Natural Language :: English",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Testing",
"Topic :: Software Development :: Quality Assurance",
"Topic :: Utilities",
"Environment :: Console",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
]
# Package Settings
packages = [{ include = "rocrate_validator", from = "." }]
include = [
{ path = "pyproject.toml", format = [
"sdist",
"wheel",
] },
{ path = "README.md", format = [
"sdist",
"wheel",
] },
{ path = "LICENSE", format = [
"sdist",
"wheel",
] }
]
[tool.poetry.dependencies]
python = ">=3.10,<4.0"
rdflib = ">=7.1,<8.0"
pyshacl = ">=0.26"
click = ">=8.2,<9.0"
rich = ">=13.9,<14.0"
toml = ">=0.10.2,<1.0"
rich-click = ">=1.8,<2.0"
colorlog = ">=6.9,<7.0"
requests = ">=2.32,<3.0"
requests-cache = ">=1.2,<2.0"
inquirerpy = ">=0.3.4,<0.4.0"
enum-tools = ">=0.12,<0.13"
[tool.poetry.group.dev.dependencies]
pylint = "^3.1.0"
ipykernel = "^6.29.3"
ruff = "^0.15.15"
pre-commit = "^4.6.0"
types-toml = "^0.10.8.20260518"
mypy = "^2.1.0"
[tool.poetry.group.test.dependencies]
pytest-cov = "^5.0.0"
pytest-xdist = "^3.6.1"
[tool.poetry.group.docs.dependencies]
sphinx = "^8.1.3"
nbsphinx = "^0.9.5"
sphinx-toolbox = "^3.8.1"
myst-parser = "^4.0.0"
sphinx-rtd-theme = "^3.0.2"
sphinx-copybutton = "^0.5.2"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.poetry.scripts]
rocrate-validator = "rocrate_validator.cli:cli"
[tool.rocrate_validator]
skip_dirs = [".git", ".github", ".vscode"]
[tool.pytest.ini_options]
testpaths = ["tests"]
filterwarnings = [
# Ignore deprecation warnings from rdflib's JSON-LD parser,
# used internally by pyshacl. These warnings are unrelated to
# our code and currently noisy.
# See: https://github.com/RDFLib/rdflib/issues/3064
# Fix in progress: https://github.com/RDFLib/rdflib/issues/3302
"ignore::DeprecationWarning:rdflib.plugins.parsers.jsonld",
]
[tool.typos.default]
extend-ignore-re = ["[0-9a-f]{7,40}"] # Ignore long hexadecimal strings, which are often used as identifiers (e.g., Git commit hashes, UUIDs) and are not typically misspelled words.
[tool.typos.files]
extend-exclude = ["tests/data", "docs/diagrams", "*.json", "*.html", "*__init__.py"]
# Pylint configuration.
# Ruff (see ruff.toml) is the primary linter/formatter; this section keeps
# pylint consistent with it so the two tools do not disagree on style or on
# the design limits the project deliberately accepts.
[tool.pylint.main]
# Lowest supported Python version (matches tool.poetry.dependencies.python).
py-version = "3.10"
# Platform-specific stdlib modules that are imported behind try/except guards;
# pylint cannot import them on every OS and would report a false `import-error`.
ignored-modules = ["msvcrt"]
[tool.pylint.format]
# Match the line length enforced by Ruff (ruff.toml `line-length = 120`).
max-line-length = 120
[tool.pylint.basic]
# Names that intentionally deviate from the default naming style and should
# NOT be flagged as `invalid-name` — they mirror external APIs or domain terms:
good-names-rgxs = [
"^_?publicID$", # rdflib API parameter name
"^_?(violating[A-Za-z]+|propertyValue)$", # SHACL violation fields (camelCase domain)
"^(basicConfig|getLogger)$", # drop-in mirror of the stdlib `logging` API
"^(_installed|_config|__profiles_loaded)$", # module-level mutable state (not constants)
"^[A-Z][A-Z0-9_]*_TYPES$", # UPPER_CASE type aliases
"^(focusNode|resultPath|sourceConstraintComponent|sourceShape|propertyGroup|requirementCheck)$", # SHACL/rdflib API
"^SHACL$", # rdflib Namespace alias (uppercase by convention)
"^jsonLD(_[a-zA-Z]+)?$", # JSON-LD domain term
]
[tool.pylint."messages control"]
disable = [
# Docstrings are not enforced project-wide: Ruff's `D` (pydocstyle) rules
# are intentionally not enabled, so pylint should not flag them either.
"missing-module-docstring", # C0114
"missing-class-docstring", # C0115
"missing-function-docstring", # C0116
# Pre-existing project style — mirrors the `PLR*` entries already ignored
# in ruff.toml, so pylint and Ruff stay aligned on design limits.
"too-many-arguments", # R0913 ~ ruff PLR0913
"too-many-positional-arguments", # R0917 ~ ruff PLR0917
"too-many-public-methods", # R0904 ~ ruff PLR0904
# Design metrics not enforced by this project (commonly disabled): small
# data/config classes and cross-file similarity are acceptable here.
"too-few-public-methods", # R0903
"too-many-instance-attributes", # R0902
"duplicate-code", # R0801: noisy across CLI/output layers
# Deferred imports are intentional: circular-import avoidance,
# platform-specific modules, optional dependencies, and lazy CLI loading.
"import-outside-toplevel", # C0415
# Broad `except Exception` is structural here: CLI boundary handlers,
# user-supplied check execution (Python/SHACL plugins), parsers of
# untrusted RO-Crate metadata and best-effort I/O fallbacks all need
# to catch anything. Narrowing is impossible at most call sites and
# noisy at the rest; suppress globally instead of per-line.
"broad-exception-caught", # W0718
# False positive triggered by the `if TYPE_CHECKING:` import pattern:
# pylint sees the guarded block as code and flags any import after it
# as not at the top. Ruff handles this pattern correctly.
"wrong-import-position", # C0413
# Module-level lazy init / configuration singletons (e.g. `_installed`,
# `_config`, `__profiles_loaded`) intentionally use the `global` keyword.
# The pattern is conventional and already whitelisted in `good-names-rgxs`.
"global-statement", # W0603
# `_name`-prefixed cross-class collaboration is intentional throughout the
# validator (e.g. `_add_executed_check`, `_do_validate_`, `_close_session`):
# the underscore signals "internal API" within the package, not a hard
# privacy boundary. Per-callsite suppressions would be noisy.
"protected-access", # W0212
]
# Mypy configuration.
# Static type checking for the package. The pre-commit `mypy` hook runs
# `poetry run mypy` with no file arguments, so `files` below defines what gets
# checked. The baseline is intentionally lenient (gradual typing): it surfaces
# real type errors without forcing annotations on every function yet.
[tool.mypy]
python_version = "3.10" # lowest supported version (see dependencies.python)
files = ["rocrate_validator"] # the package; tests are not type-checked (yet)
# Surface configuration/annotation drift without being noisy.
warn_unused_configs = true
warn_redundant_casts = true
warn_unused_ignores = true
# Type-check the bodies of unannotated functions too (catches real bugs without
# requiring annotations everywhere).
check_untyped_defs = true