Metadata-Version: 2.4
Name: braintrace
Version: 0.2.0
Summary: Enabling Scalable Online Learning for Brain Dynamics.
Author-email: BrainTrace Developers <chao.brain@qq.com>
License: Apache-2.0 license
Project-URL: Homepage, https://github.com/chaobrain/braintrace
Project-URL: Bug Tracker, https://github.com/chaobrain/braintrace/issues
Project-URL: Documentation, https://brainx.chaobrain.com/braintrace/
Project-URL: Source Code, https://github.com/chaobrain/braintrace
Keywords: computational neuroscience,brain-inspired computing,brain modeling,online learning
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: brainstate>=0.2.2
Requires-Dist: brainunit
Requires-Dist: brainstate
Requires-Dist: brainpy-state
Requires-Dist: braintools
Provides-Extra: cpu
Requires-Dist: jax[cpu]; extra == "cpu"
Provides-Extra: cuda12
Requires-Dist: jax[cuda12]; extra == "cuda12"
Provides-Extra: cuda13
Requires-Dist: jax[cuda13]; extra == "cuda13"
Provides-Extra: tpu
Requires-Dist: jax[tpu]; extra == "tpu"
Provides-Extra: testing
Requires-Dist: pytest; extra == "testing"
Requires-Dist: jax[cpu]; extra == "testing"
Requires-Dist: hypothesis; extra == "testing"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: jax[cpu]; extra == "dev"
Requires-Dist: hypothesis; extra == "dev"
Requires-Dist: mypy>=1.8; extra == "dev"
Requires-Dist: build; extra == "dev"
Dynamic: license-file

<h1 align="center">BrainTrace</h1>
<h2 align="center">Eligibility Trace-based Online Learning for Brain Dynamics</h2>

<p align="center">
  	<img alt="Header image of braintrace." src="https://brainx.chaobrain.com/images/braintrace.webp" width=40%>
</p>

<p align="center">
	<a href="https://pypi.org/project/braintrace/"><img alt="Supported Python Version" src="https://img.shields.io/pypi/pyversions/braintrace"></a>
	<a href="https://github.com/chaobrain/braintrace/blob/main/LICENSE"><img alt="LICENSE" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a>
  	<a href="https://brainx.chaobrain.com/braintrace/"><img alt="Documentation" src="https://readthedocs.org/projects/braintrace/badge/?version=latest"></a>
  	<a href="https://badge.fury.io/py/braintrace"><img alt="PyPI version" src="https://badge.fury.io/py/braintrace.svg"></a>
    <a href="https://github.com/chaobrain/braintrace/actions/workflows/CI.yml"><img alt="Continuous Integration" src="https://github.com/chaobrain/braintrace/actions/workflows/CI.yml/badge.svg"></a>
</p>

[``braintrace``](https://github.com/chaobrain/braintrace) provides online learning algorithms for biological neural networks.
It has been integrated into our establishing [brain modeling ecosystem](https://brainx.chaobrain.com/).

## Installation

``braintrace`` can run on Python 3.10+ installed on Linux, MacOS, and Windows. You can install ``braintrace`` via pip:

```bash
pip install braintrace --upgrade
```

Alternatively, you can install `BrainX`, which bundles `braintrace` with other compatible packages for a comprehensive brain modeling ecosystem:

```bash
pip install BrainX -U
```

## Documentation

The official documentation is hosted on Read the Docs: [https://brainx.chaobrain.com/braintrace](https://brainx.chaobrain.com/braintrace)

## Citation

If you use this package in your research, please cite:

```bibtex

@Article{Wang2026,
  author={Wang, Chaoming
          and Dong, Xingsi
          and Ji, Zilong
          and Xiao, Mingqing
          and Jiang, Jiedong
          and Liu, Xiao
          and Huan, Yuxiang
          and Wu, Si},
  title={Model-agnostic linear-memory online learning in spiking neural networks},
  journal={Nature Communications},
  year={2026},
  month={Jan},
  day={19},
  abstract={Spiking neural networks (SNNs) offer a promising paradigm for modeling brain dynamics and developing neuromorphic intelligence, yet an online learning system capable of training rich spiking dynamics over long horizons with low memory footprints has been missing. Existing online approaches either incur quadratic memory growth, sacrifice biological fidelity through oversimplified models, or lack end-to-end automated tooling. Here, we introduce BrainTrace, a model-agnostic, linear-memory, and automated online learning system for spiking neural networks. BrainTrace standardizes model specification to encompass diverse neuronal and synaptic dynamics; implements a linear-memory online learning rule by exploiting intrinsic properties of spiking dynamics; and provides a compiler that automatically generates optimized online-learning code for arbitrary user-defined models. Across diverse dynamics and tasks, BrainTrace achieves strong learning performance with a low memory footprint and high computational throughput. Critically, these properties enable online fitting of a whole-brain-scale Drosophila SNN that recapitulates region-level functional activity. By reconciling generality, efficiency, and usability, BrainTrace establishes a foundation for spiking network modeling at scale.},
  issn={2041-1723},
  doi={10.1038/s41467-026-68453-w},
  url={https://doi.org/10.1038/s41467-026-68453-w},
  publisher={Nature Publishing Group UK London}
}

```


## See also the ecosystem

``braintrace`` is one part of our brain simulation ecosystem: https://brainx.chaobrain.com/
