-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
517 lines (496 loc) · 17 KB
/
Copy pathpyproject.toml
File metadata and controls
517 lines (496 loc) · 17 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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
[build-system]
requires = ["setuptools>=61.0,<85", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "ud-tools"
version = "1.18.0"
description = "Shared engineering tools: URDF generation, signal processing, and process calculators."
readme = "src/shared/python/README.md"
requires-python = ">=3.11"
license = {text = "MIT"}
authors = [
{name = "UpstreamDrift Team"}
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Physics",
]
dependencies = [
"numpy>=1.24.0",
"PyYAML>=6.0",
"defusedxml>=0.7.0",
"keyring>=24.0.0",
"platformdirs>=4.2.0",
]
[project.optional-dependencies]
# Private loopback authority used by the Rate React launcher.
rate-morris-authority = [
"fastapi>=0.141.1",
"filelock>=3.12.0",
"scipy>=1.10.0,<1.18",
"uvicorn>=0.30.0",
]
# Full installation with all features
all = [
"scipy>=1.10.0,<1.18",
"pandas>=2.0.0",
"matplotlib>=3.7.0",
"trimesh>=4.0.0",
"mujoco>=3.0.0",
"PyQt6>=6.5.0",
"sympy>=1.12",
"fastapi>=0.141.1",
"starlette>=0.45.0",
"filelock>=3.12.0",
"uvicorn>=0.30.0",
]
# AI and simulation models
ai = [
"torch>=2.0.0",
]
# URDF/Model generation only
urdf = [
"trimesh>=4.0.0",
"scipy>=1.10.0,<1.18",
]
# Signal processing
signal = [
"scipy>=1.10.0,<1.18",
"matplotlib>=3.7.0",
"sympy>=1.12",
]
# Process calculators
process = [
"scipy>=1.10.0,<1.18",
"pandas>=2.0.0",
"matplotlib>=3.7.0",
]
# Rotation converter / robotics kinematics
robotics = [
"numpy>=1.24.0",
"matplotlib>=3.7.0",
]
# GUI components
gui = [
"PyQt6>=6.5.0",
"pyqtgraph>=0.13.7",
"matplotlib>=3.7.0",
"pandas>=2.0,<3",
"scipy>=1.10.0,<1.18",
"sympy>=1.12",
]
# Shared chat facade, WebSocket router, and optional Qt dock widget.
chat = [
"pydantic>=2.0.0",
"fastapi>=0.141.1",
"PyQt6>=6.5.0",
"python-multipart>=0.0.7",
]
# Voice-to-text addon for ChatDockWidget (Tools issue #2744).
# Install with: pip install "tools[chat-voice]"
rate-of-closure-web = [
"fastapi>=0.141.1",
"filelock>=3.16.0",
"scipy>=1.10.0,<1.18",
"uvicorn>=0.30.0",
]
# Voice-to-text addon for ChatDockWidget (Tools issue #2744).
chat-voice = [
"SpeechRecognition>=3.10.0",
"PyAudio>=0.2.13",
]
# Fleet-wide theme system (PyQt6 required for full features;
# color utilities work without Qt). See issue #551
theme = [
"PyQt6>=6.5.0",
]
# P&ID generation
pid = [
"ezdxf[draw]>=1.4.3",
]
# Real OS terminal for the Sidekick OS Terminal tab (UpstreamDrift #5617).
# Picks the platform-appropriate PTY library; falls back to plain subprocess
# pipes when neither is installed.
terminal = [
"pywinpty>=2.0; platform_system == 'Windows'",
"ptyprocess; platform_system != 'Windows'",
]
# CAD geometry export (build123d pulls in its own matplotlib and PyQt6)
cad = [
"build123d==0.11.1",
]
# DWSIM gasification model
dwsim = [
"pythonnet>=3.0.0",
"pydantic>=2.0.0",
]
# Repo-aware code map (tree-sitter symbol index + SQLite FTS5).
# See: docs/codemap.md and chat_codemap_design.md
codemap = [
"tree-sitter>=0.21,<0.27",
"tree-sitter-python>=0.21",
"tree-sitter-javascript>=0.21",
"tree-sitter-typescript>=0.21",
"tree-sitter-rust>=0.21",
"tree-sitter-markdown>=0.3",
"pydantic>=2.0.0",
"watchdog>=3.0.0",
"pathspec>=0.11.0",
]
# Optional MCP server for external coding agents (Codex, Claude Code).
codemap-mcp = [
"mcp>=1.0.0",
]
# Sidekick Jupyter notebook tab (Tools #2875 Phase 1 / #2876 Phase 2).
# Phase 1 only needs nbformat; nbclient is bundled here so a single
# install enables Phase 2 execution once #2876 lands.
jupyter = [
"nbformat>=5.10",
"nbclient>=0.10",
]
# Video analyzer migration package.
video-analyzer = [
"opencv-python>=4.8.0",
"mediapipe>=0.10.0",
]
# P1AM SCADA control-system backend runtime (issue #4014).
#
# THE single source of truth for what the FastAPI backend needs in order to
# import and run. `deploy/install-services.sh` installs `.[p1am]` into the
# venv the systemd unit executes, and `backend/Dockerfile` mirrors this list as
# exact pins (its build context cannot see this file). The mirror is kept
# honest by tests/test_deployment_hardening.py, which fails if the two drift.
#
# Nothing here is optional at runtime: omitting pydantic-settings (imported by
# settings.py) or python-multipart (required by main.py's File(...) upload)
# makes the app raise ModuleNotFoundError at import, which under
# `restart: always` is an invisible crash loop.
p1am = [
"fastapi>=0.141.1,<0.142.0",
"uvicorn[standard]>=0.30.0,<0.53.0",
"pydantic>=2.7.0,<3.0.0",
"pydantic-settings>=2.2.0,<3.0.0",
"sqlmodel>=0.0.22,<0.1.0",
"pymodbus>=3.6.0,<4.0.0",
"websockets>=12.0,<18.0",
"python-multipart>=0.0.9,<0.1.0",
"numpy>=2.0.1,<2.4.0",
]
# Test/runtime dependencies imported during full-suite collection.
test = [
"ezdxf[draw]>=1.4.3",
"fastapi>=0.141.1",
"starlette>=0.45.0",
"filelock>=3.12.0",
"httpx>=0.25.0",
"opencv-python-headless>=4.8.0",
"pydantic-settings>=2.0.0",
"pymodbus>=3.0.0",
"python-multipart>=0.0.7",
"requests>=2.32.0",
"sqlmodel>=0.0.22",
"uvicorn>=0.30.0",
]
# Development tools
dev = [
"pytest>=9.0.3",
"pytest-asyncio>=1.3.0",
"pytest-qt>=4.4.0",
"pytest-cov>=4.0.0",
"pytest-xdist>=3.0.0",
"pytest-timeout>=2.0.0",
"pytest-benchmark>=4.0.0",
"pytest-vcr>=1.0.0",
# Property-based testing. Already imported by the test suite (e.g.
# tests/shared/python/sidekick/data_processing/test_io.py and the
# calc_backend property suite); declared here so the dependency is
# explicit rather than implicitly required (#3262, #3263).
"hypothesis>=6.0.0",
"tomli>=2.0.0; python_version < '3.11'",
"vcrpy>=6.0.0",
"ruff>=0.1.0",
"mypy>=1.0.0",
]
[project.scripts]
rate-of-closure-web = "rate_of_closure.web_companion.cli:main"
sidekick = "sidekick.__main__:main"
urdf-gen = "shared.python.model_generation.cli:main"
generate-pid = "shared.python.programmatic_pid.cli:main"
mypy-autofix = "tools.mypy_autofix_agent:main"
codemap = "shared.python.codemap.cli:main"
codemap-watch = "shared.python.codemap.watcher:main"
codemap-mcp = "shared.python.codemap.mcp_server:main"
video-analyzer = "video_analyzer.launch_video_analyzer:main"
[project.urls]
Homepage = "https://github.com/D-sorganization/Tools"
Repository = "https://github.com/D-sorganization/Tools"
[tool.setuptools.packages.find]
where = ["src/python/src", "src"]
include = [
"shared*",
"upstream_drift_tools*",
"sidekick*",
"utils*",
"tools*",
"web_applications*",
"contracts*",
"lower_body_model*",
"rate_of_closure*",
"codemap*",
"video_analyzer*",
"rotation_converter*",
]
exclude = [
"*.tests*",
"*tests*",
]
[tool.setuptools.package-data]
# Include py.typed marker for PEP 561 type hint support
"*" = ["py.typed"]
"shared.python.swing_sim.rotating_base" = ["resources/*.json"]
"rate_of_closure" = [
"data/*.json",
"locus_execution_capabilities.v1.json",
"visualization_tabs.v1.json",
"visualization_performance.v1.json",
"visualization_accessibility.v1.json",
"visualization_acceptance.v1.json",
"visual_baselines.v1.json",
"visual_baseline_calibration.v1.json",
"visual_baselines/v1/react/*.png",
"visual_baselines/v1/pyqt/*.png",
"web/dist/index.html",
"web/dist/*.json",
"web/dist/assets/*",
]
[tool.setuptools.cmdclass]
build_py = "build_hooks.RateWebBuildPy"
# =============================================================================
# Pytest Configuration
# =============================================================================
# Ruff configuration lives in ruff.toml (authoritative). [tool.ruff] and
# [tool.black] sections removed to eliminate conflicting duplicate config.
[tool.pytest.ini_options]
qt_api = "pyqt6"
testpaths = ["tests"]
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
pythonpath = [
"src/data_processing/data_processor/python",
"src/media_processing/video_processor/python",
"src/ode_solver/python",
"src",
"src/python/src",
"src/tools",
"src/web_applications",
"src/solar_system_model",
"src/scientific_modeling/solar_system_model",
"src/rrt_path_planner/python/src",
"src/pendulum_simulator/src",
"src/folder_tool",
"src/p1am_control_system/backend",
]
# Fleet testing standards (§2): explicit timeout + asyncio config.
# See: Repository_Management/docs/FLEET_TESTING_STANDARDS.md
timeout = 60
timeout_method = "thread"
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
# Default lane excludes heavy + offline-only-violating selections per §2.
addopts = "-ra -v --strict-markers --strict-config --tb=short --color=yes --durations=20 --benchmark-disable -n auto --dist loadscope -m \"not slow and not live_simulation and not e2e and not requires_network\" -p no:xvfb -p no:recording -p no:pytest_recording"
console_output_style = "progress"
norecursedirs = [
"replicants",
"archive",
"legacy",
"experimental",
".git",
".tox",
".nox",
".eggs",
"__pycache__",
"build",
"dist",
"*.egg-info",
".pytest_cache",
"htmlcov",
]
filterwarnings = [
"ignore::DeprecationWarning:pkg_resources",
"ignore::UserWarning:pygame.pkgdata",
"ignore::DeprecationWarning:setuptools",
"default::DeprecationWarning:utils",
"default::DeprecationWarning:tools",
"ignore:.*unclosed file.*:ResourceWarning",
]
log_cli = false
log_cli_level = "WARNING"
log_cli_format = "%(asctime)s [%(levelname)8s] %(name)s: %(message)s"
log_cli_date_format = "%H:%M:%S"
log_file_level = "DEBUG"
log_file_format = "%(asctime)s [%(levelname)8s] %(name)s (%(filename)s:%(lineno)d): %(message)s"
log_file_date_format = "%Y-%m-%d %H:%M:%S"
markers = [
"unit: mark test as unit test (fast, isolated, no external dependencies)",
"integration: mark test as integration test (may use external resources)",
"e2e: mark test as end-to-end test (full system test)",
"slow: mark test as slow running (> 5 seconds)",
"performance: mark test for performance benchmarking",
"benchmark: mark test as benchmark (measures timing/throughput)",
"scientific: mark test as scientific validation test (numerical accuracy against reference data)",
"headless_safe: mark test as safe to run in headless (no display) environments",
"requires_gl: mark test as requiring OpenGL/GPU display context",
"parity: mark test as cross-repo parity check (validates Tools/UpstreamDrift/Gasification_Model alignment)",
"requires_network: mark test as requiring network connectivity",
"requires_database: mark test as requiring database connection",
"requires_gpu: mark test as requiring GPU/CUDA",
"smoke: mark test as smoke test (basic sanity check)",
"regression: mark test for regression testing",
"asyncio: mark test as async test",
"contract: mark test as contract test",
"acceptance: mark test as acceptance test",
"dwsim: tests that require DWSIM runtime",
"live_simulation: tests requiring live DWSIM simulation access",
"gui: tests that require a GUI environment",
"heavy: tests that take a long time to run",
"math: pure calculation without external dependencies",
"physics: physics engine calculations",
"math_regression: tests looking for unintended calculation changes",
"flaky: tests that are known to fail intermittently",
"tools_contracts: tests verifying shared tools libraries interfaces",
"vcr: tests that replay recorded HTTP interactions with vcrpy/pytest-vcr",
"validates_physics: asserts physical correctness against hand-computed reference values (not parity/smoke)",
# ---- fleet testing standards §2 additions ----
"serial: must run with -n 0 (xdist parallel breaks this test)",
"requires_mujoco: skip when import mujoco fails",
"requires_drake: skip when import pydrake fails",
"requires_pinocchio: skip when pinocchio is the stub PyPI wheel",
"requires_opensim: skip when import opensim fails",
"requires_matlab: skip when MATLAB Engine for Python is unavailable",
]
[tool.coverage.run]
source = ["src"]
omit = [
"*/tests/*",
"*/test_*",
"*/__pycache__/*",
"*/node_modules/*",
"*/venv/*",
"*/.venv/*",
"*/site-packages/*",
"setup.py",
"conftest.py",
# Legacy/experimental trees excluded from coverage by policy (carried over
# from the retired .coveragerc, Tools #4913). pendulum_simulator and
# movement_optimizer are no longer omitted: their suites run in the PR lane.
"src/data_processing/*",
"src/document_processing/*",
"src/scientific_modeling/*",
"src/tools/code_quality_check.py",
]
[tool.coverage.paths]
# The PR lane runs the suite as shards on different runners and combines the
# data in the `tests (3.x)` gate. Map every checkout's absolute src/ back to
# the repo-relative path so `coverage combine` merges them (Tools #4913).
source = ["src", "*/Tools/src"]
[tool.coverage.report]
# THE coverage floor -- declared here and nowhere else (Tools #4913).
# CI applies it exactly once: `coverage report` on the combined full-suite data
# in the `tests (3.x)` gate of ci-standard.yml. scripts/check_coverage_policy.py
# and scripts/measure_coverage.py read the same value. Shards pass
# `--cov-fail-under=0` because a per-shard floor would reject every shard for
# the code it does not exercise; that 0 is not a floor.
# 20 is the value the retired .coveragerc declared (it was never enforced in
# CI, which overrode it). Ratchet upward once the first green full-suite run
# records the measured total in config/coverage_baseline.json.
fail_under = 20
precision = 2
show_missing = true
skip_empty = true
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if __name__ == .__main__.",
"if TYPE_CHECKING:",
"raise NotImplementedError",
"raise AssertionError",
"pass",
"if 0:",
"if False:",
"if sys.version_info",
"if hasattr\\(sys, 'frozen'\\)",
"@abstractmethod",
"@abc.abstractmethod",
"if type\\(self\\) is not type\\(obj\\):",
]
[tool.coverage.html]
directory = "htmlcov"
title = "Coverage Report"
show_contexts = true
[tool.coverage.xml]
output = "coverage.xml"
[tool.coverage.json]
output = "coverage.json"
[tool.mypy]
python_version = "3.11" # Matches pyproject requires-python and ruff target-version
files = ["src"]
mypy_path = [
"src",
"src/python/src",
"src/tools",
"src/web_applications",
"src/data_processing/data_processor/python",
"src/solar_system_model",
"src/scientific_modeling/solar_system_model",
"src/scientific_modeling/rrt_path_planner/python/src",
"src/media_processing/video_processor/python",
"src/pendulum_simulator/src",
"src/folder_tool",
]
ignore_missing_imports = true
check_untyped_defs = true
disallow_untyped_defs = false
explicit_package_bases = true
# Prevent CWD from creating phantom "src.*" namespace packages.
# With explicit_package_bases=true and both "src" and CWD as source roots,
# src/shared/python/__init__.py gets two module names ("shared.python" from
# the src MYPYPATH root and "src.shared.python" from CWD), causing a fatal
# "source file found twice" error. Since src/ has no __init__.py, disabling
# namespace packages stops CWD from treating src/ as a namespace package.
namespace_packages = false
# TRACKED_TASK: #2296 — Blanket signal_toolkit ignore_errors removed.
# Per-file overrides below cover the mixin files whose Protocol-based cross-mixin
# attribute access still generates attr-defined errors (widget_processing: 52 errors,
# widget_plotting: 28 errors, widget_ui: 1 error). The root fix is to expand
# WidgetProtocol with canvas sub-protocol and the missing signal_generated /
# signal_updated attributes; tracked in issue #2296.
[[tool.mypy.overrides]]
module = "signal_toolkit.widget_processing"
ignore_errors = true
[[tool.mypy.overrides]]
module = "signal_toolkit.widget_plotting"
ignore_errors = true
[[tool.mypy.overrides]]
module = "signal_toolkit.widget_ui"
ignore_errors = true
# codemap: tree-sitter Node objects are untyped pervasively and the package
# uses optional-dep import guards (mcp, blake3, pathspec, watchdog) that
# mypy flags as unused on systems where the deps happen to be installed.
# Strict typing can be revisited in a follow-up.
[[tool.mypy.overrides]]
module = "codemap.*"
ignore_errors = true
# Sidekick UI / chat / AI adapter files modified during the
# fix/ui-layout-and-sidekick refactor have pre-existing mypy debt that the
# refactor surfaced (Qt slot helpers returning Any, unreachable branches
# behind defensive isinstance guards, dict.get() returning Any). The
# untangling needs proper Qt protocol typing — tracked as a follow-up to
# PR #2965. For now those files carry `# mypy: ignore-errors` headers so
# quality-gate / Lint stays green.