snnlab 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. snnlab-0.1.1/.gitignore +11 -0
  2. snnlab-0.1.1/CHANGELOG.md +34 -0
  3. snnlab-0.1.1/LICENSE +21 -0
  4. snnlab-0.1.1/PKG-INFO +76 -0
  5. snnlab-0.1.1/README.md +58 -0
  6. snnlab-0.1.1/VERSIONING.md +86 -0
  7. snnlab-0.1.1/docs/.gitignore +26 -0
  8. snnlab-0.1.1/docs/AGENTS.md +3 -0
  9. snnlab-0.1.1/docs/README.md +59 -0
  10. snnlab-0.1.1/docs/api-coverage.json +752 -0
  11. snnlab-0.1.1/docs/astro.config.mjs +44 -0
  12. snnlab-0.1.1/docs/content/docs/api/index.mdx +16 -0
  13. snnlab-0.1.1/docs/content/docs/api/lang/compiler.mdx +1836 -0
  14. snnlab-0.1.1/docs/content/docs/api/lang/components.mdx +234 -0
  15. snnlab-0.1.1/docs/content/docs/api/lang/core.mdx +1991 -0
  16. snnlab-0.1.1/docs/content/docs/api/lang/diagram.mdx +420 -0
  17. snnlab-0.1.1/docs/content/docs/api/lang/index.mdx +87 -0
  18. snnlab-0.1.1/docs/content/docs/api/lang/meta.json +14 -0
  19. snnlab-0.1.1/docs/content/docs/api/lang/ops.mdx +177 -0
  20. snnlab-0.1.1/docs/content/docs/api/lang/readouts.mdx +381 -0
  21. snnlab-0.1.1/docs/content/docs/api/lang/simulation.mdx +1095 -0
  22. snnlab-0.1.1/docs/content/docs/api/lang/training.mdx +513 -0
  23. snnlab-0.1.1/docs/content/docs/api/meta.json +9 -0
  24. snnlab-0.1.1/docs/content/docs/api/sim/accelerator_forward.mdx +271 -0
  25. snnlab-0.1.1/docs/content/docs/api/sim/bundle.mdx +1114 -0
  26. snnlab-0.1.1/docs/content/docs/api/sim/config.mdx +1199 -0
  27. snnlab-0.1.1/docs/content/docs/api/sim/conformance.mdx +550 -0
  28. snnlab-0.1.1/docs/content/docs/api/sim/datasets.mdx +210 -0
  29. snnlab-0.1.1/docs/content/docs/api/sim/encoders.mdx +162 -0
  30. snnlab-0.1.1/docs/content/docs/api/sim/execution.mdx +6903 -0
  31. snnlab-0.1.1/docs/content/docs/api/sim/index.mdx +58 -0
  32. snnlab-0.1.1/docs/content/docs/api/sim/infer.mdx +1537 -0
  33. snnlab-0.1.1/docs/content/docs/api/sim/inputs.mdx +307 -0
  34. snnlab-0.1.1/docs/content/docs/api/sim/meta.json +24 -0
  35. snnlab-0.1.1/docs/content/docs/api/sim/metrics.mdx +614 -0
  36. snnlab-0.1.1/docs/content/docs/api/sim/models.mdx +2784 -0
  37. snnlab-0.1.1/docs/content/docs/api/sim/profiling.mdx +23 -0
  38. snnlab-0.1.1/docs/content/docs/api/sim/runlog.mdx +1948 -0
  39. snnlab-0.1.1/docs/content/docs/api/sim/scan.mdx +146 -0
  40. snnlab-0.1.1/docs/content/docs/api/sim/simulation_inputs.mdx +252 -0
  41. snnlab-0.1.1/docs/content/docs/api/sim/timing.mdx +224 -0
  42. snnlab-0.1.1/docs/content/docs/api/sim/tool.mdx +718 -0
  43. snnlab-0.1.1/docs/content/docs/api/sim/train.mdx +1507 -0
  44. snnlab-0.1.1/docs/content/docs/api/viz/animation.mdx +280 -0
  45. snnlab-0.1.1/docs/content/docs/api/viz/contracts.mdx +224 -0
  46. snnlab-0.1.1/docs/content/docs/api/viz/diagrams.mdx +560 -0
  47. snnlab-0.1.1/docs/content/docs/api/viz/figure_grid.mdx +1026 -0
  48. snnlab-0.1.1/docs/content/docs/api/viz/index.mdx +62 -0
  49. snnlab-0.1.1/docs/content/docs/api/viz/layouts.mdx +76 -0
  50. snnlab-0.1.1/docs/content/docs/api/viz/loaders.mdx +104 -0
  51. snnlab-0.1.1/docs/content/docs/api/viz/meta.json +15 -0
  52. snnlab-0.1.1/docs/content/docs/api/viz/scene.mdx +287 -0
  53. snnlab-0.1.1/docs/content/docs/api/viz/styles.mdx +237 -0
  54. snnlab-0.1.1/docs/content/docs/api/viz/transforms.mdx +183 -0
  55. snnlab-0.1.1/docs/content/docs/authoring.mdx +56 -0
  56. snnlab-0.1.1/docs/content/docs/contracts.mdx +47 -0
  57. snnlab-0.1.1/docs/content/docs/development.mdx +67 -0
  58. snnlab-0.1.1/docs/content/docs/examples/build_bundle.mdx +86 -0
  59. snnlab-0.1.1/docs/content/docs/examples/index.mdx +34 -0
  60. snnlab-0.1.1/docs/content/docs/examples/meta.json +12 -0
  61. snnlab-0.1.1/docs/content/docs/examples/plot_recording.mdx +132 -0
  62. snnlab-0.1.1/docs/content/docs/examples/poisson_circuit.mdx +102 -0
  63. snnlab-0.1.1/docs/content/docs/examples/replay_inputs.mdx +106 -0
  64. snnlab-0.1.1/docs/content/docs/examples/resume_training.mdx +125 -0
  65. snnlab-0.1.1/docs/content/docs/examples/train_readout.mdx +119 -0
  66. snnlab-0.1.1/docs/content/docs/index.mdx +28 -0
  67. snnlab-0.1.1/docs/content/docs/installation.mdx +52 -0
  68. snnlab-0.1.1/docs/content/docs/meta.json +16 -0
  69. snnlab-0.1.1/docs/content/docs/quickstart.mdx +80 -0
  70. snnlab-0.1.1/docs/content/docs/simulation.mdx +54 -0
  71. snnlab-0.1.1/docs/content/docs/training.mdx +41 -0
  72. snnlab-0.1.1/docs/content/docs/visualisation.mdx +52 -0
  73. snnlab-0.1.1/docs/package-lock.json +8601 -0
  74. snnlab-0.1.1/docs/package.json +42 -0
  75. snnlab-0.1.1/docs/public/_redirects +3 -0
  76. snnlab-0.1.1/docs/public/examples/build_bundle.py +41 -0
  77. snnlab-0.1.1/docs/public/examples/plot_recording.py +85 -0
  78. snnlab-0.1.1/docs/public/examples/poisson_circuit.py +57 -0
  79. snnlab-0.1.1/docs/public/examples/recording.png +0 -0
  80. snnlab-0.1.1/docs/public/examples/replay_inputs.py +61 -0
  81. snnlab-0.1.1/docs/public/examples/resume_training.py +80 -0
  82. snnlab-0.1.1/docs/public/examples/train_readout.py +73 -0
  83. snnlab-0.1.1/docs/scripts/api_notes.json +121 -0
  84. snnlab-0.1.1/docs/scripts/check_examples.py +23 -0
  85. snnlab-0.1.1/docs/scripts/example_notes.json +57 -0
  86. snnlab-0.1.1/docs/scripts/generate_api.py +697 -0
  87. snnlab-0.1.1/docs/scripts/generate_examples.py +96 -0
  88. snnlab-0.1.1/docs/src/components/Docs.tsx +25 -0
  89. snnlab-0.1.1/docs/src/content.config.ts +14 -0
  90. snnlab-0.1.1/docs/src/lib/source.ts +25 -0
  91. snnlab-0.1.1/docs/src/pages/404.astro +6 -0
  92. snnlab-0.1.1/docs/src/pages/[...slug].astro +63 -0
  93. snnlab-0.1.1/docs/src/pages/api/search.ts +5 -0
  94. snnlab-0.1.1/docs/src/pages/llms-full.txt.ts +2 -0
  95. snnlab-0.1.1/docs/src/pages/llms.mdx/docs/[...slug].ts +11 -0
  96. snnlab-0.1.1/docs/src/pages/llms.txt.ts +2 -0
  97. snnlab-0.1.1/docs/src/pages/og/docs/[...slug].ts +29 -0
  98. snnlab-0.1.1/docs/src/styles/global.css +15 -0
  99. snnlab-0.1.1/docs/tsconfig.json +18 -0
  100. snnlab-0.1.1/docs/wrangler.jsonc +16 -0
  101. snnlab-0.1.1/examples/README.md +27 -0
  102. snnlab-0.1.1/examples/build_bundle.py +41 -0
  103. snnlab-0.1.1/examples/plot_recording.py +85 -0
  104. snnlab-0.1.1/examples/poisson_circuit.py +57 -0
  105. snnlab-0.1.1/examples/replay_inputs.py +61 -0
  106. snnlab-0.1.1/examples/resume_training.py +80 -0
  107. snnlab-0.1.1/examples/train_readout.py +73 -0
  108. snnlab-0.1.1/pyproject.toml +55 -0
  109. snnlab-0.1.1/scripts/version.py +140 -0
  110. snnlab-0.1.1/src/snnlab/__init__.py +6 -0
  111. snnlab-0.1.1/src/snnlab/lang/README.md +385 -0
  112. snnlab-0.1.1/src/snnlab/lang/__init__.py +99 -0
  113. snnlab-0.1.1/src/snnlab/lang/_version.py +3 -0
  114. snnlab-0.1.1/src/snnlab/lang/compiler.py +1289 -0
  115. snnlab-0.1.1/src/snnlab/lang/components.py +153 -0
  116. snnlab-0.1.1/src/snnlab/lang/core.py +458 -0
  117. snnlab-0.1.1/src/snnlab/lang/diagram.py +371 -0
  118. snnlab-0.1.1/src/snnlab/lang/examples/__init__.py +1 -0
  119. snnlab-0.1.1/src/snnlab/lang/examples/build_examples.py +148 -0
  120. snnlab-0.1.1/src/snnlab/lang/ops.py +64 -0
  121. snnlab-0.1.1/src/snnlab/lang/readouts.py +128 -0
  122. snnlab-0.1.1/src/snnlab/lang/schemas/snn-graph-v1.schema.json +25 -0
  123. snnlab-0.1.1/src/snnlab/lang/schemas/snn-training-v1.schema.json +15 -0
  124. snnlab-0.1.1/src/snnlab/lang/simulation.py +312 -0
  125. snnlab-0.1.1/src/snnlab/lang/training.py +107 -0
  126. snnlab-0.1.1/src/snnlab/sim/__init__.py +5 -0
  127. snnlab-0.1.1/src/snnlab/sim/__main__.py +6 -0
  128. snnlab-0.1.1/src/snnlab/sim/_version.py +3 -0
  129. snnlab-0.1.1/src/snnlab/sim/accelerator_forward.py +283 -0
  130. snnlab-0.1.1/src/snnlab/sim/bundle.py +757 -0
  131. snnlab-0.1.1/src/snnlab/sim/config.py +844 -0
  132. snnlab-0.1.1/src/snnlab/sim/conformance.py +215 -0
  133. snnlab-0.1.1/src/snnlab/sim/datasets.py +211 -0
  134. snnlab-0.1.1/src/snnlab/sim/encoders.py +59 -0
  135. snnlab-0.1.1/src/snnlab/sim/execution.py +4036 -0
  136. snnlab-0.1.1/src/snnlab/sim/infer.py +1336 -0
  137. snnlab-0.1.1/src/snnlab/sim/inputs.py +128 -0
  138. snnlab-0.1.1/src/snnlab/sim/metrics.py +298 -0
  139. snnlab-0.1.1/src/snnlab/sim/models.py +1664 -0
  140. snnlab-0.1.1/src/snnlab/sim/profiling.py +73 -0
  141. snnlab-0.1.1/src/snnlab/sim/runlog.py +843 -0
  142. snnlab-0.1.1/src/snnlab/sim/scan.py +83 -0
  143. snnlab-0.1.1/src/snnlab/sim/simulation_inputs.py +265 -0
  144. snnlab-0.1.1/src/snnlab/sim/timing.py +81 -0
  145. snnlab-0.1.1/src/snnlab/sim/tool.py +2494 -0
  146. snnlab-0.1.1/src/snnlab/sim/train.py +1338 -0
  147. snnlab-0.1.1/src/snnlab/viz/README.md +287 -0
  148. snnlab-0.1.1/src/snnlab/viz/__init__.py +21 -0
  149. snnlab-0.1.1/src/snnlab/viz/_version.py +3 -0
  150. snnlab-0.1.1/src/snnlab/viz/animation.py +68 -0
  151. snnlab-0.1.1/src/snnlab/viz/contracts.py +58 -0
  152. snnlab-0.1.1/src/snnlab/viz/diagrams.py +329 -0
  153. snnlab-0.1.1/src/snnlab/viz/figure_grid.py +319 -0
  154. snnlab-0.1.1/src/snnlab/viz/layouts.py +25 -0
  155. snnlab-0.1.1/src/snnlab/viz/loaders.py +59 -0
  156. snnlab-0.1.1/src/snnlab/viz/scene.py +65 -0
  157. snnlab-0.1.1/src/snnlab/viz/styles.py +76 -0
  158. snnlab-0.1.1/src/snnlab/viz/transforms.py +60 -0
  159. snnlab-0.1.1/tests/__init__.py +0 -0
  160. snnlab-0.1.1/tests/lang/__init__.py +0 -0
  161. snnlab-0.1.1/tests/lang/test_snnlang.py +724 -0
  162. snnlab-0.1.1/tests/sim/README.md +29 -0
  163. snnlab-0.1.1/tests/sim/__init__.py +0 -0
  164. snnlab-0.1.1/tests/sim/_execution_builders.py +116 -0
  165. snnlab-0.1.1/tests/sim/conftest.py +46 -0
  166. snnlab-0.1.1/tests/sim/test_accelerator_forward.py +23 -0
  167. snnlab-0.1.1/tests/sim/test_artifacts_schema.py +151 -0
  168. snnlab-0.1.1/tests/sim/test_brian2_conformance.py +766 -0
  169. snnlab-0.1.1/tests/sim/test_bundle.py +688 -0
  170. snnlab-0.1.1/tests/sim/test_cli_coverage.py +618 -0
  171. snnlab-0.1.1/tests/sim/test_cli_helpers.py +139 -0
  172. snnlab-0.1.1/tests/sim/test_config.py +21 -0
  173. snnlab-0.1.1/tests/sim/test_config_coverage.py +434 -0
  174. snnlab-0.1.1/tests/sim/test_datasets_coverage.py +52 -0
  175. snnlab-0.1.1/tests/sim/test_execution_artifacts.py +140 -0
  176. snnlab-0.1.1/tests/sim/test_execution_checkpoints.py +344 -0
  177. snnlab-0.1.1/tests/sim/test_execution_cli.py +299 -0
  178. snnlab-0.1.1/tests/sim/test_execution_coba_threshold.py +42 -0
  179. snnlab-0.1.1/tests/sim/test_execution_datasets.py +237 -0
  180. snnlab-0.1.1/tests/sim/test_execution_dense_inputs.py +207 -0
  181. snnlab-0.1.1/tests/sim/test_execution_dynamics.py +217 -0
  182. snnlab-0.1.1/tests/sim/test_execution_event_inputs.py +274 -0
  183. snnlab-0.1.1/tests/sim/test_execution_inference.py +314 -0
  184. snnlab-0.1.1/tests/sim/test_execution_readouts.py +141 -0
  185. snnlab-0.1.1/tests/sim/test_execution_runtime_state.py +385 -0
  186. snnlab-0.1.1/tests/sim/test_execution_spiking_readout.py +95 -0
  187. snnlab-0.1.1/tests/sim/test_execution_targets.py +177 -0
  188. snnlab-0.1.1/tests/sim/test_execution_training.py +230 -0
  189. snnlab-0.1.1/tests/sim/test_firing_rate_penalty.py +65 -0
  190. snnlab-0.1.1/tests/sim/test_flag_propagation.py +633 -0
  191. snnlab-0.1.1/tests/sim/test_forward_pass.py +115 -0
  192. snnlab-0.1.1/tests/sim/test_infer_coverage.py +758 -0
  193. snnlab-0.1.1/tests/sim/test_infer_integration.py +650 -0
  194. snnlab-0.1.1/tests/sim/test_init_lif_state.py +41 -0
  195. snnlab-0.1.1/tests/sim/test_inputs.py +117 -0
  196. snnlab-0.1.1/tests/sim/test_inputs_coverage.py +75 -0
  197. snnlab-0.1.1/tests/sim/test_lif.py +124 -0
  198. snnlab-0.1.1/tests/sim/test_lif_conductance.py +125 -0
  199. snnlab-0.1.1/tests/sim/test_lif_contract.py +150 -0
  200. snnlab-0.1.1/tests/sim/test_lif_gradients.py +125 -0
  201. snnlab-0.1.1/tests/sim/test_lif_membrane.py +156 -0
  202. snnlab-0.1.1/tests/sim/test_lif_noise.py +151 -0
  203. snnlab-0.1.1/tests/sim/test_lif_spiking.py +178 -0
  204. snnlab-0.1.1/tests/sim/test_metrics_runlog_coverage.py +37 -0
  205. snnlab-0.1.1/tests/sim/test_mode_drift.py +209 -0
  206. snnlab-0.1.1/tests/sim/test_models.py +636 -0
  207. snnlab-0.1.1/tests/sim/test_numeric_conformance.py +581 -0
  208. snnlab-0.1.1/tests/sim/test_perturbation_counts.py +48 -0
  209. snnlab-0.1.1/tests/sim/test_refractory_cli.py +140 -0
  210. snnlab-0.1.1/tests/sim/test_refractory_compiled.py +107 -0
  211. snnlab-0.1.1/tests/sim/test_refractory_runtime.py +141 -0
  212. snnlab-0.1.1/tests/sim/test_rhythmicity.py +145 -0
  213. snnlab-0.1.1/tests/sim/test_run_log.py +188 -0
  214. snnlab-0.1.1/tests/sim/test_smoke.py +59 -0
  215. snnlab-0.1.1/tests/sim/test_timing.py +80 -0
  216. snnlab-0.1.1/tests/sim/test_train_integration.py +734 -0
  217. snnlab-0.1.1/tests/test_versioning.py +81 -0
  218. snnlab-0.1.1/tests/viz/__init__.py +1 -0
  219. snnlab-0.1.1/tests/viz/test_snnviz.py +268 -0
  220. snnlab-0.1.1/uv.lock +2506 -0
@@ -0,0 +1,11 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.py[cod]
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ .coverage
7
+ dist/
8
+ artifacts/
9
+ temp/
10
+ src/snnlab/lang/examples/generated/
11
+ examples/generated/
@@ -0,0 +1,34 @@
1
+ # Changelog
2
+
3
+ Changes to the combined snnlab Python distribution are recorded here. Package
4
+ versions follow the policy in [VERSIONING.md](VERSIONING.md). Component and
5
+ serialized-schema versions identify separate compatibility contracts.
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.1] - 2026-10-04
10
+
11
+ ### Added
12
+
13
+ 1. Static Fumadocs documentation with KaTeX, search, GitHub Pages and Cloudflare hosting.
14
+ 2. Complete source-derived API references for `lang`, `sim` and `viz`, with automated drift checks.
15
+ 3. Six runnable general examples for bundles, simulation, input replay, training, checkpoint resume and retained-signal plotting.
16
+ 4. A changelog, single-source package version and release preparation/check helper.
17
+ 5. Automatic PyPI publishing on version-source changes to `main`, using Trusted Publishing and release tags after package checks pass.
18
+
19
+ ### Changed
20
+
21
+ 1. The documentation opens at the site root; previous `/docs/` paths redirect there.
22
+ 2. Documentation builds use Astro static output with Fumadocs React islands in place of Next.js.
23
+ 3. Package builds read the runtime version directly, and source archives exclude local documentation dependencies, caches and generated output.
24
+
25
+ ## [0.1.0] - 2026-10-03
26
+
27
+ ### Added
28
+
29
+ 1. Initial combined Python distribution extracted from Pinglab, exposing `snnlab.lang`, `snnlab.sim` and `snnlab.viz`.
30
+ 2. Portable graph authoring and validated bundles, graph-native and legacy execution, surrogate-gradient training, retained artifacts and visualization utilities.
31
+ 3. Portable tests and package checks, retaining existing numerical defaults, schemas and backend identifiers.
32
+
33
+ The historical baseline is Git tag `v0.1.0`. Changes above it remain unreleased
34
+ until a subsequent version is prepared and tagged.
snnlab-0.1.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Eoin Murray
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
snnlab-0.1.1/PKG-INFO ADDED
@@ -0,0 +1,76 @@
1
+ Metadata-Version: 2.5
2
+ Name: snnlab
3
+ Version: 0.1.1
4
+ Summary: Author, simulate and visualise conductance-based spiking neural networks.
5
+ Project-URL: Repository, https://github.com/eoinmurray/snnlab
6
+ Author: Eoin Murray
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Requires-Python: >=3.10
10
+ Requires-Dist: h5py>=3.16.0
11
+ Requires-Dist: matplotlib>=3.10.8
12
+ Requires-Dist: numpy>=2.2.6
13
+ Requires-Dist: scikit-learn>=1.7.2
14
+ Requires-Dist: scipy>=1.15.3
15
+ Requires-Dist: torch>=2.10.0
16
+ Requires-Dist: torchvision>=0.25.0
17
+ Description-Content-Type: text/markdown
18
+
19
+ # snnlab
20
+
21
+ A Python library for authoring, simulating and visualising conductance-based spiking neural networks.
22
+
23
+ ```sh
24
+ uv add git+https://github.com/eoinmurray/snnlab
25
+ ```
26
+
27
+ ```python
28
+ from snnlab import lang, sim, viz
29
+ ```
30
+
31
+ 1. `snnlab.lang` authors and validates deterministic graph bundles.
32
+ 2. `snnlab.sim` executes graphs and supports surrogate-gradient training.
33
+ 3. `snnlab.viz` renders recordings, diagrams, figures and animations.
34
+
35
+ The simulator currently supports COBA-LIF and leaky-integrator graph populations, AMPA/GABA projections, recurrent/feedback connections and integer-timestep delays. It is not an arbitrary-equation simulator.
36
+
37
+ ## Simulator commands
38
+
39
+ ```sh
40
+ uv run snnsim --help
41
+ uv run python -m snnlab.sim sim --help
42
+ uv run python -m snnlab.lang.examples.build_examples
43
+ ```
44
+
45
+ Graphviz (`dot`) is required for diagram exports. FFmpeg is required for video exports. Install these separately through your operating system package manager. Core authoring and simulation do not require either executable.
46
+
47
+ ## Development
48
+
49
+ ```sh
50
+ uv sync --dev
51
+ uv run pytest -m "not slow"
52
+ ```
53
+
54
+ For development in Pinglab, use `uv add --editable ../snnlab`. For reproducible runs, use a Git tag or commit and commit the consumer lockfile.
55
+
56
+ ## Documentation
57
+
58
+ The Fumadocs site lives in [`docs/`](docs/README.md), with guides for authoring, simulation, training, visualisation, and scientific contracts.
59
+
60
+ ```sh
61
+ cd docs
62
+ npm ci
63
+ npm run dev
64
+ ```
65
+
66
+ ## Compatibility
67
+
68
+ Release history is recorded in [CHANGELOG.md](CHANGELOG.md). See
69
+ [VERSIONING.md](VERSIONING.md) for the version policy, release preparation and
70
+ tagging workflow. Check release metadata with `uv run python scripts/version.py check`.
71
+
72
+ This initial extraction retains the existing bundle schemas, backend target `tools/snnsim`, component format versions and numerical defaults. Those strings identify persisted scientific contracts; they are not Python import paths. Package version 0.1.0 identifies the combined distribution.
73
+
74
+ The retained-data regression against historical Pinglab runs remains in Pinglab. The portable tests live here. No scientific runs or generated example bundles are shipped.
75
+
76
+ MIT licensed.
snnlab-0.1.1/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # snnlab
2
+
3
+ A Python library for authoring, simulating and visualising conductance-based spiking neural networks.
4
+
5
+ ```sh
6
+ uv add git+https://github.com/eoinmurray/snnlab
7
+ ```
8
+
9
+ ```python
10
+ from snnlab import lang, sim, viz
11
+ ```
12
+
13
+ 1. `snnlab.lang` authors and validates deterministic graph bundles.
14
+ 2. `snnlab.sim` executes graphs and supports surrogate-gradient training.
15
+ 3. `snnlab.viz` renders recordings, diagrams, figures and animations.
16
+
17
+ The simulator currently supports COBA-LIF and leaky-integrator graph populations, AMPA/GABA projections, recurrent/feedback connections and integer-timestep delays. It is not an arbitrary-equation simulator.
18
+
19
+ ## Simulator commands
20
+
21
+ ```sh
22
+ uv run snnsim --help
23
+ uv run python -m snnlab.sim sim --help
24
+ uv run python -m snnlab.lang.examples.build_examples
25
+ ```
26
+
27
+ Graphviz (`dot`) is required for diagram exports. FFmpeg is required for video exports. Install these separately through your operating system package manager. Core authoring and simulation do not require either executable.
28
+
29
+ ## Development
30
+
31
+ ```sh
32
+ uv sync --dev
33
+ uv run pytest -m "not slow"
34
+ ```
35
+
36
+ For development in Pinglab, use `uv add --editable ../snnlab`. For reproducible runs, use a Git tag or commit and commit the consumer lockfile.
37
+
38
+ ## Documentation
39
+
40
+ The Fumadocs site lives in [`docs/`](docs/README.md), with guides for authoring, simulation, training, visualisation, and scientific contracts.
41
+
42
+ ```sh
43
+ cd docs
44
+ npm ci
45
+ npm run dev
46
+ ```
47
+
48
+ ## Compatibility
49
+
50
+ Release history is recorded in [CHANGELOG.md](CHANGELOG.md). See
51
+ [VERSIONING.md](VERSIONING.md) for the version policy, release preparation and
52
+ tagging workflow. Check release metadata with `uv run python scripts/version.py check`.
53
+
54
+ This initial extraction retains the existing bundle schemas, backend target `tools/snnsim`, component format versions and numerical defaults. Those strings identify persisted scientific contracts; they are not Python import paths. Package version 0.1.0 identifies the combined distribution.
55
+
56
+ The retained-data regression against historical Pinglab runs remains in Pinglab. The portable tests live here. No scientific runs or generated example bundles are shipped.
57
+
58
+ MIT licensed.
@@ -0,0 +1,86 @@
1
+ # Versioning and releases
2
+
3
+ The combined Python package uses `MAJOR.MINOR.PATCH` versions, following
4
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html). The current version
5
+ has one source: `__version__` in `src/snnlab/__init__.py`.
6
+ [Hatchling reads that file](https://hatch.pypa.io/latest/version/) to build package
7
+ metadata; do not add a second version literal to `pyproject.toml`.
8
+
9
+ ## Choosing a version
10
+
11
+ 1. Patch: backward-compatible corrections, including documentation and packaging fixes.
12
+ 2. Minor: new public functionality. Before 1.0, incompatible API or numerical-contract changes also require a minor bump and explicit migration notes.
13
+ 3. Major: after 1.0, incompatible public API, persisted-data or numerical-contract changes. Release 1.0 when the supported public contract is ready to be stable.
14
+
15
+ Scientific compatibility includes units, timing, initialization, numerical
16
+ defaults, checkpoint authentication and retained-data interpretation. Describe
17
+ changes to these contracts explicitly in the changelog; a version bump alone
18
+ does not explain their effect or establish numerical equivalence.
19
+
20
+ ## Package, component and schema identities
21
+
22
+ 1. `snnlab.__version__` identifies the installable distribution and matches Git tags such as `v0.1.0`.
23
+ 2. `snnlab.lang.__version__`, `snnlab.sim.__version__` and `snnlab.viz.__version__` are retained component compatibility identities. Change them deliberately when their owning contract changes; a package bump does not automatically bump them.
24
+ 3. Serialized schema strings and `tools/snnsim` identify persisted scientific contracts. Change their versions only with a corresponding schema migration or explicit compatibility policy.
25
+ 4. The docs npm package is tooling for the website. Its version does not identify a Python or scientific release.
26
+
27
+ ## Prepare a release
28
+
29
+ Use Python 3.12 for the repository tools. Add user-facing changes beneath
30
+ `## [Unreleased]` in `CHANGELOG.md` while developing. Existing released sections
31
+ should remain a historical record.
32
+
33
+ ```sh
34
+ uv run python scripts/version.py check
35
+ uv run python scripts/version.py bump patch --dry-run
36
+ uv run python scripts/version.py bump patch
37
+ uv lock --check
38
+ uv run python scripts/version.py check
39
+ uv run ruff check .
40
+ uv run pytest -q -m "not slow"
41
+ uv run python docs/scripts/check_examples.py
42
+ uv build
43
+ ```
44
+
45
+ The bump helper accepts `patch`, `minor` or `major`. It updates the package
46
+ version, moves the current Unreleased notes
47
+ into a dated section, and creates an empty Unreleased section for subsequent
48
+ work. It refuses an empty release or inconsistent starting metadata. It does
49
+ not commit, tag, push or publish. The editable package record in `uv.lock` has
50
+ no version literal because its version is dynamic; version bumps do not
51
+ change dependency pins. Use `--date YYYY-MM-DD` to supply the release
52
+ date explicitly; otherwise it uses the local calendar date.
53
+
54
+ Review the generated diff before committing. For example, after preparing
55
+ version `0.1.1`:
56
+
57
+ ```sh
58
+ git add src/snnlab/__init__.py CHANGELOG.md
59
+ git commit -m "Release 0.1.1"
60
+ git push origin main
61
+ ```
62
+
63
+ Replace the example version with the actual prepared version. A push to `main`
64
+ that changes `src/snnlab/__init__.py` triggers `.github/workflows/publish.yml`,
65
+ following Demolab's version-triggered release pattern. It runs package checks,
66
+ builds the wheel and source archive, publishes to PyPI using Trusted Publishing,
67
+ then creates `v<VERSION>`. Forks and manual runs on other branches cannot publish.
68
+ The Actions **Run workflow** button can retry or backfill the current version;
69
+ existing PyPI files and release tags are skipped on reruns. Never move or reuse
70
+ a release tag for a different version. Git tags also support pinned installations:
71
+
72
+ ```sh
73
+ uv add git+https://github.com/eoinmurray/snnlab@v0.1.0
74
+ ```
75
+
76
+ ## One-time publishing setup
77
+
78
+ 1. Create the GitHub environment `pypi` in `eoinmurray/snnlab`.
79
+ 2. In PyPI, register a Trusted Publisher for project `snnlab`: owner
80
+ `eoinmurray`, repository `snnlab`, workflow `publish.yml`, environment `pypi`.
81
+ If the project does not yet exist, use a pending publisher under account
82
+ **Publishing**. If it already exists and you maintain it, use the project's
83
+ **Publishing** settings. See the [PyPI Trusted Publishing documentation](https://docs.pypi.org/trusted-publishers/).
84
+ 3. Once registered, future version changes on `main` publish automatically.
85
+ No stored PyPI API token is required. This workflow creates a Git tag, but
86
+ does not create a GitHub Release.
@@ -0,0 +1,26 @@
1
+ # deps
2
+ /node_modules
3
+
4
+ # generated content
5
+
6
+ # test & build
7
+ /coverage
8
+ /.astro/
9
+ /out/
10
+ /build
11
+ *.tsbuildinfo
12
+
13
+ # misc
14
+ .DS_Store
15
+ *.pem
16
+ /.pnp
17
+ .pnp.js
18
+ npm-debug.log*
19
+ yarn-debug.log*
20
+ yarn-error.log*
21
+
22
+ # others
23
+ .env*.local
24
+ .vercel
25
+ next-env.d.ts
26
+ .wrangler/
@@ -0,0 +1,3 @@
1
+ # Documentation site
2
+
3
+ This site uses Astro static output with Fumadocs React islands. Keep `output: static`, preserve the root documentation routes, and verify both root and GitHub Pages base-path builds. Content and metadata live in `content/docs`; API and example generators remain the source of generated pages. Run `npm run types:check` and `npm run build` after site changes.
@@ -0,0 +1,59 @@
1
+ # snnlab documentation
2
+
3
+ Fumadocs + Astro static documentation with KaTeX and browser-side search. Requires Node.js 22.12 or newer.
4
+
5
+ ```sh
6
+ npm ci
7
+ npm run dev
8
+ ```
9
+
10
+ The documentation overview opens at `/`; guides use paths such as `/quickstart/`. Cloudflare redirects previous `/docs/` links to the new paths.
11
+
12
+ Author pages in `content/docs/` and order them in `content/docs/meta.json`.
13
+
14
+ ```sh
15
+ npm run types:check
16
+ npm run build
17
+ npm run preview
18
+ ```
19
+
20
+ The build exports plain HTML, CSS, JavaScript, search data, and KaTeX fonts into `out/`. Astro uses `output: static`; no application server is needed. Markdown downloads use explicit `/llms.mdx/docs/.../content.md` routes; runtime content-negotiation rewrites are unavailable on static hosts.
21
+
22
+ ## GitHub Pages
23
+
24
+ `.github/workflows/docs.yml` checks and builds docs on pull requests and deploys `main` through GitHub Pages Actions. The GitHub build sets `SITE_BASE_PATH=/snnlab` and `SITE_URL=https://eoinmurray.github.io/snnlab/`.
25
+
26
+ ## Cloudflare
27
+
28
+ `wrangler.jsonc` deploys the root-path static export as Workers Static Assets at `ssnlab.eoinmurray.info`. An authenticated Wrangler installation is required.
29
+
30
+ ```sh
31
+ SITE_URL=https://ssnlab.eoinmurray.info npm run deploy:cloudflare
32
+ ```
33
+
34
+ Cloudflare deployments are manual through Wrangler. GitHub Pages updates automatically from `main`. Never deploy a build made with `/snnlab` as its base path to the custom-domain root.
35
+
36
+ `astro.config.mjs` configures remark-math and rehype-katex. Commit `package-lock.json`; `.astro/`, `out/`, and `node_modules/` are generated and ignored.
37
+
38
+ ## API references
39
+
40
+ Reference pages under `content/docs/api/` are generated from all non-private Python modules in `lang`, `sim`, and `viz`. They cover package exports, module-owned functions/classes/constants, public class members, constructor fields, return expressions, explicit exceptions and full implementation panels. Third-party inherited APIs and private helpers are excluded.
41
+
42
+ ```sh
43
+ python3.12 docs/scripts/generate_api.py
44
+ python3.12 docs/scripts/generate_api.py --check
45
+ ```
46
+
47
+ Run these commands from the repository root with Python 3.12 (the CI-pinned generator version). Edit explanatory contracts in `docs/scripts/api_notes.json`, then regenerate. The generator uses the Python AST without importing simulators, invoking training, or downloading datasets. `api-coverage.json` records the covered inventory. CI checks drift and rebuilds docs when source changes.
48
+
49
+ ## General examples
50
+
51
+ Standalone Python scripts live in the repository's `examples/` directory. Their complete-code pages and downloadable copies are generated by `scripts/generate_examples.py`. Edit the scripts and `scripts/example_notes.json`, then run these commands from the repository root:
52
+
53
+ ```sh
54
+ python3 docs/scripts/generate_examples.py
55
+ python3 docs/scripts/generate_examples.py --check
56
+ uv run python docs/scripts/check_examples.py
57
+ ```
58
+
59
+ The last command executes every example in a temporary directory. Package CI runs it, and docs CI checks that pages and downloads match the scripts. The retained-signal preview is produced by `examples/plot_recording.py`; after intentional plotting changes, rerun the example, inspect `artifacts/examples/plot_recording/recording.png`, and copy it to `docs/public/examples/recording.png`.