neuronal-rs 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,177 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "autocfg"
7
+ version = "1.5.1"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
10
+
11
+ [[package]]
12
+ name = "heck"
13
+ version = "0.5.0"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
16
+
17
+ [[package]]
18
+ name = "indoc"
19
+ version = "2.0.7"
20
+ source = "registry+https://github.com/rust-lang/crates.io-index"
21
+ checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
22
+ dependencies = [
23
+ "rustversion",
24
+ ]
25
+
26
+ [[package]]
27
+ name = "libc"
28
+ version = "0.2.190"
29
+ source = "registry+https://github.com/rust-lang/crates.io-index"
30
+ checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78"
31
+
32
+ [[package]]
33
+ name = "memoffset"
34
+ version = "0.9.1"
35
+ source = "registry+https://github.com/rust-lang/crates.io-index"
36
+ checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
37
+ dependencies = [
38
+ "autocfg",
39
+ ]
40
+
41
+ [[package]]
42
+ name = "neuronal-core"
43
+ version = "0.1.0"
44
+
45
+ [[package]]
46
+ name = "neuronal-python"
47
+ version = "0.1.0"
48
+ dependencies = [
49
+ "neuronal-core",
50
+ "pyo3",
51
+ ]
52
+
53
+ [[package]]
54
+ name = "once_cell"
55
+ version = "1.21.4"
56
+ source = "registry+https://github.com/rust-lang/crates.io-index"
57
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
58
+
59
+ [[package]]
60
+ name = "portable-atomic"
61
+ version = "1.15.0"
62
+ source = "registry+https://github.com/rust-lang/crates.io-index"
63
+ checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
64
+
65
+ [[package]]
66
+ name = "proc-macro2"
67
+ version = "1.0.107"
68
+ source = "registry+https://github.com/rust-lang/crates.io-index"
69
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
70
+ dependencies = [
71
+ "unicode-ident",
72
+ ]
73
+
74
+ [[package]]
75
+ name = "pyo3"
76
+ version = "0.27.2"
77
+ source = "registry+https://github.com/rust-lang/crates.io-index"
78
+ checksum = "ab53c047fcd1a1d2a8820fe84f05d6be69e9526be40cb03b73f86b6b03e6d87d"
79
+ dependencies = [
80
+ "indoc",
81
+ "libc",
82
+ "memoffset",
83
+ "once_cell",
84
+ "portable-atomic",
85
+ "pyo3-build-config",
86
+ "pyo3-ffi",
87
+ "pyo3-macros",
88
+ "unindent",
89
+ ]
90
+
91
+ [[package]]
92
+ name = "pyo3-build-config"
93
+ version = "0.27.2"
94
+ source = "registry+https://github.com/rust-lang/crates.io-index"
95
+ checksum = "b455933107de8642b4487ed26d912c2d899dec6114884214a0b3bb3be9261ea6"
96
+ dependencies = [
97
+ "target-lexicon",
98
+ ]
99
+
100
+ [[package]]
101
+ name = "pyo3-ffi"
102
+ version = "0.27.2"
103
+ source = "registry+https://github.com/rust-lang/crates.io-index"
104
+ checksum = "1c85c9cbfaddf651b1221594209aed57e9e5cff63c4d11d1feead529b872a089"
105
+ dependencies = [
106
+ "libc",
107
+ "pyo3-build-config",
108
+ ]
109
+
110
+ [[package]]
111
+ name = "pyo3-macros"
112
+ version = "0.27.2"
113
+ source = "registry+https://github.com/rust-lang/crates.io-index"
114
+ checksum = "0a5b10c9bf9888125d917fb4d2ca2d25c8df94c7ab5a52e13313a07e050a3b02"
115
+ dependencies = [
116
+ "proc-macro2",
117
+ "pyo3-macros-backend",
118
+ "quote",
119
+ "syn",
120
+ ]
121
+
122
+ [[package]]
123
+ name = "pyo3-macros-backend"
124
+ version = "0.27.2"
125
+ source = "registry+https://github.com/rust-lang/crates.io-index"
126
+ checksum = "03b51720d314836e53327f5871d4c0cfb4fb37cc2c4a11cc71907a86342c40f9"
127
+ dependencies = [
128
+ "heck",
129
+ "proc-macro2",
130
+ "pyo3-build-config",
131
+ "quote",
132
+ "syn",
133
+ ]
134
+
135
+ [[package]]
136
+ name = "quote"
137
+ version = "1.0.47"
138
+ source = "registry+https://github.com/rust-lang/crates.io-index"
139
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
140
+ dependencies = [
141
+ "proc-macro2",
142
+ ]
143
+
144
+ [[package]]
145
+ name = "rustversion"
146
+ version = "1.0.23"
147
+ source = "registry+https://github.com/rust-lang/crates.io-index"
148
+ checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
149
+
150
+ [[package]]
151
+ name = "syn"
152
+ version = "2.0.119"
153
+ source = "registry+https://github.com/rust-lang/crates.io-index"
154
+ checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
155
+ dependencies = [
156
+ "proc-macro2",
157
+ "quote",
158
+ "unicode-ident",
159
+ ]
160
+
161
+ [[package]]
162
+ name = "target-lexicon"
163
+ version = "0.13.5"
164
+ source = "registry+https://github.com/rust-lang/crates.io-index"
165
+ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
166
+
167
+ [[package]]
168
+ name = "unicode-ident"
169
+ version = "1.0.26"
170
+ source = "registry+https://github.com/rust-lang/crates.io-index"
171
+ checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954"
172
+
173
+ [[package]]
174
+ name = "unindent"
175
+ version = "0.2.4"
176
+ source = "registry+https://github.com/rust-lang/crates.io-index"
177
+ checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
@@ -0,0 +1,13 @@
1
+ [workspace]
2
+ members = ["crates/neuronal-core", "crates/neuronal-python"]
3
+ resolver = "2"
4
+
5
+ [workspace.package]
6
+ version = "0.1.0"
7
+ edition = "2021"
8
+ license = "MIT"
9
+ repository = "https://github.com/ze-gois/neuronal"
10
+
11
+ [workspace.dependencies]
12
+ neuronal-core = { path = "crates/neuronal-core" }
13
+ pyo3 = { version = "0.27", features = ["abi3-py310"] }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 José Henrique Targino Dias Gois
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.
@@ -0,0 +1,83 @@
1
+ Metadata-Version: 2.4
2
+ Name: neuronal-rs
3
+ Version: 0.1.0
4
+ Classifier: Development Status :: 2 - Pre-Alpha
5
+ Classifier: Programming Language :: Python :: 3
6
+ Classifier: Programming Language :: Rust
7
+ Classifier: Topic :: Scientific/Engineering
8
+ Requires-Dist: pytest>=8 ; extra == 'dev'
9
+ Provides-Extra: dev
10
+ License-File: LICENSE
11
+ Summary: Neural simulation in Rust, accessible from Python
12
+ Keywords: neuroscience,simulation,rust
13
+ Author: José Henrique Targino Dias Gois
14
+ License-Expression: MIT
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
17
+ Project-URL: Issues, https://github.com/ze-gois/neuronal/issues
18
+ Project-URL: Repository, https://github.com/ze-gois/neuronal
19
+
20
+ # neuronal
21
+
22
+ Distribuição Python: `neuronal-rs`. Importação: `import neuronal`.
23
+
24
+ Pacote Python com núcleo numérico escrito em Rust. Esqueleto inicial para
25
+ simulação neuronal e, posteriormente, geração de registros extracelulares sintéticos.
26
+ Ainda não implementa neurônios LIF nem spike sorting.
27
+
28
+ ## Estrutura
29
+
30
+ - `crates/neuronal-core`: núcleo Rust sem dependência de Python.
31
+ - `crates/neuronal-python`: interface PyO3; extensão `neuronal._native`.
32
+ - `python/neuronal`: API pública Python e tipos.
33
+ - `examples`: exemplos executáveis.
34
+ - `tests`: verificação da integração Python–Rust.
35
+
36
+ ## Desenvolvimento
37
+
38
+ Requisitos: Rust estável (cargo/rustc), Python 3.10+ e compilador/linker do sistema.
39
+
40
+ ```bash
41
+ python -m venv .venv
42
+ source .venv/bin/activate
43
+ python -m pip install 'maturin>=1.9,<2' 'pytest>=8'
44
+ maturin develop
45
+ python examples/time_axis.py
46
+ pytest
47
+ cargo fmt --all --check
48
+ cargo check --workspace
49
+ ```
50
+
51
+ Exemplo:
52
+
53
+ ```python
54
+ import neuronal
55
+
56
+ print(neuronal.time_axis(samples=5, dt_ms=0.1))
57
+ ```
58
+
59
+ A função retorna uma lista Python; NumPy não é obrigatório nesta primeira etapa.
60
+ O número de amostras é explícito: o último instante é `(samples - 1) * dt_ms`.
61
+ Zero amostras produz uma lista vazia. O passo deve ser finito e positivo.
62
+
63
+ ## Distribuição local
64
+
65
+ ```bash
66
+ maturin build --release --out dist
67
+ python -m pip install dist/*.whl
68
+ ```
69
+
70
+ A distribuição no PyPI se chama `neuronal-rs`; o módulo Python permanece
71
+ `neuronal` (`import neuronal`). A aceitação do nome será confirmada no upload.
72
+ Nenhum pacote foi publicado. Licença de distribuição: [MIT](LICENSE).
73
+
74
+ ## Próxima entrega
75
+
76
+ Implementar LIF determinístico no núcleo, validar contra solução analítica e
77
+ expor potencial de membrana e tempos de disparo ao Python. Depois: populações,
78
+ entradas estocásticas e registros extracelulares com ground truth.
79
+
80
+ ## Publicação
81
+
82
+ Veja [o guia de publicação](docs/publishing.md) para validar e publicar no PyPI.
83
+
@@ -0,0 +1,63 @@
1
+ # neuronal
2
+
3
+ Distribuição Python: `neuronal-rs`. Importação: `import neuronal`.
4
+
5
+ Pacote Python com núcleo numérico escrito em Rust. Esqueleto inicial para
6
+ simulação neuronal e, posteriormente, geração de registros extracelulares sintéticos.
7
+ Ainda não implementa neurônios LIF nem spike sorting.
8
+
9
+ ## Estrutura
10
+
11
+ - `crates/neuronal-core`: núcleo Rust sem dependência de Python.
12
+ - `crates/neuronal-python`: interface PyO3; extensão `neuronal._native`.
13
+ - `python/neuronal`: API pública Python e tipos.
14
+ - `examples`: exemplos executáveis.
15
+ - `tests`: verificação da integração Python–Rust.
16
+
17
+ ## Desenvolvimento
18
+
19
+ Requisitos: Rust estável (cargo/rustc), Python 3.10+ e compilador/linker do sistema.
20
+
21
+ ```bash
22
+ python -m venv .venv
23
+ source .venv/bin/activate
24
+ python -m pip install 'maturin>=1.9,<2' 'pytest>=8'
25
+ maturin develop
26
+ python examples/time_axis.py
27
+ pytest
28
+ cargo fmt --all --check
29
+ cargo check --workspace
30
+ ```
31
+
32
+ Exemplo:
33
+
34
+ ```python
35
+ import neuronal
36
+
37
+ print(neuronal.time_axis(samples=5, dt_ms=0.1))
38
+ ```
39
+
40
+ A função retorna uma lista Python; NumPy não é obrigatório nesta primeira etapa.
41
+ O número de amostras é explícito: o último instante é `(samples - 1) * dt_ms`.
42
+ Zero amostras produz uma lista vazia. O passo deve ser finito e positivo.
43
+
44
+ ## Distribuição local
45
+
46
+ ```bash
47
+ maturin build --release --out dist
48
+ python -m pip install dist/*.whl
49
+ ```
50
+
51
+ A distribuição no PyPI se chama `neuronal-rs`; o módulo Python permanece
52
+ `neuronal` (`import neuronal`). A aceitação do nome será confirmada no upload.
53
+ Nenhum pacote foi publicado. Licença de distribuição: [MIT](LICENSE).
54
+
55
+ ## Próxima entrega
56
+
57
+ Implementar LIF determinístico no núcleo, validar contra solução analítica e
58
+ expor potencial de membrana e tempos de disparo ao Python. Depois: populações,
59
+ entradas estocásticas e registros extracelulares com ground truth.
60
+
61
+ ## Publicação
62
+
63
+ Veja [o guia de publicação](docs/publishing.md) para validar e publicar no PyPI.
@@ -0,0 +1,7 @@
1
+ [package]
2
+ name = "neuronal-core"
3
+ version.workspace = true
4
+ edition.workspace = true
5
+ license.workspace = true
6
+ repository.workspace = true
7
+ description = "Numerical core for neuronal simulation"
@@ -0,0 +1,18 @@
1
+ //! Numerical core, independent of Python.
2
+
3
+ /// Sample instants in milliseconds: t[i] = i * dt_ms.
4
+ /// The caller chooses the exact sample count; no endpoint is inferred.
5
+ pub fn time_axis(samples: usize, dt_ms: f64) -> Result<Vec<f64>, &'static str> {
6
+ if !dt_ms.is_finite() || dt_ms <= 0.0 {
7
+ return Err("dt_ms must be finite and positive");
8
+ }
9
+ if samples > 0 && !((samples - 1) as f64 * dt_ms).is_finite() {
10
+ return Err("time axis exceeds the finite range");
11
+ }
12
+ let mut times = Vec::new();
13
+ times
14
+ .try_reserve_exact(samples)
15
+ .map_err(|_| "cannot allocate time axis")?;
16
+ times.extend((0..samples).map(|i| i as f64 * dt_ms));
17
+ Ok(times)
18
+ }
@@ -0,0 +1,15 @@
1
+ [package]
2
+ name = "neuronal-python"
3
+ version.workspace = true
4
+ edition.workspace = true
5
+ license.workspace = true
6
+ repository.workspace = true
7
+ description = "Python bindings for neuronal simulation"
8
+
9
+ [lib]
10
+ name = "_native"
11
+ crate-type = ["cdylib"]
12
+
13
+ [dependencies]
14
+ neuronal-core.workspace = true
15
+ pyo3.workspace = true
@@ -0,0 +1,16 @@
1
+ use pyo3::exceptions::PyValueError;
2
+ use pyo3::prelude::*;
3
+
4
+ /// Return sample instants in milliseconds as a Python list.
5
+ #[pyfunction]
6
+ fn time_axis(py: Python<'_>, samples: usize, dt_ms: f64) -> PyResult<Vec<f64>> {
7
+ py.detach(|| neuronal_core::time_axis(samples, dt_ms))
8
+ .map_err(PyValueError::new_err)
9
+ }
10
+
11
+ #[pymodule]
12
+ fn _native(m: &Bound<'_, PyModule>) -> PyResult<()> {
13
+ m.add("__version__", env!("CARGO_PKG_VERSION"))?;
14
+ m.add_function(wrap_pyfunction!(time_axis, m)?)?;
15
+ Ok(())
16
+ }
@@ -0,0 +1,31 @@
1
+ [build-system]
2
+ requires = ["maturin>=1.9,<2"]
3
+ build-backend = "maturin"
4
+
5
+ [project]
6
+ name = "neuronal-rs"
7
+ version = "0.1.0"
8
+ description = "Neural simulation in Rust, accessible from Python"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ authors = [{ name = "José Henrique Targino Dias Gois" }]
13
+ keywords = ["neuroscience", "simulation", "rust"]
14
+ classifiers = ["Development Status :: 2 - Pre-Alpha", "Programming Language :: Python :: 3", "Programming Language :: Rust", "Topic :: Scientific/Engineering"]
15
+ requires-python = ">=3.10"
16
+
17
+ [project.urls]
18
+ Repository = "https://github.com/ze-gois/neuronal"
19
+ Issues = "https://github.com/ze-gois/neuronal/issues"
20
+
21
+ [project.optional-dependencies]
22
+ dev = ["pytest>=8"]
23
+
24
+ [tool.maturin]
25
+ manifest-path = "crates/neuronal-python/Cargo.toml"
26
+ python-source = "python"
27
+ module-name = "neuronal._native"
28
+ features = ["pyo3/extension-module"]
29
+
30
+ [tool.pytest.ini_options]
31
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ """Neural simulation backed by Rust."""
2
+ from ._native import __version__, time_axis
3
+
4
+ __all__ = ["__version__", "time_axis"]
@@ -0,0 +1,5 @@
1
+ __version__: str
2
+
3
+ def time_axis(samples: int, dt_ms: float) -> list[float]:
4
+ """Return samples instants t[i] = i * dt_ms; dt_ms must be positive and finite."""
5
+ ...
File without changes