spikeforge-io 0.1.0__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.
@@ -0,0 +1,30 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2018 Capsize LLC
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.4
2
+ Name: spikeforge-io
3
+ Version: 0.1.0
4
+ Summary: Recorded-stream I/O adapters and the windowing surface for spikeforge.
5
+ Author-email: Capsize LLC <contact@capsizegames.com>
6
+ Maintainer-email: Capsize LLC <contact@capsizegames.com>
7
+ License-Expression: BSD-3-Clause
8
+ Project-URL: Homepage, https://github.com/capsize-games/spikeforge
9
+ Project-URL: Repository, https://github.com/capsize-games/spikeforge
10
+ Keywords: spiking neural networks,streaming,io,adapters,windowing
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: spikeforge~=0.3.0
25
+ Requires-Dist: torch>=2.5
26
+ Requires-Dist: numpy>=1.26
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.0; extra == "dev"
29
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
30
+ Requires-Dist: ruff>=0.0.280; extra == "dev"
31
+ Dynamic: license-file
32
+
33
+ # spikeforge
34
+
35
+ [![CI](https://github.com/capsize-games/spikeforge/actions/workflows/ci.yml/badge.svg)](https://github.com/capsize-games/spikeforge/actions/workflows/ci.yml)
36
+ [![Status: pre-1.0](https://img.shields.io/badge/status-pre--1.0-orange.svg)](OPEN_SOURCE_CHECKLIST.md)
37
+ [![License: BSD-3-Clause](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](LICENSE)
38
+ [![Python 3.10–3.13](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-3776AB.svg)](https://www.python.org/downloads/)
39
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
40
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/capsize-games/spikeforge/blob/main/CONTRIBUTING.md)
41
+ [![Docs](https://img.shields.io/badge/docs-long--form%20reference-blue.svg)](documentation/README.md)
42
+
43
+ A spiking-neural-network (SNN) toolkit built on
44
+ [snnTorch](https://snntorch.readthedocs.io/) and PyTorch. Loads MNIST-style
45
+ and neuromorphic event datasets, encodes them into rate, latency, delta, and
46
+ random spikes, and trains, validates, exports, and deploys LIF networks —
47
+ with a live browser dashboard served over WebSockets.
48
+
49
+ > **Pre-1.0 and unpublished.** `install.sh` is the supported path today;
50
+ > PyPI ships once the distributions are published. Before trusting any
51
+ > number this produces, read
52
+ > [Implications and boundaries](documentation/implications-and-boundaries.md).
53
+
54
+ ## Quickstart
55
+
56
+ ```bash
57
+ git clone https://github.com/capsize-games/spikeforge.git
58
+ cd spikeforge
59
+ docker compose up --build
60
+ ```
61
+
62
+ Open <http://localhost:8877> — the dashboard connects to the WebSocket on
63
+ the same host and port. No separate backend or proxy to run.
64
+
65
+ Prefer a local install, a headless example, or the CLI tools instead? See
66
+ [Usage](documentation/usage.md) and [Quickstart](documentation/quickstart.md)
67
+ for every path (`./install.sh`, local dev with Vite, `examples/`, and the
68
+ eight `spikeforge-*` console scripts).
69
+
70
+ ## Features
71
+
72
+ - **Encoding** — rate, latency, delta, and random spike coders.
73
+ - **Training** — fully-connected and convolutional LIF networks with
74
+ surrogate-gradient cross-entropy, checkpointing, and opt-in AMP / gradient
75
+ checkpointing / truncated BPTT / multi-GPU.
76
+ - **Topologies** — `fc_legacy`, `fc_small`, `conv_net`, `recurrent_net`, plus
77
+ the sequence presets `sequence_mlp` and `sequence_attn`.
78
+ - **Datasets** — MNIST, Fashion-MNIST, KMNIST, QMNIST, USPS, EMNIST,
79
+ CIFAR-10, and (via the `events` extra) N-MNIST, DVS128 Gesture,
80
+ CIFAR10-DVS, and Spiking Speech Commands.
81
+ - **Interpreter spine** — NIR export, an independent NIR interpreter, and
82
+ numerical drift validation.
83
+ - **Introspection** — educational-mode `U[t]`/`I[t]`/`S[t]` traces,
84
+ trajectory metrics, and surrogate-derivative curves.
85
+ - **Deployment** — a capability matrix, weight quantization, energy
86
+ accounting, and executable `reference`, `norse`, and `lava_loihi2`
87
+ backends.
88
+ - **Model hub** — a curated, offline-first catalog plus optional live
89
+ Hugging Face search.
90
+ - **Dashboard** — a React + TypeScript UI with training, introspection,
91
+ analysis, targets, energy, and hub panels, and seven guided walkthroughs.
92
+
93
+ ## Packages
94
+
95
+ This repository is a single workspace that publishes four distributions:
96
+
97
+ | Distribution | Import root | Purpose |
98
+ |---|---|---|
99
+ | `spikeforge` | `spikeforge` | Core package: encoders, topologies, training, simulator, NIR bridge, tracking |
100
+ | `spikeforge-targets` | `spikeforge_targets` | Deployment targets, quantization, energy accounting, sparse event runtime |
101
+ | `spikeforge-hub` | `spikeforge_hub` | Curated model hub and optional Hugging Face access |
102
+ | `spikeforge-server` | `server` | FastAPI + WebSocket server and dashboard hosting |
103
+
104
+ ## Documentation
105
+
106
+ This README stays short on purpose.
107
+ [`documentation/`](documentation/README.md) is the full reference — install
108
+ paths, the CLI tools, architecture, module layout, and the dev workflow —
109
+ written for contributors and coding agents alike. Also see
110
+ [COOKBOOK.md](COOKBOOK.md) for copy-pasteable recipes,
111
+ [examples/](examples/) for runnable end-to-end scripts, and
112
+ [plans/](plans/) for design documents and the roadmap.
113
+
114
+ See [CONTRIBUTING.md](https://github.com/capsize-games/spikeforge/blob/main/CONTRIBUTING.md)
115
+ and [rules.md](rules.md) before opening a pull request.
116
+
117
+ ## Citing
118
+
119
+ If spikeforge is useful in your research, please cite it — see
120
+ [CITATION.cff](CITATION.cff) (GitHub renders a "Cite this repository"
121
+ button from it automatically).
122
+
123
+ ## License
124
+
125
+ Released under the **BSD 3-Clause License** — see [LICENSE](LICENSE) and
126
+ [AUTHORS](AUTHORS).
@@ -0,0 +1,94 @@
1
+ # spikeforge
2
+
3
+ [![CI](https://github.com/capsize-games/spikeforge/actions/workflows/ci.yml/badge.svg)](https://github.com/capsize-games/spikeforge/actions/workflows/ci.yml)
4
+ [![Status: pre-1.0](https://img.shields.io/badge/status-pre--1.0-orange.svg)](OPEN_SOURCE_CHECKLIST.md)
5
+ [![License: BSD-3-Clause](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](LICENSE)
6
+ [![Python 3.10–3.13](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-3776AB.svg)](https://www.python.org/downloads/)
7
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
8
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/capsize-games/spikeforge/blob/main/CONTRIBUTING.md)
9
+ [![Docs](https://img.shields.io/badge/docs-long--form%20reference-blue.svg)](documentation/README.md)
10
+
11
+ A spiking-neural-network (SNN) toolkit built on
12
+ [snnTorch](https://snntorch.readthedocs.io/) and PyTorch. Loads MNIST-style
13
+ and neuromorphic event datasets, encodes them into rate, latency, delta, and
14
+ random spikes, and trains, validates, exports, and deploys LIF networks —
15
+ with a live browser dashboard served over WebSockets.
16
+
17
+ > **Pre-1.0 and unpublished.** `install.sh` is the supported path today;
18
+ > PyPI ships once the distributions are published. Before trusting any
19
+ > number this produces, read
20
+ > [Implications and boundaries](documentation/implications-and-boundaries.md).
21
+
22
+ ## Quickstart
23
+
24
+ ```bash
25
+ git clone https://github.com/capsize-games/spikeforge.git
26
+ cd spikeforge
27
+ docker compose up --build
28
+ ```
29
+
30
+ Open <http://localhost:8877> — the dashboard connects to the WebSocket on
31
+ the same host and port. No separate backend or proxy to run.
32
+
33
+ Prefer a local install, a headless example, or the CLI tools instead? See
34
+ [Usage](documentation/usage.md) and [Quickstart](documentation/quickstart.md)
35
+ for every path (`./install.sh`, local dev with Vite, `examples/`, and the
36
+ eight `spikeforge-*` console scripts).
37
+
38
+ ## Features
39
+
40
+ - **Encoding** — rate, latency, delta, and random spike coders.
41
+ - **Training** — fully-connected and convolutional LIF networks with
42
+ surrogate-gradient cross-entropy, checkpointing, and opt-in AMP / gradient
43
+ checkpointing / truncated BPTT / multi-GPU.
44
+ - **Topologies** — `fc_legacy`, `fc_small`, `conv_net`, `recurrent_net`, plus
45
+ the sequence presets `sequence_mlp` and `sequence_attn`.
46
+ - **Datasets** — MNIST, Fashion-MNIST, KMNIST, QMNIST, USPS, EMNIST,
47
+ CIFAR-10, and (via the `events` extra) N-MNIST, DVS128 Gesture,
48
+ CIFAR10-DVS, and Spiking Speech Commands.
49
+ - **Interpreter spine** — NIR export, an independent NIR interpreter, and
50
+ numerical drift validation.
51
+ - **Introspection** — educational-mode `U[t]`/`I[t]`/`S[t]` traces,
52
+ trajectory metrics, and surrogate-derivative curves.
53
+ - **Deployment** — a capability matrix, weight quantization, energy
54
+ accounting, and executable `reference`, `norse`, and `lava_loihi2`
55
+ backends.
56
+ - **Model hub** — a curated, offline-first catalog plus optional live
57
+ Hugging Face search.
58
+ - **Dashboard** — a React + TypeScript UI with training, introspection,
59
+ analysis, targets, energy, and hub panels, and seven guided walkthroughs.
60
+
61
+ ## Packages
62
+
63
+ This repository is a single workspace that publishes four distributions:
64
+
65
+ | Distribution | Import root | Purpose |
66
+ |---|---|---|
67
+ | `spikeforge` | `spikeforge` | Core package: encoders, topologies, training, simulator, NIR bridge, tracking |
68
+ | `spikeforge-targets` | `spikeforge_targets` | Deployment targets, quantization, energy accounting, sparse event runtime |
69
+ | `spikeforge-hub` | `spikeforge_hub` | Curated model hub and optional Hugging Face access |
70
+ | `spikeforge-server` | `server` | FastAPI + WebSocket server and dashboard hosting |
71
+
72
+ ## Documentation
73
+
74
+ This README stays short on purpose.
75
+ [`documentation/`](documentation/README.md) is the full reference — install
76
+ paths, the CLI tools, architecture, module layout, and the dev workflow —
77
+ written for contributors and coding agents alike. Also see
78
+ [COOKBOOK.md](COOKBOOK.md) for copy-pasteable recipes,
79
+ [examples/](examples/) for runnable end-to-end scripts, and
80
+ [plans/](plans/) for design documents and the roadmap.
81
+
82
+ See [CONTRIBUTING.md](https://github.com/capsize-games/spikeforge/blob/main/CONTRIBUTING.md)
83
+ and [rules.md](rules.md) before opening a pull request.
84
+
85
+ ## Citing
86
+
87
+ If spikeforge is useful in your research, please cite it — see
88
+ [CITATION.cff](CITATION.cff) (GitHub renders a "Cite this repository"
89
+ button from it automatically).
90
+
91
+ ## License
92
+
93
+ Released under the **BSD 3-Clause License** — see [LICENSE](LICENSE) and
94
+ [AUTHORS](AUTHORS).
@@ -0,0 +1,97 @@
1
+ # PEP 621 packaging authority for the spikeforge-io distribution (PT-W7).
2
+ #
3
+ # The distribution owns the top-level ``spikeforge_io`` package: dependency-light
4
+ # adapters that ingest recorded numeric streams (CSV/JSON/NPY/in-memory and the
5
+ # dataset hook) into the core frozen window/normalize/encode contract, and
6
+ # replay them into ``spikeforge-serve``'s ``/v1/stream``. It depends on core,
7
+ # but core never depends on it -- the windowing implementation therefore stays
8
+ # in ``spikeforge/streaming/`` and ``spikeforge_io.windowing`` re-exports it.
9
+ #
10
+ # ``spikeforge_io/`` stays at its repository-root path and is exposed to the
11
+ # build via the ``spikeforge_io`` symlink next to this file (the same pattern
12
+ # the core, serve, and clients distributions use).
13
+
14
+ [build-system]
15
+ requires = ["setuptools>=68"]
16
+ build-backend = "setuptools.build_meta"
17
+
18
+ [project]
19
+ name = "spikeforge-io"
20
+ version = "0.1.0"
21
+ description = "Recorded-stream I/O adapters and the windowing surface for spikeforge."
22
+ # ``README.md`` and ``LICENSE`` are committed symlinks to the repository-root
23
+ # files, mirroring the core and client distributions' metadata approach.
24
+ readme = "README.md"
25
+ requires-python = ">=3.10"
26
+ license = "BSD-3-Clause"
27
+ license-files = ["LICENSE"]
28
+ authors = [
29
+ { name = "Capsize LLC", email = "contact@capsizegames.com" },
30
+ ]
31
+ maintainers = [
32
+ { name = "Capsize LLC", email = "contact@capsizegames.com" },
33
+ ]
34
+ keywords = [
35
+ "spiking neural networks",
36
+ "streaming",
37
+ "io",
38
+ "adapters",
39
+ "windowing",
40
+ ]
41
+ classifiers = [
42
+ "Development Status :: 4 - Beta",
43
+ "Intended Audience :: Developers",
44
+ "Intended Audience :: Science/Research",
45
+ "Operating System :: OS Independent",
46
+ "Programming Language :: Python :: 3",
47
+ "Programming Language :: Python :: 3.10",
48
+ "Programming Language :: Python :: 3.11",
49
+ "Programming Language :: Python :: 3.12",
50
+ "Programming Language :: Python :: 3.13",
51
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
52
+ ]
53
+ # The core runtime supplies the frozen window/normalize/encode contract and
54
+ # torch; numpy is already a core dependency and backs the `.npy` adapter. No
55
+ # pandas/fastapi/network client is pulled in, so an I/O install stays light.
56
+ dependencies = [
57
+ "spikeforge~=0.3.0",
58
+ "torch>=2.5",
59
+ "numpy>=1.26",
60
+ ]
61
+
62
+ [project.optional-dependencies]
63
+ dev = [
64
+ "pytest>=7.0",
65
+ "pytest-cov>=4.0",
66
+ "ruff>=0.0.280",
67
+ ]
68
+
69
+ [project.scripts]
70
+ spikeforge-io = "spikeforge_io.cli:main"
71
+
72
+ [project.urls]
73
+ Homepage = "https://github.com/capsize-games/spikeforge"
74
+ Repository = "https://github.com/capsize-games/spikeforge"
75
+
76
+ [tool.setuptools]
77
+ zip-safe = false
78
+
79
+ [tool.setuptools.packages.find]
80
+ # The `spikeforge_io` import root is exposed next to this file as a symlink to
81
+ # `../../spikeforge_io` so the default via-sdist `python -m build` produces a
82
+ # complete wheel. Discovery depends only on this top-level package.
83
+ where = ["."]
84
+ include = ["spikeforge_io*"]
85
+ exclude = [
86
+ "spikeforge",
87
+ "spikeforge.*",
88
+ "server*",
89
+ "tests*",
90
+ "spikeforge_targets*",
91
+ "spikeforge_hub*",
92
+ "spikeforge_serve*",
93
+ "spikeforge_clients*",
94
+ ]
95
+
96
+ [tool.setuptools.package-data]
97
+ spikeforge_io = ["py.typed"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,88 @@
1
+ """``spikeforge-io``: dependency-light I/O adapters and the windowing surface.
2
+
3
+ PT-W7's second deliverable. The distribution is deliberately thin: it adapts a
4
+ recorded numeric source (CSV, JSON, NPY, in-memory, or any object implementing
5
+ the dataset hook) into the core frozen window/normalize/encode contract, and
6
+ replays it into ``spikeforge-serve``'s ``/v1/stream``.
7
+
8
+ The windowing *implementation* stays in core
9
+ (:mod:`spikeforge.streaming.window_spec`) because core must never depend on a
10
+ satellite; :mod:`spikeforge_io.windowing` re-exports that one canonical
11
+ contract. No pandas, no fastapi, no client SDK is imported here.
12
+
13
+ from spikeforge_io import CsvAdapter, replay_to_stream
14
+
15
+ adapter = CsvAdapter("recording.csv")
16
+ frames = adapter.stream() # [N, D]
17
+ windows = adapter.windows(spec) # [W, L, D], z-scored by the frozen spec
18
+ """
19
+
20
+ from spikeforge_io.adapters import (
21
+ DATASET_METHODS,
22
+ FACTORIES,
23
+ CsvAdapter,
24
+ DatasetAdapter,
25
+ InMemoryAdapter,
26
+ JsonAdapter,
27
+ NpyAdapter,
28
+ StreamAdapter,
29
+ adapter_for,
30
+ as_stream,
31
+ )
32
+ from spikeforge_io.errors import (
33
+ AdapterDependencyError,
34
+ AdapterError,
35
+ AdapterFormatError,
36
+ AdapterShapeError,
37
+ AdapterUnsupportedError,
38
+ IoError,
39
+ )
40
+ from spikeforge_io.replay import (
41
+ ReplayReport,
42
+ replay,
43
+ replay_to_stream,
44
+ stream_messages,
45
+ )
46
+ from spikeforge_io.windowing import (
47
+ WINDOW_SPEC_VERSION,
48
+ WindowSpec,
49
+ delta_over_window,
50
+ encode_windows,
51
+ fit_window_spec,
52
+ normalize_windows,
53
+ window_spec_from_bundle,
54
+ window_stream,
55
+ windows,
56
+ )
57
+
58
+ __all__ = [
59
+ "DATASET_METHODS",
60
+ "FACTORIES",
61
+ "WINDOW_SPEC_VERSION",
62
+ "AdapterDependencyError",
63
+ "AdapterError",
64
+ "AdapterFormatError",
65
+ "AdapterShapeError",
66
+ "AdapterUnsupportedError",
67
+ "CsvAdapter",
68
+ "DatasetAdapter",
69
+ "InMemoryAdapter",
70
+ "IoError",
71
+ "JsonAdapter",
72
+ "NpyAdapter",
73
+ "ReplayReport",
74
+ "StreamAdapter",
75
+ "WindowSpec",
76
+ "adapter_for",
77
+ "as_stream",
78
+ "delta_over_window",
79
+ "encode_windows",
80
+ "fit_window_spec",
81
+ "normalize_windows",
82
+ "replay",
83
+ "replay_to_stream",
84
+ "stream_messages",
85
+ "window_spec_from_bundle",
86
+ "window_stream",
87
+ "windows",
88
+ ]
@@ -0,0 +1,6 @@
1
+ """``python -m spikeforge_io`` entry point for the I/O CLI."""
2
+
3
+ from spikeforge_io.cli import main
4
+
5
+ if __name__ == "__main__":
6
+ raise SystemExit(main())