-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpyproject.toml
More file actions
449 lines (402 loc) · 12.9 KB
/
pyproject.toml
File metadata and controls
449 lines (402 loc) · 12.9 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
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "generalized-notation-notation"
version = "1.6.0"
description = "A text-based language for standardizing Active Inference generative models"
readme = "README.md"
requires-python = ">=3.11,<3.14"
license = {text = "CC-BY-NC-SA-4.0"}
authors = [
{name = "Active Inference Institute", email = "contact@activeinference.org"}
]
keywords = ["active-inference", "gnn", "cognitive-modeling", "scientific-computing"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Software Development :: Libraries :: Python Modules",
]
# Core dependencies (essential for basic functionality)
dependencies = [
# Core scientific computing (lightweight)
"numpy>=1.21.0",
"matplotlib>=3.5.0",
"networkx>=2.6.0",
"pyyaml>=6.0",
# scipy and scikit-learn moved to ml-ai optional group (all uses are deferred imports)
# System monitoring and utilities
"psutil>=5.8.0",
# HTTP and async communication
"httpx>=0.27.0",
"aiohttp>=3.9.0", # OpenRouter / Perplexity LLM providers
# LLM stack (Step 13+); local Ollama + cloud APIs — defaults in ``llm/defaults.py`` / config
"openai>=1.0.0",
"ollama>=0.1.0",
"python-dotenv>=1.0.0",
# Safe XML parsing (replaces stdlib xml.etree/minidom for untrusted input)
"defusedxml>=0.7.1",
# Active Inference ecosystem — pymdp 1.0.0 is the JAX-first rewrite
# (see doc/pymdp/pymdp_1_0_0_alignment_matrix.md). Step 12 uses the new
# Agent API: list[jax.Array] models, infer_states(empirical_prior=...),
# infer_policies(qs), sample_action(q_pi, rng_key=...).
"inferactively-pymdp>=1.0.0",
"equinox>=0.11.0", # pymdp 1.0.0 Agent is an equinox Module
"multimethod>=1.11", # pymdp 1.0.0 dispatch
# Step 12 execution backends (JAX, NumPyro, PyTorch, DisCoPy) — same pins as optional ``execution-frameworks``
"jax[cpu]>=0.4.0",
"jaxlib>=0.4.0",
"flax>=0.7.0",
"optax>=0.1.0",
"numpyro>=0.14",
"torch>=2.0.0",
"discopy>=1.1.0",
# Interactive visualization (Step 9 advanced viz Plotly dashboards; steps 8/16)
"pandas>=1.3.0",
"plotly>=5.15.0",
"seaborn>=0.12.0",
"h5py>=3.8.0",
# Step 12 bnlearn backend (Bayesian network scripts)
"bnlearn>=0.7.0",
]
# Development dependencies (enhanced for comprehensive development workflow)
[project.optional-dependencies]
dev = [
# aiohttp is a core dependency; listed here only so ``uv sync --extra dev`` stays explicit in lockfiles
"aiohttp>=3.9.0",
# Testing tools (requests used only in test_pipeline_performance.py)
"requests>=2.28.0",
"pytest>=6.0.0",
"pytest-asyncio>=0.23.0",
"pytest-cov>=3.0.0",
"pytest-json-report>=1.5.0",
"pytest-benchmark>=4.0.0",
"pytest-sugar>=0.9.0",
"pytest-timeout>=2.1.0",
"pytest-xdist>=3.0.0",
# Security scanning (dev-only tools; pip-audit via uv tool / CI — avoids legacy safety→nltk chain)
"bandit>=1.7.0",
"bandit-sarif-formatter>=1.1.1",
# Code quality and linting
"isort>=5.12.0",
"black>=26.3.1",
"flake8>=4.0.0",
"mypy>=0.950",
"pre-commit>=3.0.0",
"mypy-extensions>=1.0.0",
"ruff>=0.1.0",
"pylint>=3.0.0",
# Documentation generation
"sphinx>=7.0.0",
"sphinx-rtd-theme>=1.3.0",
"myst-parser>=2.0.0",
# Interactive development
"ipython>=8.0.0",
"ipdb>=0.13.0",
"jupyterlab>=4.0.0",
"jupyter-server>=2.0.0",
"ipywidgets>=8.0.0",
# Performance profiling and debugging
"py-spy>=0.3.0",
"memory-profiler>=0.61.0",
"line-profiler>=4.0.0",
# Development utilities
"rich>=13.0.0",
"typer>=0.9.0",
]
api = [
"fastapi>=0.100.0",
"uvicorn[standard]>=0.23.0",
]
# Optional heavy packages (install separately based on use case requirements)
# JAX-based active inference: GPU-accelerated free energy minimization (step 12 jax renderer)
active-inference = [
"jax[cpu]>=0.4.0",
"jaxlib>=0.4.0",
"flax>=0.7.0",
"optax>=0.1.0",
]
# NumPyro probabilistic programming: Bayesian inference backends (step 12 numpyro renderer)
probabilistic-programming = [
"numpyro>=0.14",
"jax[cpu]>=0.4.0",
"jaxlib>=0.4.0",
]
# Deep learning: PyTorch-based renderers and LLM fine-tuning (step 12 pytorch renderer)
# Also includes scipy/scikit-learn: all uses in the codebase are deferred imports
ml-ai = [
"torch>=2.0.0",
"transformers>=4.25.0",
"scipy>=1.7.0",
"scikit-learn>=1.0.0",
]
# LLM integration — same packages as core dependencies; kept for ``uv sync --extra llm`` compatibility
llm = [
"openai>=1.0.0",
"ollama>=0.1.0",
"python-dotenv>=1.0.0",
"aiohttp>=3.9.0",
]
# Enhanced visualization: interactive plots beyond matplotlib (steps 8, 9, 16).
# Same pins as core ``dependencies``; kept for ``uv sync --extra visualization``.
visualization = [
"pandas>=1.3.0",
"plotly>=5.15.0",
"seaborn>=0.12.0",
"h5py>=3.8.0",
]
# bnlearn (Step 12); also in core — optional alias for explicit sync.
inference = [
"bnlearn>=0.7.0",
]
# Audio synthesis: SAPF/sonification output (step 15)
audio = [
"librosa>=0.10.0",
"soundfile>=0.12.0",
"pedalboard>=0.7.0",
]
# GUI interfaces: Gradio/Streamlit frontends (step 22)
gui = [
"gradio>=6.7.0",
"streamlit>=1.25.0",
]
# Graph/categorical: DisCoPy string diagrams + graph analysis (step 11 discopy renderer)
graphs = [
"graphviz>=0.20.0",
"discopy>=1.1.0",
]
# Step 12 Python backends — also listed in core ``dependencies``; this extra kept for
# ``uv sync --extra execution-frameworks`` / docs compatibility.
execution-frameworks = [
"jax[cpu]>=0.4.0",
"jaxlib>=0.4.0",
"flax>=0.7.0",
"optax>=0.1.0",
"numpyro>=0.14",
"torch>=2.0.0",
"discopy>=1.1.0",
]
# Aspirational/user-facing groups: no core pipeline callers; installed by users
# who extend GNN for their own workflows (notebooks, distributed compute, persistence).
research = [
# NOTE: jupyterlab/jupyter-server duplicate dev group entries intentionally —
# research group targets non-developer end-users who don't install dev extras.
"jupyterlab>=4.0.0",
"jupyter-server>=2.0.0",
"sympy>=1.12.0",
"numba>=0.57.0",
"cython>=3.0.0",
# pymdp-toolbox not available, omitted
]
# Distributed/cloud execution: used by execute/distributed.py (RayDispatcher/Dask) and
# users who run large parameter sweeps on clusters.
scaling = [
"dask>=2023.0.0",
"distributed>=2023.0.0",
"ray>=2.0.0", # distributed execution in execute/distributed.py
]
# All optional dependencies (install everything).
# MAINTAINER NOTE: This list manually duplicates packages from the named
# groups above (active-inference, llm, visualization, audio, gui, etc.).
# When adding a package to any named group, ALSO add it here.
# Ideally this would use `{include-group = "name"}` syntax once supported.
all = [
# Active Inference ecosystem (pymdp already in main deps as 0.0.1)
"jax[cpu]>=0.4.0",
"jaxlib>=0.4.0",
"flax>=0.7.0",
"optax>=0.1.0",
# Machine Learning & AI
"torch>=2.0.0",
"transformers>=4.25.0",
"scipy>=1.7.0",
"scikit-learn>=1.0.0",
# API server
"fastapi>=0.100.0",
"uvicorn[standard]>=0.23.0",
# LLM integration
"openai>=1.0.0",
"ollama>=0.1.0",
"python-dotenv>=1.0.0",
"aiohttp>=3.9.0",
# Visualization and graphics
"pandas>=1.3.0",
"plotly>=5.15.0",
"seaborn>=0.12.0",
"h5py>=3.8.0",
"bnlearn>=0.7.0",
"graphviz>=0.20.0",
"discopy>=1.1.0",
# Audio processing
"librosa>=0.10.0",
"soundfile>=0.12.0",
"pedalboard>=0.7.0",
# GUI and interactive interfaces
"gradio>=6.7.0",
"streamlit>=1.25.0",
# Research and scientific computing
"jupyterlab>=4.0.0",
"jupyter-server>=2.0.0",
"sympy>=1.12.0",
"numba>=0.57.0",
"cython>=3.0.0",
# pymdp-toolbox not available
# Scaling and performance
"dask>=2023.0.0",
"distributed>=2023.0.0",
"ray>=2.0.0",
# Probabilistic programming
"numpyro>=0.14",
]
[project.urls]
Homepage = "https://github.com/ActiveInferenceInstitute/GeneralizedNotationNotation"
Documentation = "https://github.com/ActiveInferenceInstitute/GeneralizedNotationNotation/tree/main/doc"
Repository = "https://github.com/ActiveInferenceInstitute/GeneralizedNotationNotation.git"
Issues = "https://github.com/ActiveInferenceInstitute/GeneralizedNotationNotation/issues"
[project.scripts]
gnn = "src.cli:main"
[tool.hatch.build.targets.wheel]
packages = ["src"]
[tool.black]
line-length = 88
target-version = ['py311']
include = '\.pyi?$'
extend-exclude = '''
/(
# directories
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| build
| dist
)/
'''
[tool.isort]
profile = "black"
multi_line_output = 3
line_length = 88
known_first_party = ["src"]
[tool.mypy]
python_version = "3.11"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_unreachable = true
strict_equality = true
[[tool.mypy.overrides]]
module = [
"jax.*",
"jaxlib.*",
"flax.*",
"optax.*",
"discopy.*",
"pymdp.*",
"torch.*",
"numpyro.*",
]
ignore_missing_imports = true
[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-ra -q --strict-markers --strict-config --durations=20"
testpaths = ["src/tests", "tests"]
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
"unit: marks tests as unit tests",
"uv: UV package manager environment management tests",
"xfail: Tests expected to fail in certain environments (e.g. missing ollama)",
"pipeline: marks tests as full pipeline integration tests (deselect with '-m \"not pipeline\"')",
"mcp: marks MCP audit tests that require module discovery (deselect with '-m \"not mcp\"')",
]
[tool.coverage.run]
source = ["src"]
omit = [
"*/tests/*",
"*/test_*",
"*/__pycache__/*",
"*/venv/*",
"*/.venv/*",
]
[tool.coverage.report]
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",
]
[tool.bandit]
exclude_dirs = ["tests", "src/tests"]
skips = ["B101", "B601"]
[tool.ruff]
target-version = "py311"
line-length = 88
# Lint rules: omit ``W`` (mass whitespace noise) and ``UP`` (pyupgrade churn on a large
# tree). CI runs ``ruff check src/``; keep the set aligned with what the repo can sustain.
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
]
ignore = [
"E501", # line too long, handled by black
"E402", # module import not at top (sys.path bootstrap in orchestrators)
"B008", # do not perform function calls in argument defaults
"C901", # too complex
"B905", # zip without strict= — large legacy surface
# Style / legacy patterns (ruff 0.14+); tighten incrementally
"E701", # multiple statements on one line (colon)
"E702", # multiple statements on one line (semicolon)
"E721", # type comparison
"E731", # lambda assignment
"E741", # ambiguous variable name
"F821", # undefined name (lazy imports, string annotations, template examples)
"F823", # undefined local
"B007", # unused loop control variable
"B904", # raise without from inside except
"C401", # unnecessary generator set
"C403", # unnecessary list comprehension (set)
"C405", # unnecessary literal set
"C408", # unnecessary dict call
"C414", # unnecessary double cast / process
"C416", # unnecessary comprehension
"F811", # redefined while unused
"F401", # unused import (optional deps, import-or-skip probes, test shims)
]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
"src/tests/**" = ["F401"]
# CVE-2026-4539 / Dependabot #63: ReDoS in ``pygments.lexers.archetype`` (AdlLexer).
# PyPI is still at 2.19.2; override with the fix from pygments/pygments#3064 until a release >2.19.2.
# Revisit: drop this block and use ``pygments>=2.19.3`` when available on PyPI.
[tool.uv]
override-dependencies = [
"pygments @ git+https://github.com/zsbahtiar/pygments.git@2be805d86471efb8efd51886d4d11a33fa22a928",
]