Skip to content

Commit

Permalink
Update infrastructure (#95)
Browse files Browse the repository at this point in the history
* Update copyright date

* Update python versions, move reqs to opt deps

* Update license handling
  • Loading branch information
rly authored Feb 8, 2025
1 parent 581a1e9 commit cecd156
Show file tree
Hide file tree
Showing 15 changed files with 158 additions and 243 deletions.
88 changes: 41 additions & 47 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,60 +19,54 @@ jobs:
fail-fast: false
matrix:
include:
- { name: linux-python3.8 , os: ubuntu-latest , python-ver: "3.8" }
- { name: linux-python3.11 , os: ubuntu-latest , python-ver: "3.11" }
- { name: linux-python3.12 , os: ubuntu-latest , python-ver: "3.12" }
- { name: windows-python3.8 , os: windows-latest , python-ver: "3.8" }
- { name: linux-python3.9 , os: ubuntu-latest , python-ver: "3.9" }
- { name: linux-python3.13 , os: ubuntu-latest , python-ver: "3.13" }
- { name: windows-python3.9 , os: windows-latest , python-ver: "3.9" }
- { name: windows-python3.10 , os: windows-latest , python-ver: "3.10" }
- { name: windows-python3.11 , os: windows-latest , python-ver: "3.11" }
- { name: windows-python3.12 , os: windows-latest , python-ver: "3.12" }
- { name: macos-python3.8 , os: macos-latest , python-ver: "3.8" }
- { name: macos-python3.11 , os: macos-latest , python-ver: "3.11" }
- { name: macos-python3.12 , os: macos-latest , python-ver: "3.12" }
- { name: windows-python3.13 , os: windows-latest , python-ver: "3.13" }
- { name: macos-python3.9 , os: macos-latest , python-ver: "3.9" }
- { name: macos-python3.13 , os: macos-latest , python-ver: "3.13" }
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-ver }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-ver }}

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install cookiecutter pynwb hdmf-docutils
python -m pip list
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install cookiecutter pynwb hdmf-docutils
python -m pip list
- name: Configure git
run: |
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
- name: Configure git
run: |
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
- name: Run template tests
run: |
python -m pip install pytest pytest-cookies
pytest tests
- name: Run template tests
run: |
python -m pip install pytest pytest-cookies
pytest tests
- name: Evaluate template from local source
run: |
cookiecutter -v --no-input --output-dir ./out .
- name: Evaluate template from local source
run: |
cookiecutter -v --no-input --output-dir ./out .
- name: Check generated files
run: |
python tests/test_bake_project.py ./out/ndx-my-namespace/ ndx-my-namespace
- name: Check generated files
run: |
python tests/test_bake_project.py ./out/ndx-my-namespace/ ndx-my-namespace
- name: Run PyNWB tests from generated extension
run: |
cd ./out/ndx-my-namespace
python -m pip install -r requirements-dev.txt
python -m pip install .
pytest
- name: Run PyNWB tests from generated extension
run: |
cd ./out/ndx-my-namespace
python -m pip install -U ".[test]"
pytest
- name: Build documentation from generated extension
run: |
set -e
cd ./out/ndx-my-namespace/docs
make apidoc
make html
- name: Build documentation from generated extension
run: |
set -e
cd ./out/ndx-my-namespace/docs
make apidoc
make html
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This repo provides a template for creating Neurodata Extensions (NDX) for the
[Neurodata Without Borders](https://nwb.org/)
data standard.

This template currently supports creating Neurodata Extensions only using Python 3.8+.
This template currently supports creating Neurodata Extensions only using Python 3.9+.
MATLAB support is in development.

## Getting started
Expand Down Expand Up @@ -68,7 +68,7 @@ When answering the cookiecutter prompts, you will be asked whether you would lik
3. Copy [`tetrode_series_widget.py`](https://github.com/nwb-extensions/ndx-template/blob/main/%7B%7B%20cookiecutter.namespace%20%7D%7D/src/pynwb/%7B%7B%20cookiecutter.py_pkg_name%20%7D%7D/widgets/tetrode_series_widget.py) to that directory and adapt the contents to your extension.
4. Create a directory named `notebooks` in the root of the repository.
5. Copy [example.ipynb](https://github.com/nwb-extensions/ndx-template/blob/main/%7B%7B%20cookiecutter.namespace%20%7D%7D/notebooks/example.ipynb) to that directory and adapt the contents to your extension.
6. Add `nwbwidgets` to `requirements-dev.txt`.
6. Add `nwbwidgets` to the `[project] dependencies` or `[project.optional-dependencies]` section of `pyproject.toml`.

## Maintainers
- [@rly](https://github.com/rly)
Expand All @@ -79,7 +79,7 @@ When answering the cookiecutter prompts, you will be asked whether you would lik

## Copyright

Neurodata Extensions Catalog (NDX Catalog) Copyright (c) 2021-2024,
Neurodata Extensions Catalog (NDX Catalog) Copyright (c) 2021-2025,
The Regents of the University of California, through Lawrence
Berkeley National Laboratory (subject to receipt of any required
approvals from the U.S. Dept. of Energy). All rights reserved.
Expand Down
4 changes: 2 additions & 2 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"author": "My Name",
"email": "[email protected]",
"github_username": "myname",
"copyright": "2024, {{ cookiecutter.author }}",
"copyright": "2025, {{ cookiecutter.author }}",
"version": "0.1.0",
"release": "alpha",
"license": ["BSD-3", "MIT", "Apache Software License 2.0", "Other"],
"license": ["BSD-3-Clause", "MIT", "Apache-2.0", "Other"],
"py_pkg_name": "{{ cookiecutter.namespace|replace('-', '_') }}",
"initialize_git": true,
"widgets": false,
Expand Down
2 changes: 1 addition & 1 deletion license.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Neurodata Extensions Catalog (NDX Catalog) Copyright (c) 2021-2024,
Neurodata Extensions Catalog (NDX Catalog) Copyright (c) 2021-2025,
The Regents of the University of California, through Lawrence
Berkeley National Laboratory (subject to receipt of any required
approvals from the U.S. Dept. of Energy). All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"

- name: Install Sphinx dependencies and package
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-dev.txt
python -m pip install .
python -m pip install -U ".[docs]"
python -m pip list
- name: Check Sphinx external links
run: |
Expand Down
2 changes: 1 addition & 1 deletion {{ cookiecutter.namespace }}/.github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Ruff
uses: chartboost/ruff-action@v1
uses: astral-sh/ruff-action@v3
139 changes: 25 additions & 114 deletions {{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,24 @@ jobs:
fail-fast: false
matrix:
include:
- { name: linux-python3.8-minimum , requirements: minimum , python-ver: "3.8" , os: ubuntu-latest }
- { name: linux-python3.8 , requirements: pinned , python-ver: "3.8" , os: ubuntu-latest }
- { name: linux-python3.9 , requirements: pinned , python-ver: "3.9" , os: ubuntu-latest }
- { name: linux-python3.10 , requirements: pinned , python-ver: "3.10", os: ubuntu-latest }
- { name: linux-python3.11 , requirements: pinned , python-ver: "3.11", os: ubuntu-latest }
- { name: linux-python3.12 , requirements: pinned , python-ver: "3.12", os: ubuntu-latest }
- { name: linux-python3.12-upgraded , requirements: upgraded , python-ver: "3.12", os: ubuntu-latest }
- { name: windows-python3.8-minimum , requirements: minimum , python-ver: "3.8" , os: windows-latest }
- { name: windows-python3.8 , requirements: pinned , python-ver: "3.8" , os: windows-latest }
- { name: windows-python3.9 , requirements: pinned , python-ver: "3.9" , os: windows-latest }
- { name: windows-python3.10 , requirements: pinned , python-ver: "3.10", os: windows-latest }
- { name: windows-python3.11 , requirements: pinned , python-ver: "3.11", os: windows-latest }
- { name: windows-python3.12 , requirements: pinned , python-ver: "3.12", os: windows-latest }
- { name: windows-python3.12-upgraded , requirements: upgraded , python-ver: "3.12", os: windows-latest }
- { name: macos-python3.8-minimum , requirements: minimum , python-ver: "3.8" , os: macos-latest }
- { name: macos-python3.8 , requirements: pinned , python-ver: "3.8" , os: macos-latest }
- { name: macos-python3.9 , requirements: pinned , python-ver: "3.9" , os: macos-latest }
- { name: macos-python3.10 , requirements: pinned , python-ver: "3.10", os: macos-latest }
- { name: macos-python3.11 , requirements: pinned , python-ver: "3.11", os: macos-latest }
- { name: macos-python3.12 , requirements: pinned , python-ver: "3.12", os: macos-latest }
- { name: macos-python3.12-upgraded , requirements: upgraded , python-ver: "3.12", os: macos-latest }
- { name: linux-python3.9-minimum , requirements: minimum , python-ver: "3.9" , os: ubuntu-latest }
- { name: linux-python3.9 , requirements: upgraded , python-ver: "3.9" , os: ubuntu-latest }
- { name: linux-python3.10 , requirements: upgraded , python-ver: "3.10", os: ubuntu-latest }
- { name: linux-python3.11 , requirements: upgraded , python-ver: "3.11", os: ubuntu-latest }
- { name: linux-python3.12 , requirements: upgraded , python-ver: "3.12", os: ubuntu-latest }
- { name: linux-python3.13 , requirements: upgraded , python-ver: "3.13", os: ubuntu-latest }
- { name: windows-python3.9-minimum , requirements: minimum , python-ver: "3.9" , os: windows-latest }
- { name: windows-python3.9 , requirements: upgraded , python-ver: "3.9" , os: windows-latest }
- { name: windows-python3.10 , requirements: upgraded , python-ver: "3.10", os: windows-latest }
- { name: windows-python3.11 , requirements: upgraded , python-ver: "3.11", os: windows-latest }
- { name: windows-python3.12 , requirements: upgraded , python-ver: "3.12", os: windows-latest }
- { name: windows-python3.13 , requirements: upgraded , python-ver: "3.13", os: windows-latest }
- { name: macos-python3.9-minimum , requirements: minimum , python-ver: "3.9" , os: macos-latest }
- { name: macos-python3.9 , requirements: upgraded , python-ver: "3.9" , os: macos-latest }
- { name: macos-python3.10 , requirements: upgraded , python-ver: "3.10", os: macos-latest }
- { name: macos-python3.11 , requirements: upgraded , python-ver: "3.11", os: macos-latest }
- { name: macos-python3.12 , requirements: upgraded , python-ver: "3.12", os: macos-latest }
- { name: macos-python3.13 , requirements: upgraded , python-ver: "3.13", os: macos-latest }
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand All @@ -51,31 +48,22 @@ jobs:
with:
python-version: ${{ "{{" }} matrix.python-ver }}

- name: Install build dependencies
- name: Install run requirements (minimum)
if: ${{ "{{" }} matrix.requirements == 'minimum' }}
run: |
python -m pip install --upgrade pip
python -m pip install ".[min-reqs,test]"
python -m pip list
python -m pip check
- name: Install run requirements (minimum)
if: ${{ "{{" }} matrix.requirements == 'minimum' }}
run: |
python -m pip install -r requirements-min.txt -r requirements-dev.txt
python -m pip install .
- name: Install run requirements (pinned)
if: ${{ "{{" }} matrix.requirements == 'pinned' }}
run: |
python -m pip install -r requirements-dev.txt
python -m pip install .
- name: Install run requirements (upgraded)
if: ${{ "{{" }} matrix.requirements == 'upgraded' }}
run: |
python -m pip install -r requirements-dev.txt
python -m pip install --upgrade pip
# force upgrade of all dependencies to latest versions within allowed range
python -m pip install -U --upgrade-strategy eager .
python -m pip install -U ".[test]"
python -m pip list
python -m pip check
- name: Run tests
run: |
pytest -v
Expand All @@ -101,80 +89,3 @@ jobs:
test-wheel-env/Scripts/activate.bat
python -m pip install dist/*-none-any.whl
python -c "import {{ cookiecutter.py_pkg_name }}"
run-all-tests-on-conda:
name: ${{ "{{" }} matrix.name }}
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0} # needed for conda environment to work
concurrency:
group: ${{ "{{" }} github.workflow }}-${{ "{{" }} github.ref }}-${{ "{{" }} matrix.name }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
include:
- { name: conda-linux-python3.8-minimum , requirements: minimum , python-ver: "3.8" , os: ubuntu-latest }
- { name: conda-linux-python3.8 , requirements: pinned , python-ver: "3.8" , os: ubuntu-latest }
- { name: conda-linux-python3.9 , requirements: pinned , python-ver: "3.9" , os: ubuntu-latest }
- { name: conda-linux-python3.10 , requirements: pinned , python-ver: "3.10", os: ubuntu-latest }
- { name: conda-linux-python3.11 , requirements: pinned , python-ver: "3.11", os: ubuntu-latest }
- { name: conda-linux-python3.12 , requirements: pinned , python-ver: "3.12", os: ubuntu-latest }
- { name: conda-linux-python3.12-upgraded , requirements: upgraded , python-ver: "3.12", os: ubuntu-latest }
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # tags are required to determine the version

- name: Set up Conda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
auto-activate-base: true
activate-environment: true
python-version: ${{ "{{" }} matrix.python-ver }}

- name: Install build dependencies
run: |
conda config --set always_yes yes --set changeps1 no
conda info
conda config --show-sources
conda list --show-channel-urls
- name: Install run requirements (minimum)
if: ${{ "{{" }} matrix.requirements == 'minimum' }}
run: |
python -m pip install -r requirements-min.txt -r requirements-dev.txt
python -m pip install .
- name: Install run requirements (pinned)
if: ${{ "{{" }} matrix.requirements == 'pinned' }}
run: |
python -m pip install -r requirements-dev.txt
python -m pip install .
- name: Install run requirements (upgraded)
if: ${{ "{{" }} matrix.requirements == 'upgraded' }}
run: |
python -m pip install -r requirements-dev.txt
# force upgrade of all dependencies to latest versions within allowed range
python -m pip install -U --upgrade-strategy eager .
- name: Run tests
run: |
pytest -v
- name: Build wheel and source distribution
run: |
python -m pip install --upgrade build
python -m build
ls -1 dist
- name: Test installation from a wheel (POSIX)
run: |
python -m venv test-wheel-env
source test-wheel-env/bin/activate
python -m pip install dist/*-none-any.whl
python -c "import {{ cookiecutter.py_pkg_name }}"
13 changes: 5 additions & 8 deletions {{ cookiecutter.namespace }}/.github/workflows/run_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
env: # used by codecov-action
OS: ${{ "{{" }} matrix.os }}
PYTHON: '3.12'
PYTHON: '3.13'
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand All @@ -33,16 +33,13 @@ jobs:
with:
python-version: ${{ "{{" }} env.PYTHON }}

- name: Install dependencies
- name: Install package and test dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-dev.txt
- name: Install package
run: |
python -m pip install .
# force upgrade of all dependencies to latest versions within allowed range
python -m pip install -U ".[test]"
python -m pip list
python -m pip check
- name: Run tests and generate coverage report
run: |
pytest --cov --cov-report=xml --cov-report=term # codecov uploader requires xml format
Expand Down
Loading

0 comments on commit cecd156

Please sign in to comment.