Skip to content

Releases: brainpy/BrainPy

Version 2.7.7

11 Mar 17:26
f917281

Choose a tag to compare

Release Date: March 12, 2026

This release migrates to the new brainevent binary backend API, fixes numerous bugs across neuron models, synapse dynamics, ODE integrators, and object transforms, and raises the minimum Python version to 3.11.

Breaking Changes

Python Version Requirement

  • Raised: Minimum Python version from 3.10 to 3.11
    • Dropped Python 3.10 support from classifiers and build metadata

brainevent API Migration (#817)

  • Updated: Event-driven operations to use the new brainevent binary backend
    • EventArray replaced by BinaryArray in all event CSR and jitconn operations
    • JITCHomoR replaced by JITCScalarR for homogeneous JIT connectivity
    • STDP weight update functions renamed:
      • dense_on_pre / dense_on_postupdate_dense_on_binary_pre / update_dense_on_binary_post
      • csr_on_pre / csr2csc_on_postupdate_csr_on_binary_pre / update_csr_on_binary_post
    • Affected layers: Dense, AllToAll, MaskedLinear, and all CSR-based layers

Bug Fixes

Neuron Models

  • Fixed: All LIF-family neuron models (LifLTC, LifRefLTC, ExpIFLTC, ExpIFRefLTC, AdExIFLTC, AdExIFRefLTC, QuaIFLTC, QuaIFRefLTC, AdQuaIFLTC, AdQuaIFRefLTC, GifLTC, GifRefLTC) now raise descriptive ValueError messages for invalid spk_reset modes instead of bare ValueError

Synapse Models

  • Fixed: Synaptic variable updates in DualExpon, Alpha, and NMDA models
    • Replaced in-place += operator with explicit .value assignment to prevent tracing issues under JAX transformations

ODE Integrators

  • Fixed: BogackiShampine adaptive Runge-Kutta coefficient typo — corrected '4/0' to '4/9' in the Butcher tableau
  • Fixed: set_default_odeint was incorrectly assigning to _DEFAULT_ODE_METHOD instead of _DEFAULT_DDE_METHOD

Object Transforms

  • Fixed: Variable.varshape used self.batch_size instead of self.batch_axis when computing non-batch shape dimensions
  • Fixed: NodeDict.update() and VarDict.update() referenced args[1] instead of arg[1] when updating from tuple arguments
  • Fixed: NodeDict.__setitem__ duplicate key error message incorrectly displayed the new value instead of the existing one

Training

  • Fixed: BPTrainer did not raise NoLongerSupportError when seed parameter was passed (missing raise keyword)
  • Fixed: BPTrainer metric aggregation switched from jnp.mean(bm.as_jax(...)) to np.mean(np.asarray(...)) to avoid unnecessary JAX tracing overhead

Core

  • Fixed: ShardedArray.value setter used _check_tracer() instead of direct _value access
  • Fixed: _slice_to_num did not handle negative step values and raised no error on zero step
  • Fixed: load_state crashed with KeyError when state dict contained missing keys; now correctly reports them as missing

Code Quality

  • Improved: Narrowed bare except clauses to specific exception types (ValueError, TypeError, ImportError, ModuleNotFoundError) in convolution layers and Flax interoperation module

Dependencies

  • Updated: brainevent from >=0.0.4 to >=0.0.7
  • Updated: braintools version spec corrected to >=0.0.9
  • Updated: numpy minimum version set to >=1.15
  • Updated: brainpy_state from >=0.0.2 to >=0.0.3

CI/CD

  • Updated: actions/upload-artifact from v6 to v7 (#815)
  • Updated: actions/download-artifact from v7 to v8 (#816)

What's Changed

  • chore(ci)(deps): bump actions/upload-artifact from 6 to 7 by @dependabot[bot] in #815
  • chore(ci)(deps): bump actions/download-artifact from 7 to 8 by @dependabot[bot] in #816
  • Refactor STDP and event ops for new brainevent binary backend by @chaoming0625 in #817

Full Changelog: V2.7.6...V2.7.7

Version 2.7.6

21 Jan 09:49

Choose a tag to compare

Release Date: January 21, 2026

This is a maintenance release that enhances JAX compatibility and improves CI stability across platforms.

JAX 0.9.0 Compatibility (#813)

  • Fixed: ODE integrator default time parameter handling
    • Ensured t keyword argument defaults to 0 in _call_integral method
    • Prevents errors when time parameter is not explicitly provided
  • Updated: Backend imports for compatibility with JAX >= 0.8.0
    • Updated brainpy.math.environment module to handle JAX backend changes
    • Improved compatibility layer for future JAX versions

ODE Integrators

  • Fixed: Explicit Runge-Kutta methods formatting in build method
  • Impact: Ensures stable numerical integration across different JAX versions

Updated Dependencies

  • Updated: brainpy_state from 0.0.1 to 0.0.3
  • Enhanced: README documentation with comprehensive module overview and installation instructions

What's Changed

  • Fix Windows CI: Use python -m pytest instead of pytest command by @Copilot in #811
  • chore(ci)(deps): bump styfle/cancel-workflow-action from 0.12.1 to 0.13.0 in the github-actions group by @dependabot[bot] in #812
  • Fix ODE integrator default time and compatibility with jax>=0.9.0 by @chaoming0625 in #813
  • chore: update brainpy_state dependency to version 0.0.3 and enhance R… by @chaoming0625 in #814

Full Changelog: V2.7.5...V2.7.6

BrainPy 2.7.5

25 Dec 15:20
fc487d1

Choose a tag to compare

Feature

  • compatible with jax>=0.8.2

What's Changed

  • Refine JIT wrappers for new JAX for comaptiblity with jax>=0.8.2 by @chaoming0625 in #809

Full Changelog: V2.7.4...V2.7.5

BrainPy V2.7.4

16 Dec 08:43

Choose a tag to compare

Release Date: December 2025

This release focuses on simplifying the project structure by removing the experimental brainpy.state module and consolidating documentation.

Major Changes

Removed brainpy.state Module (#806)

  • Removed: The entire brainpy.state module has been deleted
    • This includes all state-based neuron models (LIF variants, Izhikevich, HH)
    • Removed synapse models, projections, readouts, and STP implementations
    • Removed all associated test files
  • Recommendation: Users should use the brainpy.state library directly for state-based neural network simulations

Decouple the brainpy context with brainstate context

  • Updated: brainpy.math.defaults is totally decoupled with brainstate context management

Documentation Consolidation (#806)

  • Renamed: docs_classic/docs/ (now the main documentation)
  • Renamed: examples_classic/examples/ (now the main examples)
  • Removed: docs_state/ directory (state-based documentation)
  • Removed: examples_state/ directory (state-based examples)

Dependencies

Updated Dependencies (#807)

  • Simplified pyproject.toml configuration
  • Updated requirements.txt

CI/CD Improvements

  • Updated: actions/upload-artifact from 5 to 6 (#804)
  • Updated: actions/download-artifact from 6 to 7 (#805)

Files Modified

  • brainpy/__init__.py: Removed state module exports
  • brainpy/context.py: Simplified context management
  • brainpy/math/defaults.py: Updated default configurations
  • docs/conf.py: Updated documentation configuration
  • pyproject.toml: Simplified dependency configuration
  • .github/workflows/Publish.yml: Updated CI artifact actions

Breaking Changes

  • The brainpy.state module is no longer available. Users relying on this module should migrate to the standalone brainstate library.

BrainPy v2.7.3

10 Dec 13:24

Choose a tag to compare

Release Date: December 2024

This is a bug fix release that resolves critical issues with bm.for_loop and improves CI stability.

🐛 Bug Fixes

bm.for_loop jit Parameter Fix

  • Fixed: The jit parameter in bm.for_loop was accepted but never used - passing jit=False had no effect
  • Implementation: When jit=False, the call is now properly wrapped in jax.disable_jit() context manager
  • Impact: Users can now debug code with jit=False to see actual values instead of JIT-compiled traces

Zero-Length Scan Fix

  • Fixed: ValueError: zero-length scan is not supported in disable_jit() mode when using jit=False with zero-length inputs
  • Implementation: Automatically falls back to JIT mode for zero-length inputs with a warning
  • Impact: Prevents crashes when DSRunner.run(duration) results in 0 time steps (e.g., duration=0.5, dt=1.0)

Progress Bar Enhancement

  • Enhanced: progress_bar parameter in bm.for_loop() and bm.scan() now supports advanced customization
  • New Features:
    • Accept ProgressBar instances for fine-grained control (freq, desc, count parameters)
    • Accept integers as shorthand for frequency (e.g., progress_bar=10 means update every 10 iterations)
    • Full backward compatibility with existing progress_bar=True/False usage
  • Export: Added bm.ProgressBar for easy access (from brainpy.math import ProgressBar)
  • Impact: Aligns with brainstate API and enables better progress tracking customization

Parameter Cleanup

  • Removed: Unused parameters remat and unroll_kwargs from bm.for_loop()
  • Backward Compatibility: remat parameter kept in LoopOverTime.__init__() with deprecation warning
  • Fixes: Resolved TypeErrors in DSRunner and LoopOverTime that used these parameters

CI Improvements

  • Fixed: TclError on Windows Python 3.13 CI due to missing Tcl/Tk configuration
  • Implementation: Set MPLBACKEND=Agg environment variable in GitHub Actions workflow
  • Impact: Matplotlib tests now run successfully on all platforms (Linux, macOS, Windows)

🎯 Code Quality

  • Added comprehensive test coverage for all fixes (11 new test cases)
  • Updated API documentation to reflect new functionality
  • All 38 tests in test_controls.py pass

📦 Files Modified

  • brainpy/__init__.py: Updated version to 2.7.3
  • brainpy/math/object_transform/controls.py: Fixed jit handling, zero-length scan, progress_bar enhancement
  • brainpy/math/object_transform/__init__.py: Exported ProgressBar
  • brainpy/runners.py: Fixed unroll_kwargs usage with functools.partial
  • brainpy/transform.py: Added remat deprecation warning in LoopOverTime
  • brainpy/math/object_transform/tests/test_controls.py: Added 11 new test cases
  • docs_classic/apis/brainpy.math.oo_transform.rst: Added ProgressBar to documentation
  • .github/workflows/CI.yml: Added MPLBACKEND=Agg for all test jobs

🔗 Related PRs

  • #803: Fix bm.for_loop jit parameter handling and remove unused parameters
  • #802: Original issue report about jit parameter not working
  • #801: CI dependency updates
  • #800: Documentation improvements
  • #798: JointEq error message improvements

⚠️ Breaking Changes

None. All changes are backward compatible or involve previously non-functional parameters.

📦 Installation

pip install --upgrade brainpy==2.7.3

🔗 Links

BrainPy v2.7.2

10 Dec 13:23

Choose a tag to compare

Release Date: October 16, 2024

This is a maintenance release that improves JAX compatibility and documentation.

🐛 Bug Fixes

JAX Compatibility

  • Updated: Made compatible with JAX >= 0.8.0
  • Fixed: Updated imports and API usage for latest JAX versions
  • Impact: Ensures BrainPy works correctly with the latest JAX releases

🔧 Improvements

Documentation

  • Updated documentation and CI configuration for better clarity
  • Standardized test paths across the project
  • Improved core concepts documentation
  • Enhanced LIF neuron dynamics documentation (#800)
  • Fixed documentation bugs

Neural Network Classes

  • Refactored neural network classes for better maintainability
  • Updated progress bar parameters for simulations
  • Improved code organization and structure

CI/CD

  • Updated GitHub Actions dependencies:
    • actions/download-artifact from 5 to 6 (#796)
    • actions/upload-artifact from 4 to 5 (#795)
  • Improved CI workflow reliability

📝 Notes

  • This release focuses on maintaining compatibility with the latest JAX ecosystem
  • No breaking changes introduced
  • All existing code should continue to work without modifications

📦 Installation

pip install --upgrade brainpy==2.7.2

🔗 Links

Version 2.7.1

13 Oct 14:40
dfb6a69

Choose a tag to compare

This is a feature release that introduces new neuron and synapse models in the state-based API (brainpy.state) and enhances the Dynamics base class with improved input handling.

Major Changes

New Neuron Models (brainpy.state)

  • LIF (Leaky Integrate-and-Fire) Variants: Added comprehensive set of LIF neuron models

    • LIF: Basic LIF neuron with exponential synaptic input
    • LifRef: LIF with refractory period
    • ExpIF: Exponential Integrate-and-Fire neuron
    • ExpIFRef: ExpIF with refractory period
    • AdExIF: Adaptive Exponential Integrate-and-Fire neuron
    • AdExIFRef: AdExIF with refractory period
    • QuaIF: Quadratic Integrate-and-Fire neuron
    • QuaIFRef: QuaIF with refractory period
    • AdQuaIF: Adaptive Quadratic Integrate-and-Fire neuron
    • AdQuaIFRef: AdQuaIF with refractory period
    • GifRef: Generalized Integrate-and-Fire with refractory period
  • Izhikevich Neuron Models: Added new Izhikevich neuron implementations

    • Izhikevich: Basic Izhikevich neuron model
    • IzhikevichRef: Izhikevich with refractory period
  • Hodgkin-Huxley Model: Added classic biophysical neuron model

    • HH: Classic Hodgkin-Huxley model with Na+ and K+ channels

New Synapse Models (brainpy.state)

  • BioNMDA: Biological NMDA receptor with second-order kinetics
    • Implements two-state cascade dynamics (x and g variables)
    • Slower rise time compared to AMPA (biologically realistic)
    • Comprehensive documentation with mathematical formulation

Features

Model Implementation

  • All new models use the brainstate ecosystem (HiddenState, ShortTermState, LongTermState)
  • Proper unit support with brainunit integration
  • Exponential Euler integration for numerical stability
  • Batch processing support across all models
  • Consistent API design following BrainPy v2.7+ architecture

Dynamics Class Enhancements

  • Enhanced input handling capabilities in the Dynamics base class
  • Added new properties for better state management
  • Improved integration with brainstate framework
  • Refactored to use public methods instead of private counterparts for clarity

Documentation

  • Added comprehensive Examples sections to all neuron classes in _lif.py
  • Each example includes:
    • Import statements for required modules
    • Basic usage with parameter specifications
    • State initialization examples
    • Update and spike generation examples
    • Network integration with brainstate.nn.Sequential
    • Notes highlighting key features
  • All 13 neuron classes in _lif.py now have complete documentation
  • Simplified documentation paths by removing 'core-concepts' and 'quickstart' prefixes in index.rst

Bug Fixes

  • Fixed import paths in _base.py: changed references from brainstate to brainpy for consistency (057b872)
  • Fixed test suite issues (95ec203)
  • Fixed test suite for proper unit handling in synapse models

Code Quality

  • Refactored module assignments to brainpy.state for consistency across files (06b2bf4)
  • Refactored method calls in _base.py: replaced private methods with public counterparts (210426a)

Testing

  • Added comprehensive test suites for all new neuron models
  • Added AMPA and GABAa synapse tests
  • Added tests for Izhikevich neuron variants
  • Added tests for Hodgkin-Huxley model
  • All tests passing with proper unit handling

Files Modified

  • brainpy/__init__.py: Updated version to 2.7.1
  • brainpy/state/_base.py: Enhanced Dynamics class with improved input handling (447 lines added)
  • brainpy/state/_lif.py: Added extensive LIF neuron variants (1862 lines total)
  • brainpy/state/_izhikevich.py: New file with Izhikevich models (407 lines)
  • brainpy/state/_hh.py: New file with Hodgkin-Huxley model (666 lines)
  • brainpy/state/_synapse.py: Added BioNMDA model (158 lines)
  • brainpy/state/_projection.py: Updated for consistency (43 lines modified)
  • brainpy/state/__init__.py: Updated exports for new models
  • Test files added: _lif_test.py, _izhikevich_test.py, _hh_test.py, _synapse_test.py, _base_test.py
  • Documentation updates in docs_state/index.rst

Removed

  • Removed outdated documentation notebooks from docs_state/:
    • checkpointing-en.ipynb and checkpointing-zh.ipynb
    • snn_simulation-en.ipynb and snn_simulation-zh.ipynb
    • snn_training-en.ipynb and snn_training-zh.ipynb

Notes

  • This release significantly expands the brainpy.state module with biologically realistic neuron and synapse models
  • All new models are fully compatible with the brainstate ecosystem
  • Enhanced documentation provides clear usage examples for all models
  • The Dynamics class refactoring improves the foundation for future state-based model development

What's Changed

New Contributors

Full Changelog: V2.7.0...V2.7.1

Version 2.7.0

10 Oct 09:11
4a32348

Choose a tag to compare

Release Date: October 2025

This is a maintenance release focusing on documentation improvements and version management.

Major Changes

Version Management

  • Downgraded version numbering from 3.x series back to 2.7.0 to maintain consistency with the stable 2.x API
  • This release represents the continuation of the BrainPy 2.x series

Documentation

Documentation Structure

  • Streamlined table of contents in documentation
  • Added new sections for Core Concepts and Quickstart guides
  • Consolidated documentation sections for better clarity
  • Updated default build version to v2 in configuration
  • Improved documentation build process with better logging

Documentation Updates

  • Refactored index.rst for better organization
  • Updated documentation to reflect current module structure
  • Enhanced documentation build scripts

Testing

Test Cleanup

  • Removed redundant test for abstract Neuron class to avoid conflicts

Notes

  • This release maintains the stable BrainPy 2.x API
  • For users of BrainPy 2.x, no code changes are required
  • Documentation has been improved for better user experience

What's Changed

  • Rollback (#789)
  • Update documentation (#790, #791)
  • Update changelog for version 3.0.1 (#792)
  • Downgrade version to 2.7.0 in init.py (#792)
  • Documentation structure improvements

Full Changelog: V2.6.0...V2.7.0

Version 2.6.0

24 Mar 02:30
3e5dcbf

Choose a tag to compare

New Features

This release provides several new features, including:

  • MLIR registered operator customization interface in brainpy.math.XLACustomOp.
  • Operator customization with CuPy JIT interface.
  • Bug fixes.

What's Changed

New Contributors

Full Changelog: V2.5.0...V2.6.0

Version 2.5.0

01 Feb 07:18
6b6a62f

Choose a tag to compare

This release contains many new features and fixes. It is the first release with a mature solution for Brain Dynamics Operator Customization on both CPU and GPU platforms.

New Features

  1. Add synapse projection with Delta synapse models through brainpy.dyn.HalfProjDelta and brainpy.dyn.FullProjDelta.
  2. Add brainpy.math.exprel, and change the code in the corresponding HH neuron models to improve numerical computation accuracy. These changes can significantly improve the numerical integration accuracy of HH-like models under x32 computation.
  3. Add brainpy.reset_level() decorator so that the state resetting order can be customized by users.
  4. Add brainpy.math.ein_rearrange, brainpy.math.ein_reduce, and brainpy.math.ein_repeat functions
  5. Add brainpy.math.scan transformation.
  6. Rebase all customized operators using Taichi JIT compiler. On the CPU platform, the speed performance can be boosted ten to hundred times. On the GPU platforms, the flexibility can be greatly improved.
  7. Many bug fixes.
  8. A new version of brainpylib>=0.2.4 has been released, supporting operator customization through the Taichi compiler. The supported backends include Linux, Windows, MacOS Intel, and MacOS M1 platforms. Tutorials please see https://brainpy.readthedocs.io/en/latest/tutorial_advanced/operator_custom_with_taichi.html

What's Changed

New Contributors

Full Changelog: V2.4.6...V2.5.0