-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyproject.toml
More file actions
272 lines (248 loc) · 9.66 KB
/
pyproject.toml
File metadata and controls
272 lines (248 loc) · 9.66 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
# Research Project Template Configuration
#
# This is a comprehensive template for research projects with test-driven development,
# automated PDF generation, and professional documentation structure.
#
# For documentation and usage, see:
# - HOW_TO_USE.md - Complete usage guide from basic to advanced
# - README.md - Project overview and quick start
# - ARCHITECTURE.md - System design overview
# - WORKFLOW.md - Development workflow guide
# - THIN_ORCHESTRATOR_SUMMARY.md - Architecture implementation
# - EXAMPLES_SHOWCASE.md - Real-world usage examples
#
# Repository: https://github.com/docxology/template
[project]
name = "research-project-template"
version = "3.0.0"
description = "A comprehensive template for research projects with test-driven development, automated PDF generation, and professional documentation structure"
authors = [{ name = "Research Template Team" }]
readme = "README.md"
requires-python = ">=3.10"
keywords = ["research", "template", "academic", "scientific", "documentation", "pdf-generation", "test-driven-development"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
"Topic :: Software Development :: Documentation",
"Topic :: Text Processing :: Markup",
]
dependencies = [
# numpy and matplotlib are core because infrastructure/scientific/ uses them for
# benchmarking and figure generation — not optional for projects using this template
"numpy>=1.22",
"pyyaml>=6.0",
"matplotlib>=3.7",
# scipy, scikit-learn, wordcloud, rdflib are in [scientific] optional group — install with:
# uv sync --group scientific
# requests is in the [llm] dep group — install with: uv sync --group llm
"networkx>=3.4.2",
]
# NOTE: [project.scripts] removed — entries were shell commands, not Python
# entrypoint references (PEP 517 violation). Use `uv run pytest ...` or
# the scripts/ directory for dev workflows. package = false (line 120) means
# no console_scripts are installed anyway.
[dependency-groups]
# Optional scientific computing (used by act_inf_metaanalysis project; not needed for core template)
scientific = [
"scipy>=1.10.0",
"pandas>=2.0.0",
"rdflib>=7.0.0",
"wordcloud>=1.9.0",
"scikit-learn>=1.3.0",
]
# Optional LLM integration (requires running Ollama server and requests HTTP library)
llm = [
"requests>=2.31.0",
]
# Optional rendering enhancements (lazily imported in manuscript_overview.py and pdf_validator.py)
rendering = [
"reportlab>=4.0.0",
"pypdf>=5.0",
"pdfplumber>=0.11.0",
]
# Optional dashboard generation (lazily imported in dashboard_generator.py)
dashboard = [
"plotly>=5.0.0",
]
# Optional .env file loading (used in infrastructure/core/credentials.py, gracefully absent)
dotenv = [
"python-dotenv>=1.0.0",
]
# Optional barcode generation for steganography module (gracefully absent)
steganography = [
"qrcode[pil]>=8.2",
"python-barcode>=0.15",
]
# Optional resource monitoring (gracefully absent via try/except in logging_utils.py)
monitoring = [
"psutil>=5.9.0",
]
# DisCoPy (projects/cognitive_case_diagrams string diagrams; not in default-groups)
discopy = [
"discopy>=1.0.0",
]
# Development dependencies (replaces deprecated tool.uv.dev-dependencies)
dev = [
"pytest>=7.0",
"pytest-cov>=4.0",
"pytest-httpserver>=1.0.8", # Local HTTP test server for no-mocks policy
"pytest-timeout>=2.0", # Test timeout plugin to prevent hanging tests
"mypy>=1.17.1",
"pip-audit>=2.0.0",
"bandit>=1.7.0",
"pytest-asyncio>=1.3.0",
"iniconfig>=2.3.0",
"types-requests>=2.32.4.20260107",
"types-pyyaml>=6.0.12.20250915",
"black>=23.0",
# Code-health scanner (Python 3.11+ only; template still supports 3.10 for projects)
"desloppify @ git+https://github.com/peteromallet/desloppify.git; python_version >= '3.11'",
]
[tool.uv]
# uv-specific configuration
managed = true # Use uv's virtual environment management
package = false # This is not a distributable package
default-groups = ["dev", "rendering"]
[tool.uv.workspace]
# Workspace configuration for multi-project support
# Supports both standalone projects and nested projects within program directories
members = []
exclude = [
"projects/*/output",
"projects/*/*/output",
"output"
]
[tool.pytest.ini_options]
# Pytest configuration (consolidated from pytest.ini)
pythonpath = [".", "infrastructure", "projects/code_project/src"]
testpaths = ["tests", "tests/integration"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = "-v --tb=short --strict-markers -W ignore::pytest.PytestDeprecationWarning --durations=10 -m 'not slow'"
timeout = 10 # Timeout individual tests after 10 seconds to prevent hanging
timeout_method = "thread" # Use thread-based timeout (safer for network operations)
markers = [
"requires_ollama: mark test as requiring running Ollama server (Ollama will be auto-started; tests FAIL if Ollama unavailable)",
"slow: mark test as slow running",
"integration: mark test as integration test",
"no_patch_llm_client: marks tests that need real default LLMClient behavior (opts out of autouse fixture)",
]
# pytest-asyncio configuration
asyncio_mode = "strict"
asyncio_default_fixture_loop_scope = "function"
# Filter specific warnings that may still appear
# These warnings come from pytest plugins and need explicit filtering
filterwarnings = [
"ignore::DeprecationWarning:pytest_asyncio",
"ignore::PendingDeprecationWarning:pytest_asyncio",
"ignore::pytest.PytestDeprecationWarning",
"ignore::UserWarning",
"ignore::FutureWarning",
"ignore:The configuration option.*asyncio_default_fixture_loop_scope.*is unset",
]
[tool.coverage.run]
# Coverage configuration (consolidated from .coveragerc)
# Note: Test runners use --cov-datafile flags for isolation:
# - Infrastructure tests: --cov-datafile=.coverage.infra
# - Project tests: --cov-datafile=.coverage.project
branch = true
source = ["infrastructure", "projects/code_project/src"]
omit = [
"*/tests/*",
"*/test_*",
"*/__pycache__/*",
"*/tmp/*",
"*/temp/*",
"*/site-packages/*",
"/private/var/folders/*",
]
[tool.coverage.report]
# fail_under = 70 is a global fallback setting
# Individual test runs use 60% (infrastructure) and 90% (project) thresholds
# See AGENTS.md#coverage-system and docs/BUILD_SYSTEM.md for details
fail_under = 70
show_missing = true
precision = 2
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
]
# ============================================================================
# Ruff Linter Configuration (v2.6.0)
# ============================================================================
[tool.ruff]
target-version = "py312"
line-length = 100
[tool.ruff.lint]
select = ["E", "F"]
ignore = [
"E741", # Allow short math variable names in scientific code (l, I, O)
]
[tool.ruff.lint.per-file-ignores]
"infrastructure/core/logging/*.py" = ["E402"] # Conditional imports after setup
"infrastructure/publishing/publish_cli.py" = ["E402"] # sys.path manipulation before imports
"infrastructure/rendering/render_all_cli.py" = ["E402"] # sys.path manipulation before imports
"scripts/*" = ["E402", "E501"] # sys.path before imports; docstring line length
"tests/*" = ["E712", "E402"] # Allow == True/False assertions; conditional test imports
"__init__.py" = ["F401"] # Allow re-exports in __init__ files
# E501 in docstrings/comments (ruff format handles code structure line length)
"infrastructure/core/runtime/checkpoint.py" = ["E501"]
"infrastructure/core/errors.py" = ["E501"]
"infrastructure/core/exceptions.py" = ["E501"]
"infrastructure/core/files/*.py" = ["E501"]
"infrastructure/core/pipeline/*.py" = ["E501"]
"infrastructure/llm/*" = ["E501"]
"infrastructure/project/discovery.py" = ["E501"]
"infrastructure/publishing/citations.py" = ["E501"]
"infrastructure/rendering/slides_renderer.py" = ["E501"]
"infrastructure/reporting/*" = ["E501"]
"infrastructure/scientific/templates.py" = ["E501"]
"infrastructure/validation/content/*.py" = ["E501"]
"projects/*/src/**" = ["E501"]
# ============================================================================
# mypy Type Checking Configuration (v2.7.0)
# ============================================================================
[tool.mypy]
python_version = "3.12"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = false # Will tighten per-module as types are narrowed
check_untyped_defs = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
ignore_missing_imports = true
# Per-module strict overrides (progressively tightened)
[[tool.mypy.overrides]]
module = "infrastructure.core.health_check"
disallow_untyped_defs = true
[[tool.mypy.overrides]]
module = "infrastructure.core.exceptions"
disallow_untyped_defs = true
# v2.13.0: Strict overrides for validation & rendering packages
[[tool.mypy.overrides]]
module = "infrastructure.validation.*"
disallow_untyped_defs = true
[[tool.mypy.overrides]]
module = "infrastructure.rendering.*"
disallow_untyped_defs = true
[tool.bandit]
# B101: assert_used — asserts are used as internal invariants in infrastructure code.
# Suppressing B101 reduces noise without compromising security review of real issues.
skips = ["B101"]