First stable feature release of BrainEvent on PyPI. It consolidates the
event-driven data structures (binary / bit-packed / compact events; CSR / CSC,
fixed-number connectivity, and just-in-time connectivity matrices) behind a
single, uniform API, ships inline type information, and retires the legacy names
accumulated during the 0.0.x series.
Not to be confused with the historical
V0.1.0git tag (2025-05-02), which
was tagged on GitHub but never published to PyPI. The PyPI line ran
0.0.1.postN→ … →0.0.7; this0.1.0is the first0.1.0distributed on
PyPI. See the[V0.1.0]entry inchangelog.mdfor the historical note.
Requirements: Python ≥ 3.11, jax ≥ 0.5.0, brainunit ≥ 0.0.8, numpy,
absl-py.
⚠️ Breaking changes & migration
This release standardizes naming, but retains a backward-compatibility shim so
every public name exported by v0.0.7 stays importable (see Deprecated below).
Renamed symbols forward to their replacement with a DeprecationWarning; names
whose underlying functionality was removed raise an AttributeError that names the
replacement. Recommended updates:
| Deprecated / changed name | Replacement / migration |
|---|---|
EventArray |
BinaryArray |
JITCHomoR / JITCHomoC |
JITCScalarR / JITCScalarC |
FixedPostNumConn / FixedPreNumConn |
FixedNumPerPre / FixedNumPerPost |
FixedNumConn.to_csr / to_csc / to_dense |
tocsr / tocsc / todense |
csr_on_pre, csr2csc_on_post, dense_on_pre, dense_on_post |
update_csr_on_binary_pre, update_csc_on_binary_post, update_dense_on_binary_pre, update_dense_on_binary_post |
EllLayout / CscLayout |
(removed — use the canonical representations) |
COO sparse class & operators |
CSR / CSC (+ coo2csr and the *_index helpers) |
CSC.__getitem__(i) → column i |
now returns row i; use csc.transpose()[i] or csc.todense()[:, i] for the old result |
JITCScalar* / JITCNormal* / JITCUniform* .fromdense / yw_to_w / update_on_* |
materialize with .tocsr() first, then operate |
import brainevent no longer pulls in brainstate.
Added
- Uniform common-API contract on
DataRepresentation: every concrete data
representation now exposes (or deliberately refuses) a single conversion and
neural-plasticity surface —fromdense,todense,tocoo,tocsr,tocsc,
yw_to_w,yw_to_w_transposed,update_on_pre,update_on_post. The base
class declares stubs so a missing override fails loudly rather than silently
inheriting an unrelated implementation (#161). - Format conversions
tocsr/tocsc/tocooforCSR,CSC,
FixedNumPerPre,FixedNumPerPost, and the JIT-connectivity matrices (the
latter materialize eagerly viatocsrand delegate the rest). CSR/CSC
conversions arejax.jit-safe (#153, #161). FixedNumPerPre.fromdense/FixedNumPerPost.fromdense: build a
fixed-num-connection matrix from a dense array. Withnum_conn=Nonethe dense
matrix must have a uniform per-row (per-column) non-zero count; passing
num_connpads short rows with in-range zero-weight sentinels and raises
ValueErroron overflow. Physical units are preserved (#161).- Sparse row slicing for
CSR,CSC,FixedNumPerPre, andFixedNumPerPost:
a dense__getitem__returning row(s) of the logical matrixWwith full NumPy
index semantics (int/list/tuple/array/ Pythonslice, negative-index
wrapping, concrete out-of-bounds raisingIndexError), plus a sparse
slice_rows(index)returningW[rows, :]
(CSR→CSR,CSC→CSC,FixedNumPerPre→FixedNumPerPre,FixedNumPerPost→CSR).
FixedNumPerPre.slice_rowsisjax.jit-safe; the otherslice_rowspaths have a
data-dependent number of non-zeros and must run outsidejax.jit(#145). UnsupportedOperationError(subclass ofBrainEventError): raised when an
operation is structurally meaningless for a representation, distinct from
NotImplementedError. The JIT-connectivity matrices (JITCScalar*,
JITCNormal*,JITCUniform*) raise it forfromdense,yw_to_w,
yw_to_w_transposed,update_on_pre, andupdate_on_post, pointing callers
to.tocsr()for a materialized, plastic representation (#161).- PEP 561 inline type information: ships a
py.typedmarker so downstream
type checkers consumebrainevent's annotations. Public-API type hints and
NumPy-style docstrings were completed across the package, guarded by a mypy
CI ratchet (#151).
Changed
FixedNumConnconversion methods renamed to the no-underscore canonical
form (scipy /saiunitconvention):to_csr→tocsr,to_csc→tocsc,
to_dense→todense. Breaking — no aliases are kept (#148, #161).CSC.__getitem__now returns rowiofW(NumPy semantics) instead of
columni. Breaking for code relying on the previous column-indexing
behavior (#145).brainstatedropped from the core import path: importingbraineventno
longer importsbrainstate, removing it as an implicit runtime dependency of
the core package (#159).- Documentation reorganized into the Diátaxis structure (tutorials / how-to /
reference / explanation); the README was updated to match the current public
API (#149, #152, #155). - Internal CSR / JIT kernel layout:
_jit_conn_csrsplit into per-distribution
submodules, with JIT-matrix.tocsr()backed by dedicated CPU / CUDA operators
(#153, #160).
Deprecated
- Backward-compatibility shim for every v0.0.7 public name. A module-level
__getattr__keeps the entire v0.0.7 import surface resolvable. Renamed symbols
emit aDeprecationWarningand forward to their replacement (slated for removal
in a future major release):
EventArray→BinaryArray;
JITCHomoR/JITCHomoC→JITCScalarR/JITCScalarC;
FixedPostNumConn/FixedPreNumConn→FixedNumPerPre/FixedNumPerPost;
csr_on_pre/csr2csc_on_post/dense_on_pre/dense_on_post→ the
correspondingupdate_*_on_binary_*functions. Names whose functionality was
removed — theCOOclass & operators, thebitpack_/compact_FCN kernels,
andEllLayout/CscLayout— raise anAttributeErrorthat names the
replacement instead of failing silently.
Removed
COOsparse format class and its operators removed; accessing them now
raises a guidedAttributeError. UseCSR/CSCtogether with thecoo2csr
helper and the*_indexconversion utilities (csr_to_coo_index,
coo_to_csc_index,csr_to_csc_index,csc_to_csr_index) for index
manipulation (#124).- Explicit
bitpack_/compact_FCN kernels removed; they were unified into
fcnmv/fcnmm, which dispatch on the input event type. Wrap spikes with
BitPackedBinary/CompactBinaryand callfcnmv/fcnmm. FixedNumConn.to_csr/to_csc/to_dense(added and renamed within the
0.1.0 cycle, never shipped in a release) standardized totocsr/tocsc/
todense(#148, #161).- cuSPARSE-based CSR SpMV / SpMM kernel implementations removed in favor of
the native CUDA / JAX kernel paths (internal; no public-API change).
Full changelog: v0.0.7...v0.1.0