Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
119 lines (108 loc) · 4.23 KB
/
Copy pathpyproject.toml
File metadata and controls
119 lines (108 loc) · 4.23 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
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
name = "chem-spectra-app"
version = "1.6.0"
requires-python = ">= 3.12"
description = "A backend service to process files obtained from chemical spectroscopy."
license = "MIT"
readme = "README.md"
keywords = ["chemistry", "spectra", "analysis"]
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: POSIX :: Linux"
]
dependencies = [
"flask==3.*",
"gunicorn==26.*",
"matplotlib==3.*",
"netCDF4==1.*",
# The 2018 fork we pin below writes `np.dtype('a8')` in fileio/tecmag.py.
# numpy removed that alias in 2.5, so `import nmrglue` raises TypeError and
# every test errors at collection. Measured: fails on 2.5.3, imports on
# 2.4.0. The ceiling is the pin's, not ours -- it lifts when the pin does.
"numpy>=2.0,<2.5",
# Imported directly by lib/external/chemotion_converter_lcms.py. It was
# never declared and arrived only as a pyopenms transitive dependency, so a
# pyopenms release that drops it would have broken us with an ImportError.
"pandas>=2.3,<4",
"pymzml==2.*",
"requests==2.*",
"rdkit==2026.*",
"werkzeug==3.*",
"scipy==1.*",
"pyopenms==3.*",
"nmrglue@git+https://github.com/ComPlat/nmrglue.git@fe75b096f6253084a08a8ce7bf849c7343245c40",
]
# Kept as an extra so `pip install .[dev]` still works for anyone not using uv.
# `just` and CI go through the dependency group below instead.
[project.optional-dependencies]
dev = [
"coverage",
"pytest"
]
[dependency-groups]
dev = [
"coverage[toml]>=7.6",
"pytest>=8",
"ruff>=0.14", # `just lint`; [tool.ruff] below
"mypy>=1.10", # `just mypy`; [tool.mypy] below
]
[project.urls]
homepage = "https://chemotion.net/docs/services/chemspectra"
repository = "https://github.com/ComPlat/chem-spectra-app"
[tool.setuptools]
py-modules = []
# Modernization only: pyupgrade (UP) keeps the code on current-Python idioms.
# The target is the floor `requires-python` promises, not the version the image
# runs, so a fix suggested here cannot break the 3.12 leg of the CI matrix.
[tool.ruff]
target-version = "py312"
[tool.ruff.lint]
select = ["UP"]
# A ratchet, in the same spirit as the mypy overrides below: the whole UP set
# is selected, and the rules that already fire are muted so the gate is green
# today and any *new* kind of violation is caught.
#
# These are NOT fixed in this branch on purpose. All 289 are mechanical and
# auto-fixable, but a repo-wide `ruff --fix` would rewrite technique.py,
# base.py and composer/ -- which every open PR (#299-#305) also rewrites. It
# runs once that stack has landed.
#
# The list only ever gets shorter. Counts are from the run that introduced it;
# clear a rule with `just lint-fix`, then delete its line in the same commit.
ignore = [
"UP032", # 95x f-string instead of str.format
"UP006", # 69x builtin generics (List -> list)
"UP045", # 61x X | None instead of Optional[X]
"UP015", # 26x redundant open() mode
"UP031", # 14x f-string instead of percent formatting
"UP035", # 9x deprecated typing imports
]
[tool.mypy]
python_version = "3.12"
ignore_missing_imports = true
# Type checking is a ratchet. The whole tree is checked; the modules listed
# below carry pre-existing errors and are exempted for now.
#
# The list only ever gets shorter: when a change makes a module type-clean,
# delete its entry in the same commit. Never add an entry -- that would mean a
# clean module regressed, which is what this gate exists to prevent.
#
# This buys more than expected for an untyped codebase: 51 of 57 modules are
# already clean, so the gate really does guard most of the tree. The six below
# are the LC/MS and BagIt paths plus two single-error modules that the open PR
# stack rewrites anyway.
[[tool.mypy.overrides]]
ignore_errors = true
# 21 errors across these 6 of 57 modules when the gate was introduced.
# The other 51 are enforced from day one and cannot regress.
module = [
"chem_spectra.lib.composer.lcms_converter_app",
"chem_spectra.lib.composer.technique",
"chem_spectra.lib.converter.bagit.base",
"chem_spectra.lib.converter.bagit.lcms_builder",
"chem_spectra.lib.converter.fid.base",
"chem_spectra.lib.external.chemotion_converter_lcms",
]