v0.1.9
Version 0.1.9 (2026-05-21)
This release introduces braintools.cogtask, a composable framework for
constructing cognitive tasks for neural-network training and computational
neuroscience experiments. It also extends braintools.init to accept
brainstate.nn.Param, adds official Python 3.14 support, and refreshes
documentation and CI infrastructure.
Highlights
- New module
braintools.cogtask: a phase-based DSL for building
trial-structured cognitive tasks, with a library of pre-built paradigms
drawn from the cognitive-neuroscience literature. - Variable-length trials under JIT/vmap: shape-stable packed-mode trial
generation enablesbatch_sampleto remain compatible with
brainstate.transform.jitandbrainstate.transform.vmap2for tasks whose
phases have data-dependent durations. - Python 3.14 support: CI matrix and project metadata updated; minimum
supported Python remains 3.11.
Added
braintools.cogtask — composable cognitive task framework
- Core API:
Task,TaskConfig,Context,Phase,Sequence,
Repeat,Parallel, conditional combinatorsIf/Switch/While,
and theconcathelper for sequential composition. - Phase primitives:
Fixation,Delay,Stimulus,Response,Cue,
plus the variable-lengthVariableDurationphase whose timestep budget is
resolved per-trial from a context entry. - Feature and label utilities:
Feature,circular,one_hot, and a
set of input encoders/decoders for constructing task observations and
targets in a typed, composable way. - Pre-built task library spanning three domains:
- Decision making:
PerceptualDecisionMaking,
PerceptualDecisionMakingDelayResponse,ContextDecisionMaking,
SingleContextDecisionMaking,PulseDecisionMaking. - Working memory:
DelayMatchSample,DualDelayMatchSample,
DelayComparison,DelayMatchCategory,DelayPairedAssociation,
GoNoGo,IntervalDiscrimination,PostDecisionWager,ReadySetGo,
DelayDirectionReproduction,ImmediateDirectionReproduction,
DelayDirectionClassification,ImmediateDirectionClassification. - Motor and reasoning:
AntiReach,Reaching1D,EvidenceAccumulation,
HierarchicalReasoning,ProbabilisticReasoning.
- Decision making:
- Variable-length trial sequences:
VariableDurationphases declare a Pythonmax_steps(used as the
buffer slot size) and report the realised trial length via the traced
step_countfield.Taskauto-detects variable-length phase trees via
phase_tree_is_variable(phases). When any phase declares
is_variable = True,sample_trialallocates buffers of size
task.max_trial_duration(), writes only the frontt_cursortimesteps,
and zero-fills the trailing positions while setting the mask toFalse.Task.batch_sample(..., return_mask=True)returns(X, Y, mask)with
shape-stable buffers underbrainstate.transform.jitand
brainstate.transform.vmap2. Fixed-length tasks remain unaffected;
return_mask=Trueon a fixed task yields an all-Truemask.Ifusesjax.lax.condso both branches contribute shape-stable
output;SwitchandWhileuse Python dispatch (concrete keys /
Pythonboolconditions) and zero-pad to the static maximum.HierarchicalReasoning,IntervalDiscrimination, andReadySetGo
have been migrated toVariableDurationand are now usable under
batch_samplewith masking — previously they were valid only via
sample_trialand were not vmap-safe.- Duration samplers
TruncExpandUniformDurationadvertise
is_variable = Trueand exposemax_value()/min_value()so phases
can size their slots statically from sampler bounds.
Other additions
braintools.init.param: now acceptsbrainstate.nn.Paraminstances
in addition to plain initializers, enabling reuse of pre-built parameter
objects when constructing layers..gitattributes: normalises line endings for text files to keep
diffs and tooling consistent across platforms.
Changed
- Python support: project metadata, CI matrix, and classifiers updated
to include Python 3.14. Minimum supported Python remains 3.11. - Documentation hosting: docs are now self-hosted at
brainx.chaobrain.com/braintools/; the documentation deployment workflow
publishes on GitHub release events, while pushes tomainrun a
build-only verification step. - Documentation dependencies: bumped
sphinx(>=5→>=9.0.4),
sphinx-book-theme(>=1.0.1→>=1.2.0),
sphinx-copybutton(>=0.5.0→>=0.5.2),
jupyter-sphinx(>=0.3.2→>=0.5.3), andbrainx-sphinx-header.
Fixed
braintools.cogtaskend-to-end correctness pass (introduced together
with the module):- Renamed
cogtask/typing.pytocogtask/_typing.pyso the local module
no longer shadows the stdlibtypingwhen tests run from inside the
package; updated the absolute import infeature.pyto the relative
from ._typing import Data. - Added the missing
noise_sigmaargument and attribute to
PerceptualDecisionMaking,
PerceptualDecisionMakingDelayResponse,ContextDecisionMaking,
SingleContextDecisionMaking,AntiReach,Reaching1D,
EvidenceAccumulation,DelayPairedAssociation,GoNoGo, and
PostDecisionWager, which previously raisedAttributeErroras soon
asdefine_phasesran. - Removed a duplicate
Task.__repr__and an undocumentedTaskLoader
symbol from the public docs.
- Renamed
- Phase engine: added an
IS_COMPOUNDflag onPhaseand a uniform
children()traversal hook.execute_phasenow dispatches
Sequence/Repeat/Parallel/If/Switch/Whileto their own
execute()methods; previously,If/Switch/Whilesilently no-op'd.
Parallel.executenow gives each child its own
[phase_start, phase_start + duration)window. - Distance-profile tests: representation-equality checks corrected so
the test suite is stable across NumPy/JAX representations.
Infrastructure
- Bumped GitHub Actions:
actions/checkout4 → 6,
actions/setup-python5 → 6,actions/download-artifact5 → 8,
actions/upload-artifact6 → 7,appleboy/ssh-action1.2.0 → 1.2.5,
appleboy/scp-action0.1.7 → 1.0.0. - Refactored version management: a dedicated
braintools/_version.py
module is now the single source of truth, andpyproject.tomlresolves
the package version viaattr = "braintools._version.__version__".