-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpyproject.toml
More file actions
331 lines (304 loc) · 9.23 KB
/
Copy pathpyproject.toml
File metadata and controls
331 lines (304 loc) · 9.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
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"
[tool.hatch.version]
source = "vcs"
fallback-version = "0.0.0.dev0"
[tool.hatch.build.hooks.vcs]
version-file = "src/tide2/_version.py"
[project]
name = "tide2"
dynamic = ["version"]
description = "An advanced data de-identification and anonymization toolkit combining multiple strategies with cryptographic techniques and ML-based entity recognition"
readme = "README.md"
license = "MIT"
license-files = ["LICENSE-MIT"]
requires-python = ">=3.12,<3.13"
authors = [{ name = "TIDE 2.0 Team" }]
keywords = [
"anonymization",
"de-identification",
"pii",
"privacy",
"healthcare",
"data-protection",
"nlp",
"presidio",
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Healthcare Industry",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Security :: Cryptography",
"Topic :: Text Processing :: Linguistic",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
]
dependencies = [
# Google Cloud services
"db-dtypes>=1.6,<2", # implicit: required by bigquery.to_dataframe() for pandas dtype mapping
"google-cloud-bigquery>=3.41,<4",
"google-cloud-storage>=3.10,<4",
# NLP and ML-based entity recognition (required: no model runs without these)
"accelerate>=1.14,<2", # required by transformers for device_map="auto" (device="auto")
# Exact pin: presidio internals are monkeypatched in
# src/tide2/anonymizers/presidio_patches.py, so an internal rename in a patch
# release (as happened with _merge_entities_with_whitespace_between ->
# _merge_entities_with_spaces_between in 2.2.363) can crash import. Upgrades
# must be a deliberate, tested step, not a silent `uv lock --upgrade`.
"presidio-analyzer==2.2.364",
"presidio-anonymizer==2.2.364",
"spacy>=3.8,<4",
"torch>=2.12,<3",
"transformers>=5.0,<6",
# Data processing
"numpy>=2,<3", # ABI-coupled to torch/spacy/pyarrow
"intervaltree>=3.1,<4",
"orjson>=3.10,<4",
"pandas>=2.3,<3",
"pyarrow>=14,<25",
# Cryptography and anonymization
"faker>=40.19,<41",
"ff3>=1.0,<2",
"pyahocorasick>=2.3,<3",
"usaddress>=0.5,<0.6",
# Orchestration
"ray[default,data]>=2.54,<3",
"aiohttp>=3.14,<4", # transitive via ray[default]; pinned for security/compat
# Web and CLI
"httpx>=0.25,<1",
"streamlit>=1.58,<2",
"starlette>=1.0,<2", # transitive via streamlit; pinned for security/compat
# Utilities
"psutil>=7.2,<8",
"pyyaml>=6.0,<7",
"tenacity>=9.1,<10",
]
[project.optional-dependencies]
llm = [
"anthropic>=0.105,<1",
"google-cloud-aiplatform>=1.154,<2",
"google-genai>=2.7,<3",
"openai>=2.38,<3"
]
evaluation = [
"scikit-learn>=1.8,<2",
"scipy>=1.12,<2",
"tqdm>=4.67,<5",
]
dev = [
"pytest>=7.4,<10",
"pytest-cov>=4.1,<8",
"ty>=0.0.28",
"pre-commit>=3.5.0",
"ruff>=0.1.0",
"pandas-stubs>=2.3.2.250926",
"types-tqdm>=4.67.0.20250809",
"cython",
"ipykernel",
"jupyter",
"scikit-learn>=1.8,<2",
"scipy>=1.12,<2",
"tqdm>=4.67,<5",
"keyring>=25.6.0",
"keyrings-google-artifactregistry-auth>=1.1.2",
]
test = ["pytest>=7.4,<10", "pytest-cov>=4.1,<8"]
docs = ["pdoc>=14,<17"]
[project.scripts]
tide2-visualizer = "tide2.cli.main_visualizer:main"
tide2-runner = "tide2.runner.cli:main"
[project.urls]
Homepage = "https://github.com/susom/tide2-core"
Repository = "https://github.com/susom/tide2-core"
Issues = "https://github.com/susom/tide2-core/issues"
Documentation = "https://susom.github.io/tide2-core/"
# Versioning/changelog are handled by release-please (see release-please-config.json
# and .github/workflows/release-please.yml). The commit-type -> bump map and the
# changelog section/exclude config that used to live in [tool.semantic_release] are
# ported there. hatch-vcs derives the wheel version from the git tag.
[tool.uv]
# Build these from source to ensure numpy ABI compatibility
# This prevents "numpy.dtype size changed" errors when using numpy 2.x
#no-binary-package = ["thinc", "spacy", "blis"]
# keyring-provider = "subprocess"
# [[tool.uv.index]]
# name = "private-registry"
# url = "https://oauth2accesstoken@us-west1-python.pkg.dev/som-rit-infrastructure-prod/pypi-cache/simple/"
# default = true
[tool.bandit]
exclude_dirs = ["tests"]
skips = [
"B101",
"B601",
"B615",
] # B101: assert used in tests. B601: subprocess.run in cli/main_visualizer.py uses a hardcoded argument list (no shell=True, no user input), safe from injection. B615: HuggingFace model revisions are controlled via the resolved model_path/config, not pinned per from_pretrained() call; deployments select trusted model weights explicitly.
[tool.ty.environment]
python-version = "3.12"
# Set the first-party source root explicitly. By default ty auto-detects ./src,
root = ["src/tide2"]
[tool.ty.analysis]
# Suppress unresolved-import errors for GPU/distributed packages that lack stubs.
# Mirrors the behavior of mypy's ignore_missing_imports = true for these libs.
allowed-unresolved-imports = [
"cudf.**",
"cuml.**",
"cugraph.**",
"ray.**",
"google.cloud.**",
]
[tool.ruff]
line-length = 120
target-version = "py312"
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
[tool.ruff.lint]
select = [
"E",
"F",
"W",
"C90",
"I",
"N",
"UP",
"S",
"B",
"A",
"C4",
"DTZ",
"EM",
"ISC",
"ICN",
"PT",
"Q",
"RSE",
"RET",
"SIM",
"TID",
"ARG",
"PTH",
"ERA",
"PD",
"PGH",
"PL",
"TRY",
"NPY",
"RUF",
]
ignore = [
"E501",
"S101",
"PLR0913",
"PLR0912",
"PLC0415", # Import at top level
"EM101", # String literal in exception
"EM102", # f-string literal in exception
"TRY003", # Long exception messages
"N802", # Function name should be lowercase (Qt methods)
"ARG002", # Unused method argument
"C901", # Too complex (for now)
"TRY301", # Abstract raise to an inner function
"RUF001",
]
[tool.ruff.lint.isort]
known-first-party = ["tide2"]
force-single-line = true
# Per-file ignores for test files
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = [
"PLR2004", # Magic value in comparison
"ARG001", # Unused function argument (fixtures)
"S101", # Use of assert detected
"S105", # Hardcoded password — test fixtures use dummy secrets
"S108", # Hardcoded temp file path — used as mock GCS/IO targets, never written
"DTZ001", # datetime() without tzinfo — date math tests are tz-agnostic
"PD011", # .values usage — test DataFrames are explicit
"PT011", # pytest.raises too broad — acceptable in tests
"PT018", # Composite assertion — readable in test context
"PTH109", # os.getcwd — test cwd manipulation
"PTH118", # os.path.join — test path construction
"PTH123", # builtin open — test file helpers
"PLR0911", # Too many return statements — test helpers
"PLR0915", # Too many statements — verbose test setup
"SIM115", # open() without context manager — test temp-file helpers
"SIM117", # Nested with statements — readable in test mocking
"TRY002", # Raise vanilla Exception — test stubs
]
"notebooks/**/*.*py*" = [
"E402", # Module level import not at top of file
"ERA001", # Commented-out code used as usage examples
]
"src/tide2/runner/cli.py" = [
"PLR0915", # Too many statements — CLI dispatch and argparse setup are inherently verbose
]
[tool.hatch.build.targets.wheel]
packages = ["src/tide2"]
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.build.targets.sdist]
include = ["/src", "/README.md", "/LICENSE-MIT", "/CHANGELOG.md", "/PUBLISHING.md"]
exclude = [
"/.git",
"/.gitignore",
"/data",
"/examples",
"/local",
"/keys",
"/tide2.egg-info",
"/.pytest_cache",
"/tmp",
"/__pycache__",
]
[tool.pytest.ini_options]
markers = [
"integration: marks tests as integration tests (may be slower than unit tests)",
]
testpaths = ["tests"]
addopts = "--cov=tide2 --cov-report=term-missing --cov-report=html --cov-report=xml"
filterwarnings = ["ignore::DeprecationWarning:spacy.cli._util"]
[tool.coverage.run]
source = ["tide2"]
branch = true
omit = ["tests/*", ".venv/*"]
[tool.coverage.report]
show_missing = true
skip_empty = true
exclude_lines = [
"pragma: no cover",
"if __name__ == .__main__.",
"if TYPE_CHECKING:",
]
[dependency-groups]
llm = [
"anthropic>=0.105,<1",
"google-cloud-aiplatform>=1.154,<2",
"google-genai>=2.7,<3",
"openai>=2.38,<3",
]
evaluation = [
"scikit-learn>=1.8,<2",
"scipy>=1.12,<2",
"tqdm>=4.67,<5",
]
dev = [
"pytest>=7.4,<10",
"pytest-cov>=4.1,<8",
"ty>=0.0.28",
"pre-commit>=3.5.0",
"ruff>=0.1.0",
"pandas-stubs>=2.3.2.250926",
"types-tqdm>=4.67.0.20250809",
"cython",
"ipykernel",
"jupyter",
{ include-group = "evaluation" },
"keyring>=25.6.0",
"keyrings-google-artifactregistry-auth>=1.1.2",
]
test = ["pytest>=7.4,<10", "pytest-cov>=4.1,<8"]
docs = ["pdoc>=14,<17"]