forked from tlambert03/ome-types
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
223 lines (197 loc) · 6.44 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
# https://peps.python.org/pep-0517/
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"
# https://peps.python.org/pep-0621/
[project]
name = "ome-types"
description = "Python dataclasses for the OME data model"
keywords = ["ome", "ome-model", "microscopy", "schema", "types"]
readme = "README.md"
requires-python = ">=3.8"
license = { text = "MIT" }
authors = [{ name = "Talley Lambert", email = "talley.lambert@gmail.com" }]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dynamic = ["version"]
dependencies = ["pydantic >=1.10.0", "pydantic-compat >=0.1.0", "xsdata >=23.6,<24.4"]
[project.urls]
Source = "https://github.com/tlambert03/ome-types"
Tracker = "https://github.com/tlambert03/ome-types/issues"
Documentation = "https://ome-types.readthedocs.io/en/latest/"
[project.entry-points."napari.manifest"]
ome-types = "ome_types:napari.yaml"
# extras
# https://peps.python.org/pep-0621/#dependencies-optional-dependencies
[project.optional-dependencies]
pint = ["Pint >=0.15"]
lxml = ["lxml >=4.8.0"]
docs = ["mkdocs-material", "mkdocstrings-python"]
test = [
"lxml",
"mypy",
"numpy",
"pint",
"pytest-codspeed",
"pytest-cov",
"pytest-mypy-plugins",
"pytest",
"ruff",
"xmlschema <2.5", # FIXME: determine why
"xsdata[cli]",
"types-lxml; python_version >= '3.8'",
]
test-qt = ["qtpy", "pytest-qt"]
# pin ruff for builds because it changes often
build = ["ruff ==0.3.0", "xsdata[cli]==24.2.1"]
dev = ["ome-types[test]", "ome-types[build]", "ome-types[docs]", "pre-commit"]
# https://hatch.pypa.io/latest/plugins/build-hook/custom/
[tool.hatch.build.targets.wheel.hooks.custom]
# requirements to run the autogen script in hatch_build.py
require-runtime-dependencies = true
require-runtime-features = ["build"]
# https://hatch.pypa.io/latest/config/metadata/
[tool.hatch]
version = { source = "vcs" }
[tool.hatch.build.targets.wheel]
only-include = ["src/ome_types", "src/xsdata_pydantic_basemodel"]
sources = ["src"]
artifacts = ["src/ome_types/_autogenerated"]
[tool.hatch.build.targets.sdist]
include = ["src", "CHANGELOG.md", "hatch_build.py"]
exclude = ["src/ome_types/_autogenerated"]
# https://github.com/charliermarsh/ruff
[tool.ruff]
line-length = 88
src = ["src", "tests"]
target-version = "py38"
exclude = ['src/_ome_autogen.py', 'src/ome_types/_vendor']
[tool.ruff.lint]
pydocstyle = { convention = "numpy" }
select = [
"E", # style errors
"W", # style warnings
"F", # flakes
"D", # pydocstyle
"D417", # Missing argument descriptions in Docstrings
"I", # isort
"UP", # pyupgrade
"S", # bandit
"C4", # flake8-comprehensions
"B", # flake8-bugbear
"A001", # flake8-builtins
"RUF", # ruff-specific rules
"SIM105", # contextlib.suppress
"TID", # tidy imports
"TCH", # flake8-type-checking
]
ignore = [
"D104", # Missing docstring in public package
"D401", # First line should be in imperative mood
"D401", # First line should be in imperative mood
"D100", # Missing docstring in public module
"S3", # Using `xml` to parse untrusted data is known to be vulnerable to XML attacks
]
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all" # Disallow all relative imports.
[tool.ruff.lint.per-file-ignores]
"tests/*.py" = ["D", "S"]
"src/ome_autogen/*.py" = ["D10", "E501"]
".github/*.py" = ["D"]
"setup.py" = ["D"]
"docs/**/*.py" = ["D"]
"src/xsdata_pydantic_basemodel/**/*.py" = ["D"]
# https://docs.astral.sh/ruff/formatter/
[tool.ruff.format]
docstring-code-format = true
[tool.check-manifest]
ignore = [
"coverage.yml",
".pre-commit-config.yaml",
".github_changelog_generator",
".readthedocs.yml",
"mkdocs.yml",
"docs/**/*",
"tests/**/*",
"typesafety/**/*",
]
# https://docs.pytest.org/en/6.2.x/customize.html
[tool.pytest.ini_options]
minversion = "6.0"
testpaths = ["tests"]
addopts = '--mypy-only-local-stub --color=yes'
filterwarnings = [
"error",
"ignore:Casting invalid AnnotationID:UserWarning",
# FIXME: i think this might be an xsdata issue?
"ignore::ResourceWarning",
"ignore:pkg_resources is deprecated", # paquo tests
"ignore:::paquo", # paquo tests
"ignore:the imp module is deprecated", # omero tests
]
# https://mypy.readthedocs.io/en/stable/config_file.html
[tool.mypy]
files = "src/**/*/*.py"
follow_imports = 'silent'
strict_optional = true
warn_redundant_casts = true
# warn_unused_ignores = true
disallow_any_generics = false
no_implicit_reexport = true
ignore_missing_imports = true
disallow_untyped_defs = true
plugins = "pydantic.mypy"
[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = false # allow parsing Any
[[tool.mypy.overrides]]
module = ['ome_types._autogenerated.ome_2016_06.structured_annotations']
# Definition of "__iter__" in base class "BaseModel"
# is incompatible with definition in base class "Sequence"
disable_error_code = "misc"
[[tool.mypy.overrides]]
module = ['ome_types._autogenerated.*']
# FIXME: this is because we use type hints from pydantic2 Field
# (via pydantic_compat ... cause that's what it forwards)
# but we *have* to use pydantic v1 syntax
disable_error_code = "call-arg"
# https://coverage.readthedocs.io/en/6.4/config.html
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"@overload",
"except ImportError",
"\\.\\.\\.",
"raise NotImplementedError()",
]
[tool.coverage.run]
source = ["ome_types", "ome_autogen"]
omit = [
"src/ome_types/_autogenerated/*",
"/private/var/folders/*",
"*/_vendor/*",
"src/ome_types/widget.py",
]
[tool.typos.default]
extend-ignore-identifiers-re = ["(?i)nd2?.*", "(?i)ome", ".*ser_schema"]
[tool.typos.files]
extend-exclude = ["*.xsd", "*.xml", "*.xsl", "*.json"]
# Entry points -- REMOVE ONCE XSDATA-PYDANTIC-BASEMODEL IS SEPARATE
[project.entry-points."xsdata.plugins.class_types"]
xsdata_pydantic_basemodel = "xsdata_pydantic_basemodel.hooks.class_type"
[project.entry-points."xsdata.plugins.cli"]
xsdata_pydantic_basemodel = "xsdata_pydantic_basemodel.hooks.cli"