Skip to content

Commit 78de3b5

Browse files
authored
v0.2.0 (#68)
- Added an automated CI/CD pipeline to publish releases to PyPI. - Enabled dynamic package versioning and updated build configuration and packaging requirements (uses setuptools-scm). - Added RELEASE.md (release guide documenting versioning conventions and release steps). - Updated the CHANGELOG.
1 parent 4921179 commit 78de3b5

File tree

7 files changed

+162
-4
lines changed

7 files changed

+162
-4
lines changed

.github/workflows/publish.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
validate-tag:
10+
name: Validate tag follows RELEASE.md
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Set up Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: "3.10"
17+
18+
- name: Validate tag format
19+
run: |
20+
TAG="${{ github.ref_name }}"
21+
22+
python << EOF
23+
import re
24+
25+
tag = '$TAG'
26+
27+
# Check for valid patterns: vX.Y.Z, vX.Y.ZrcN, vX.Y.ZaN, vX.Y.ZbN
28+
# With optional .postN suffix: vX.Y.Z.postN, vX.Y.ZrcN.postN, etc.
29+
# Where X, Y, Z, N are numbers
30+
pattern = r'^v\d+\.\d+\.\d+(rc\d+|a\d+|b\d+)?(\.post\d+)?$'
31+
32+
if not re.match(pattern, tag):
33+
print(f'✗ Tag {tag} does not match required format (per RELEASE.md)')
34+
print(' Valid formats: vX.Y.Z, vX.Y.ZrcN, vX.Y.ZaN, vX.Y.ZbN')
35+
print(' With optional .postN: vX.Y.Z.postN, vX.Y.ZrcN.postN, etc.')
36+
print(' Where X, Y, Z, N are numbers')
37+
exit(1)
38+
39+
print(f'✓ Tag {tag} is valid')
40+
EOF
41+
42+
build:
43+
name: Build distribution 📦
44+
needs: validate-tag
45+
runs-on: ubuntu-latest
46+
47+
steps:
48+
- uses: actions/checkout@v4
49+
with:
50+
fetch-depth: 0 # IMPORTANT: Required for setuptools-scm to see tags!
51+
persist-credentials: false
52+
53+
- name: Set up Python
54+
uses: actions/setup-python@v5
55+
with:
56+
python-version: "3.10"
57+
58+
- name: Install uv
59+
uses: astral-sh/setup-uv@v4
60+
with:
61+
enable-cache: true
62+
63+
- name: Build a binary wheel and a source tarball
64+
run: uv build
65+
66+
- name: Store the distribution packages
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: python-package-distributions
70+
path: dist/
71+
72+
publish-to-pypi:
73+
name: Publish Python 🐍 distribution 📦 to PyPI
74+
needs: build
75+
runs-on: ubuntu-latest
76+
environment:
77+
name: pypi
78+
url: https://pypi.org/p/brainsets
79+
permissions:
80+
id-token: write # IMPORTANT: mandatory for trusted publishing
81+
82+
steps:
83+
- name: Download all the dists
84+
uses: actions/download-artifact@v4
85+
with:
86+
name: python-package-distributions
87+
path: dist/
88+
89+
- name: Publish distribution 📦 to PyPI
90+
uses: pypa/gh-action-pypi-publish@release/v1

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,26 @@
33
All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6+
## [Unreleased]
7+
### Added
8+
9+
### Removed
10+
11+
### Changed
12+
13+
## [0.2.0] - 2025-12-24
14+
### Added
15+
- New brainset pipeline: `allen_visual_coding_ophys_2016` ([#16](https://github.com/neuro-galaxy/brainsets/pull/16)).
16+
- Added `STEREO_EEG` to `RecordingTech` enum ([#36](https://github.com/neuro-galaxy/brainsets/pull/36)).
17+
- Added `BrainsetPipeline` definition with a `brainset.runner` module to run `BrainsetPipeline` in parallel ([#37](https://github.com/neuro-galaxy/brainsets/pull/37)).
18+
- Added support for PEP723-style inline metadata blocks to specify Python version and dependencies in a `pipeline.py` file ([#62](https://github.com/neuro-galaxy/brainsets/pull/62)).
19+
- New brainset pipeline: `kemp_sleep_edf_2013` ([#54](https://github.com/neuro-galaxy/brainsets/pull/54)).
20+
21+
### Changed
22+
- Fixed issue with "test" session being overwritten in the `perich_miller_population_2018` pipeline ([#25](https://github.com/neuro-galaxy/brainsets/pull/25)).
23+
- Updated all existing pipelines with `BrainsetPipeline` and dependencies in metadata block ([#37](https://github.com/neuro-galaxy/brainsets/pull/37) and [#62](https://github.com/neuro-galaxy/brainsets/pull/62)).
24+
25+
626
## [0.1.3] - 2025-10-27
727
### Added
828
- Added support for python 3.12 and 3.13 ([#14](https://github.com/neuro-galaxy/brainsets/pull/30)).

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ pip install brainsets
3030
| odoherty_sabes_nonhuman_2017 | [Link](https://brainsets.readthedocs.io/en/latest/glossary/brainsets.html#odoherty-sabes-nonhuman-2017) | 22 GB | 26 GB |
3131
| pei_pandarinath_nlb_2021 | [Link](https://brainsets.readthedocs.io/en/latest/glossary/brainsets.html#pei-pandarinath-nlb-2021) | 688 KB | 22 MB |
3232
| perich_miller_population_2018 | [Link](https://brainsets.readthedocs.io/en/latest/glossary/brainsets.html#perich-miller-population-2018) | 13 GB | 2.9 GB |
33+
| kemp_sleep_edf_2013 | TBA | 8.2 GB | 60 GB |
34+
| allen_visual_coding_ophys_2016 | TBA | 356 GB | 58 GB |
3335

3436

3537
## Acknowledgements

RELEASE.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Releasing to PyPI
2+
3+
1. Ensure `main` is ready to release.
4+
2. Make sure `CHANGELOG.md` is up to date (review commit history to verify, open a Release PR if changes are needed).
5+
3. Verify the version in `CHANGELOG.md` matches the version you're about to tag.
6+
4. If a new brainset pipeline has been added, verify that it is mentioned in the project README.
7+
5. Create and push the release tag ([see here](#valid-version-numbers-and-their-meaning) for version syntax).
8+
9+
```bash
10+
$ git checkout main
11+
$ git pull origin main
12+
$ git tag vX.Y.Z
13+
$ git push origin vX.Y.Z
14+
```
15+
16+
6. Monitor the GitHub Actions workflow to ensure the build and publish succeed.
17+
7. Add a GitHub Release with a small description of changes from the last release.
18+
19+
**Note:** Tags must start with "v" for the publishing GitHub Action to begin.
20+
21+
## Valid version numbers and their meaning
22+
23+
- For version number, we follow [SemVer](https://semver.org/) (major.minor.patch).
24+
- For pre-release tags, we follow the [PEP440](https://peps.python.org/pep-0440/) syntax:
25+
```
26+
vX.Y.ZaN # Alpha release
27+
vX.Y.ZbN # Beta release
28+
vX.Y.ZrcN # Release candidate
29+
vX.Y.Z # Final release
30+
```
31+
- For post-release tags, we also follow the [PEP440](https://peps.python.org/pep-0440/) syntax:
32+
- `vY.Y.Z.postN`, `vX.Y.Z.aN.postM`, ...
33+
- Post releases are only meant for metadata/distribution related corrections, and not code edits

brainsets/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
__version__ = "0.1.0"
1+
from importlib.metadata import version, PackageNotFoundError
22

33
from .core import serialize_fn_map
4+
5+
try:
6+
__version__ = version("brainsets")
7+
except PackageNotFoundError: # pragma: no cover
8+
# This can happen if someone is importing brainsets without installing
9+
__version__ = "unknown" # pragma: no cover

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[build-system]
2-
requires = ["setuptools>=60.2.0"]
2+
requires = ["setuptools>=80", "setuptools-scm[simple]>=8"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "brainsets"
7-
version = "0.1.3"
7+
dynamic = ["version"]
88
description = "A package for processing neural datasets"
99
readme = "README.md"
1010
authors = [{ name = "Mehdi Azabou", email = "mehdiazabou@gmail.com" }]
@@ -32,7 +32,8 @@ dependencies = [
3232
"prompt_toolkit",
3333
"numpy>=1.14.0",
3434
"pulp<2.8",
35-
"ray>=2.30.0",
35+
"ray>=2.30.0,<2.52.0; python_version < \"3.10\"", # ray 2.52.0+ dropped support for Py3.9
36+
"ray>=2.30.0; python_version >= \"3.10\"",
3637
"tomli; python_version < \"3.11\"", # tomllib was not part of stddlib before 3.11
3738
]
3839

tests/test_version.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import brainsets
2+
3+
4+
def test_version_exists():
5+
assert hasattr(brainsets, "__version__")
6+
assert len(brainsets.__version__) > 0

0 commit comments

Comments
 (0)