Skip to content

Conversation

@chaoming0625
Copy link
Member

@chaoming0625 chaoming0625 commented Oct 10, 2025

Summary by Sourcery

Refresh documentation to align with updated API conventions across tutorials and guides.

Enhancements:

  • Migrate tutorials and examples to import brainpy directly and use the brainpy.state namespace instead of the bp alias.
  • Replace all brainstate.compile.jit and brainstate.compile.for_loop usages with brainstate.transform.jit and brainstate.transform.for_loop.
  • Update ProgressBar references to use brainstate.transform.ProgressBar.
  • Adjust tutorial titles and headers for consistency.
  • Remove obsolete migration-guide.rst from documentation.

Documentation:

  • Revise Jupyter notebooks and .rst files to reflect API naming changes and updated imports.

@sourcery-ai
Copy link

sourcery-ai bot commented Oct 10, 2025

Reviewer's Guide

This PR aligns documentation with recent API updates by standardizing Brainpy imports, migrating compile-based transforms to the new transform namespace, and cleaning up outdated guides.

Class diagram for updated Brainpy API usage in documentation

classDiagram
    class LIF {
        <<stateful neuron>>
        V_rest
        V_th
        V_reset
        tau
        spk_reset
        spike_fun
    }
    class Expon {
        <<stateful synapse>>
        tau
        g_initializer
    }
    class Alpha {
        <<stateful synapse>>
        tau
        g_initializer
    }
    class AMPA {
        <<stateful synapse>>
        tau
        g_initializer
    }
    class GABAa {
        <<stateful synapse>>
        tau
        g_initializer
    }
    class Readout {
        <<stateful layer>>
        weight_initializer
    }
    class AlignPostProj {
        <<stateful projection>>
        comm
        syn
        out
        post
    }
    class Synapse {
        <<stateful synapse base>>
    }
    LIF --|> "Synapse"
    Expon --|> "Synapse"
    Alpha --|> "Synapse"
    AMPA --|> "Synapse"
    GABAa --|> "Synapse"
    AlignPostProj --> LIF
    AlignPostProj --> Expon
    AlignPostProj --> Readout
    Synapse <|-- STDSynapse
    Synapse <|-- STFSynapse
    Synapse <|-- STDPSynapse
    Synapse <|-- DoubleExpSynapse
Loading

File-Level Changes

Change Details Files
Standardize Brainpy imports and module usage
  • Replace 'import brainpy as bp' with 'import brainpy'
  • Prefix neuron, projection and synapse classes with 'brainpy.state.' instead of 'bp.' or bare 'brainpy.'
  • Update component descriptors (e.g. Expon, CUBA, COBA) to use 'brainpy.state.*'
docs_state/tutorials/basic/*.ipynb
docs_state/tutorials/advanced/*.ipynb
docs_state/snn_simulation-*.ipynb
docs_state/snn_training-*.ipynb
Switch JIT and loop transforms from compile to transform namespace
  • Replace '@brainstate.compile.jit' with '@brainstate.transform.jit'
  • Use 'brainstate.transform.for_loop' instead of 'brainstate.compile.for_loop'
  • Update ProgressBar calls to use 'brainstate.transform.ProgressBar'
docs_state/tutorials/advanced/*.ipynb
docs_state/snn_simulation-*.ipynb
docs_state/snn_training-*.ipynb
Documentation cleanup and metadata updates
  • Update 5-minute tutorial title to remove legacy module reference
  • Remove the obsolete migration-guide.rst
  • Sync index and API .rst files with updated module structure
docs_state/quickstart/5min-tutorial.ipynb
docs_state/migration/migration-guide.rst
docs_state/index.rst
docs_state/api/*.rst

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@chaoming0625 chaoming0625 merged commit a6d6909 into master Oct 10, 2025
11 of 18 checks passed
@chaoming0625 chaoming0625 deleted the update branch October 10, 2025 07:06
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Oct 10, 2025
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • Please update the migration guide to explicitly document the renaming of bp.* to brainpy.state.* and brainstate.compile.jit to brainstate.transform.jit so users know how to upgrade.
  • Consider consolidating your imports (e.g. import brainpy.state as state) at the top of each notebook to reduce repeated brainpy.state. prefixes in code examples.
  • Do a quick sweep to ensure there are no remaining bp. or brainstate.compile.jit references in code snippets or explanatory text to avoid confusion.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Please update the migration guide to explicitly document the renaming of bp.* to brainpy.state.* and brainstate.compile.jit to brainstate.transform.jit so users know how to upgrade.
- Consider consolidating your imports (e.g. `import brainpy.state as state`) at the top of each notebook to reduce repeated `brainpy.state.` prefixes in code examples.
- Do a quick sweep to ensure there are no remaining `bp.` or `brainstate.compile.jit` references in code snippets or explanatory text to avoid confusion.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants