Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: '4346961'
_src_path: https://github.com/AllenNeuralDynamics/python-templates
author_name: Neural Dynamics accelerator at the Allen Institute
initial_version: 0.0.0
level_of_support: Supported
max_python_target_version: '3.14'
min_python_target_version: '3.10'
package_name: giant_python
project_created_date: '2026-03-27'
project_description: Glutamate Imaging Analysis Toolbox, Python implementation
project_name: GIAnT-Python
project_url: ''
release_type: GitHub
repo_visibility: public
template_type: library-template

11 changes: 0 additions & 11 deletions .flake8

This file was deleted.

2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto
uv.lock linguist-generated
24 changes: 0 additions & 24 deletions .github/workflows/lint.yml

This file was deleted.

84 changes: 20 additions & 64 deletions .github/workflows/tag_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,28 @@ on:
push:
branches:
- main
# Set the publish job's "if" condition to true to enable PyPI publishing.
# Requires that svc-aindscicomp be added as an admin to repo.

jobs:
update_badges:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v7
with:
ref: ${{ env.DEFAULT_BRANCH }}
fetch-depth: 0
token: ${{ secrets.SERVICE_TOKEN }}
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install -e . --group dev --no-cache-dir
- name: Get Python version and Update README.md
run: |
python_version=$(grep "requires-python" pyproject.toml | grep -o ">=[^\"]*")
python_badge=$(grep '^\!\[Python\]' README.md | sed -n 's/.*\(python-[^)]*\).*/\1/p')
new_python_badge="python-$python_version-blue?logo=python"
sed -i "s/$python_badge/$new_python_badge/g" README.md
- name: Get interrogate values and Update README.md
run: |
interrogate_val=$(interrogate . | grep -o 'actual: [0-9]*\.[0-9]*' | awk '{print $2}')
interrogate_badge=$(grep '^\!\[Interrogate\]' README.md | sed -n 's/.*\(interrogate-[^)]*\).*/\1/p')
if (( $(echo "$interrogate_val >= 90.00" | bc -l) )); then
new_interrogate_badge="interrogate-$interrogate_val%25-brightgreen"
elif (( $(echo "$interrogate_val < 80.00" | bc -l) )); then
new_interrogate_badge="interrogate-$interrogate_val%25-red"
else
new_interrogate_badge="interrogate-$interrogate_val%25-yellow"
fi
sed -i "s/$interrogate_badge/$new_interrogate_badge/g" README.md
- name: Commit changes
uses: EndBug/add-and-commit@v10
with:
default_author: github_actions
message: "ci: update badges [skip actions]"
add: '["README.md"]'
uses: AllenNeuralDynamics/.github/.github/workflows/python_library_template_update_badges_v0_0_1.yml@main
with:

app-id: ${{ vars.SEMANTIC_RELEASE_BOT_APP_ID }}

secrets:

app-private-key: ${{ secrets.SEMANTIC_RELEASE_BOT_PRIVATE_KEY }}


tag:
needs: update_badges
uses: AllenNeuralDynamics/.github/.github/workflows/release-bump-version.yml@main
uses: AllenNeuralDynamics/.github/.github/workflows/python_library_template_tag_v0_0_1.yml@main
Comment thread
varndorfer marked this conversation as resolved.
Resolved
with:

app-id: ${{ vars.SEMANTIC_RELEASE_BOT_APP_ID }}

secrets:
repo-token: ${{ secrets.SERVICE_TOKEN }}
publish:
needs: tag
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Pull latest changes
run: git pull origin main
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install --upgrade setuptools wheel twine build
python -m build
twine check dist/*
- name: Publish on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.AIND_PYPI_TOKEN }}

app-private-key: ${{ secrets.SEMANTIC_RELEASE_BOT_PRIVATE_KEY }}


31 changes: 31 additions & 0 deletions .github/workflows/tests_and_format_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Run test and format checks

on:
pull_request:
branches:
- dev
- main

jobs:
test_and_format_checks:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v6

- name: Set up Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync
- name: Check docstring coverage
run: uv run interrogate --verbose
- name: Run format checks
run: uv run ruff check
- name: Check tests and test coverage
run: uv run pytest


13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,19 @@ MANIFEST
pip-log.txt
pip-delete-this-directory.txt

# Tool caches
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
Expand Down
92 changes: 26 additions & 66 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
# Contributing

### Development setup
We welcome contributions! We have documented our development practices and guidelines at (Software Practices) [https://docs.allenneuraldynamics.org/en/latest/policies_practices/software_practices.html].

From the repository root, install the package and development tools with pip 25.1 or later:
In general, we use uv, pytest, ruff, and interrogate for out local development.

### Installation

To install the dependencies needed for local development:
```bash
pip install -e . --group dev
uv sync --group dev
```

Alternatively, use `uv sync`. Interactive ROI work also requires tkinter in the Python installation.
To install the dependencies to build the documentation locally:
```bash
uv sync --group docs
```

### Code quality
### Linters and testing

Use the following tools to check documentation and maintain code style.

- Use **interrogate** to check that modules, methods, etc. have been documented thoroughly:
- Please test your changes using the **pytest** library, which will run the tests and log a coverage report:

```bash
interrogate .
uv run pytest .
```

- Use **flake8** to check that code is up to standards (no unused imports, etc.):
```bash
flake8 .
```
- Use **interrogate** to check that modules, methods, etc. have been documented thoroughly:

- Use **black** to automatically format the code into PEP standards:
```bash
black .
uv run interrogate .
```

- Use **isort** to automatically sort import statements:
- Use **ruff** to check that code is up to standards and auto-format:
```bash
isort .
uv run ruff check --fix
uv run ruff format
```

### Pull requests
Expand All @@ -44,13 +45,14 @@ For internal members, please create a branch. For external members, please fork

where scope (optional) describes the packages affected by the code changes and type (mandatory) is one of:

- **build**: Changes that affect build tools or external dependencies (example scopes: pyproject.toml, setup.py)
- **build**: Changes that affect build tools or external dependencies (example scopes: pyproject.toml)
- **ci**: Changes to our CI configuration files and scripts (examples: .github/workflows/ci.yml)
- **docs**: Documentation only changes
- **feat**: A new feature
- **fix**: A bugfix
- **perf**: A code change that improves performance
- **refactor**: A code change that neither fixes a bug nor adds a feature
- **test**: Adding missing tests or correcting existing tests

### Semantic Release

Expand All @@ -63,55 +65,13 @@ The table below, from [semantic release](https://github.com/semantic-release/sem
| `perf(pencil): remove graphiteWidth option`<br><br>`BREAKING CHANGE: The graphiteWidth option has been removed.`<br>`The default graphite width of 10mm is always used for performance reasons.` | ~~Major~~ Breaking Release <br /> (Note that the `BREAKING CHANGE: ` token must be in the footer of the commit and need to be all caps as shown) |

### Documentation

The maintained Sphinx pages include a curated public API reference; do not regenerate them with `sphinx-apidoc`.
Build the documentation and treat warnings as errors:

To generate the rst files source files for documentation, run
```bash
sphinx-build -b html -n -W --keep-going docs/source/ docs/build/html
uv run sphinx-apidoc -o docs/source/ src
```

External API links use Python, NumPy, and h5py inventories downloaded by Sphinx; a clean build requires network access to those documentation sites.

Keep the README focused on running BandSILo. Put option and staging details in [API and data conventions](docs/source/migration.rst), scientific details in [trace estimation](docs/source/traces.rst), schemas in [file formats](docs/source/file_formats.rst), and ownership decisions in [architecture](docs/source/architecture.rst).

### Read the Docs Deployment
Note: Private repositories require **Read the Docs for Business** account. The following instructions are for a public repo.

The following are required to import and build documentations on *Read the Docs*:
- A *Read the Docs* user account connected to Github. See [here](https://docs.readthedocs.com/platform/stable/guides/connecting-git-account.html) for more details.
- *Read the Docs* needs elevated permissions to perform certain operations that ensure that the workflow is as smooth as possible, like installing webhooks. If you are not the owner of the repo, you may have to request elevated permissions from the owner/admin.
- A **.readthedocs.yaml** file in the root directory of the repo. Here is a basic template:
```yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version, and other tools you might need
build:
os: ubuntu-24.04
tools:
python: "3.13"

# Path to a Sphinx configuration file.
sphinx:
configuration: docs/source/conf.py

# Declare the Python requirements required to build your documentation
python:
install:
- method: pip
path: .
extra_requirements:
- dev
Then to create the documentation HTML files, run
```bash
uv run sphinx-build -b html docs/source/ docs/build/html
```
More info on sphinx installation can be found [here](https://www.sphinx-doc.org/en/master/usage/installation.html).

Here are the steps for building docs in *Read the Docs*. See [here](https://docs.readthedocs.com/platform/stable/intro/add-project.html) for detailed instructions:
- From *Read the Docs* dashboard, click on **Add project**.
- For automatic configuration, select **Configure automatically** and type the name of the repo. A repo with public visibility should appear as you type.
- Follow the subsequent steps.
- For manual configuration, select **Configure manually** and follow the subsequent steps

Once a project is created successfully, you will be able to configure/modify the project's settings; such as **Default version**, **Default branch** etc.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Allen Institute for Neural Dynamics
Copyright (c) 2026-03-27 Neural Dynamics accelerator at the Allen Institute

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading