From 2df7fc484406450aebb9a048ffb6558a045ba72e Mon Sep 17 00:00:00 2001 From: rly Date: Tue, 13 Sep 2022 23:12:36 -0700 Subject: [PATCH 01/21] First pass --- hooks/post_gen_project.py | 11 +- .../workflows/check_external_links.yml | 34 +++ .../.github/workflows/run_all_tests.yml | 200 ++++++++++++++++++ .../.github/workflows/run_coverage.yml | 58 +++++ .../.github/workflows/run_flake8.yml | 30 +++ .../requirements-min.txt | 3 + .../requirements-opt.txt | 3 + 7 files changed, 337 insertions(+), 2 deletions(-) create mode 100644 {{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml create mode 100644 {{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml create mode 100644 {{ cookiecutter.namespace }}/.github/workflows/run_coverage.yml create mode 100644 {{ cookiecutter.namespace }}/.github/workflows/run_flake8.yml create mode 100644 {{ cookiecutter.namespace }}/requirements-min.txt create mode 100644 {{ cookiecutter.namespace }}/requirements-opt.txt diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index a11e311..750d8bf 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -2,7 +2,7 @@ import textwrap from hdmf_docutils.init_sphinx_extension_doc import main as init_sphinx_extension_doc -from subprocess import check_call +from subprocess import CalledProcessError, check_call def _generate_doc(): @@ -30,7 +30,14 @@ def _initialize_git(): check_call(["git", "init"]) check_call(["git", "add", "-A"]) check_call(["git", "commit", "-m", "Initial commit"]) - check_call(["git", "branch", "-m", "master", "main"]) + try: + # check if the installed version of git created a master branch by default + # and if so, rename the branch to "main" + check_call(["git", "show-ref", "--verify", "--quiet", "refs/heads/master"]) + check_call(["git", "branch", "-m", "master", "main"]) + except CalledProcessError: + pass + def main(): diff --git a/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml b/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml new file mode 100644 index 0000000..2a19133 --- /dev/null +++ b/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml @@ -0,0 +1,34 @@ +name: Check Sphinx external links +on: + pull_request: + schedule: + - cron: '0 5 * * *' # once per day at midnight ET + workflow_dispatch: + +jobs: + check-external-links: + runs-on: ubuntu-latest + steps: + - name: Cancel any previous incomplete runs + uses: styfle/cancel-workflow-action@0.9.1 + with: + all_but_latest: true + access_token: ${{ "{{" }} github.token }} + + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.10' + + - name: Install Sphinx dependencies and package + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements-dev.txt -r requirements.txt + python -m pip install . + + - name: Check Sphinx external links + run: sphinx-build -b linkcheck ./docs/source ./test_build diff --git a/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml b/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml new file mode 100644 index 0000000..3b93428 --- /dev/null +++ b/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml @@ -0,0 +1,200 @@ +name: Run all tests +on: + schedule: + - cron: '0 5 * * *' # once per day at midnight ET + pull_request: + push: + workflow_dispatch: + +jobs: + run-all-tests: + # the only differences between this job and "run_tests.yml" is the "strategy.matrix.include" and the upload + # distributions step. + # GitHub Actions does not yet support YAML anchors, easily reusable components, or easy dynamic matrix + # configurations based on the github event, so this job is duplicated for the most part + name: ${{ "{{" }} matrix.name }} + runs-on: ${{ "{{" }} matrix.os }} + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + include: + - { name: linux-python3.7-minimum , requirements: minimum , python-ver: "3.7" , os: ubuntu-latest } + - { name: linux-python3.7 , requirements: pinned , python-ver: "3.7" , 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.10-optional , requirements: optional , python-ver: "3.10", os: ubuntu-latest } + - { name: linux-python3.10-upgraded , requirements: upgraded , python-ver: "3.10", os: ubuntu-latest } + - { name: windows-python3.7-minimum , requirements: minimum , python-ver: "3.7" , os: windows-latest } + - { name: windows-python3.7 , requirements: pinned , python-ver: "3.7" , 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.10-optional , requirements: optional , python-ver: "3.10", os: windows-latest } + - { name: windows-python3.10-upgraded , requirements: upgraded , python-ver: "3.10", os: windows-latest } + - { name: macos-python3.7-minimum , requirements: pinned , python-ver: "3.7" , os: macos-latest } + - { name: macos-python3.7 , requirements: pinned , python-ver: "3.7" , 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.10-optional , requirements: optional , python-ver: "3.10", os: macos-latest } + - { name: macos-python3.10-upgraded , requirements: upgraded , python-ver: "3.10", os: macos-latest } + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: ${{ "{{" }} matrix.python-ver }} + + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + python -m pip list + python -m pip check + + - name: Install run requirements (minimal) + if: ${{ "{{" }} matrix.requirements }} == "minimum" + run: | + python -m pip install -r requirements-min.txt -r requirements-dev.txt + python -m pip install -e . + + - name: Install run requirements (pinned) + if: ${{ "{{" }} matrix.requirements }} == "pinned" + run: | + python -m pip install -r requirements.txt -r requirements-dev.txt + python -m pip install -e . + + - name: Install run requirements (pinned, optional) + if: ${{ "{{" }} matrix.requirements }} == "optional" + run: | + python -m pip install -r requirements.txt -r requirements-opt.txt -r requirements-dev.txt + python -m pip install -e . + + - name: Install run requirements (upgraded, optional) + if: ${{ "{{" }} matrix.requirements }} == "upgraded" + run: | + python -m pip install -r requirements-opt.txt -r requirements-dev.txt + python -m pip install -U -e . + + - 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) + if: ${{ "{{" }} matrix.os }} != "windows-latest" + run: | + python -m venv test-wheel-env + source test-wheel-env/bin/activate + python -m pip install dist/*-none-any.whl + python -c "import hdmf" + + - name: Test installation from a wheel (windows) + if: ${{ "{{" }} matrix.os }} == "windows-latest" + run: | + python -m venv test-wheel-env + test-wheel-env/Scripts/activate.bat + python -m pip install dist/*-none-any.whl + python -c "import hdmf" + + run-all-tests-on-conda: + name: ${{ "{{" }} matrix.name }} + runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} # needed for conda environment to work + strategy: + fail-fast: false + matrix: + include: + - { name: conda-linux-python3.7-minimum , requirements: minimum , python-ver: "3.7" , os: ubuntu-latest } + - { name: conda-linux-python3.7 , requirements: pinned , python-ver: "3.7" , 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.10-optional , requirements: optional , python-ver: "3.10", os: ubuntu-latest } + - { name: conda-linux-python3.10-upgraded , requirements: upgraded , python-ver: "3.10", os: ubuntu-latest } + steps: + - name: Cancel any previous incomplete runs + uses: styfle/cancel-workflow-action@0.9.1 + with: + access_token: ${{ "{{" }} github.token }} + + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + + - name: Set up Conda + uses: conda-incubator/setup-miniconda@v2 + 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 list + + - name: Install run requirements (minimal) + if: ${{ "{{" }} matrix.requirements }} == "minimum" + run: | + python -m pip install -r requirements-min.txt -r requirements-dev.txt + python -m pip install -e . + + - name: Install run requirements (pinned) + if: ${{ "{{" }} matrix.requirements }} == "pinned" + run: | + python -m pip install -r requirements.txt -r requirements-dev.txt + python -m pip install -e . + + - name: Install run requirements (pinned, optional) + if: ${{ "{{" }} matrix.requirements }} == "optional" + run: | + python -m pip install -r requirements.txt -r requirements-opt.txt -r requirements-dev.txt + python -m pip install -e . + + - name: Install run requirements (upgraded, optional) + if: ${{ "{{" }} matrix.requirements }} == "upgraded" + run: | + python -m pip install -r requirements-opt.txt -r requirements-dev.txt + python -m pip install -U -e . + + - 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) + if: ${{ "{{" }} matrix.os }} != "windows-latest" + run: | + python -m venv test-wheel-env + source test-wheel-env/bin/activate + python -m pip install dist/*-none-any.whl + python -c "import hdmf" + + - name: Test installation from a wheel (windows) + if: ${{ "{{" }} matrix.os }} == "windows-latest" + run: | + python -m venv test-wheel-env + test-wheel-env/Scripts/activate.bat + python -m pip install dist/*-none-any.whl + python -c "import hdmf" diff --git a/{{ cookiecutter.namespace }}/.github/workflows/run_coverage.yml b/{{ cookiecutter.namespace }}/.github/workflows/run_coverage.yml new file mode 100644 index 0000000..bf149e0 --- /dev/null +++ b/{{ cookiecutter.namespace }}/.github/workflows/run_coverage.yml @@ -0,0 +1,58 @@ +name: Run code coverage +on: + push: + pull_request: + workflow_dispatch: + +jobs: + run-coverage: + name: ${{ "{{" }} matrix.os }} + runs-on: ${{ "{{" }} matrix.os }} + # TODO handle forks + # run pipeline on either a push event or a PR event on a fork + # if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + defaults: + run: + shell: bash + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + env: # used by codecov-action + OS: ${{ "{{" }} matrix.os }} + PYTHON: '3.10' + steps: + - name: Cancel any previous incomplete runs + uses: styfle/cancel-workflow-action@0.9.1 + with: + all_but_latest: true + access_token: ${{ "{{" }} github.token }} + + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements-dev.txt -r requirements.txt + + - name: Install package + run: | + python -m pip install -e . # must install in editable mode for coverage to find sources + python -m pip list + + - name: Run tests and generate coverage report + run: | + pytest --cov + python -m coverage xml # codecov uploader requires xml format + python -m coverage report -m + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + fail_ci_if_error: true diff --git a/{{ cookiecutter.namespace }}/.github/workflows/run_flake8.yml b/{{ cookiecutter.namespace }}/.github/workflows/run_flake8.yml new file mode 100644 index 0000000..8cc2fe1 --- /dev/null +++ b/{{ cookiecutter.namespace }}/.github/workflows/run_flake8.yml @@ -0,0 +1,30 @@ +name: Run style check +on: pull_request + +jobs: + run-flake8: + runs-on: ubuntu-latest + steps: + - name: Cancel any previous incomplete runs + uses: styfle/cancel-workflow-action@0.9.1 + with: + all_but_latest: true + access_token: ${{ "{{" }} github.token }} + + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.10' + + - name: Install flake8 + run: | + python -m pip install --upgrade pip + python -m pip install flake8 + python -m pip list + + - name: Run flake8 + run: flake8 diff --git a/{{ cookiecutter.namespace }}/requirements-min.txt b/{{ cookiecutter.namespace }}/requirements-min.txt new file mode 100644 index 0000000..ebff77f --- /dev/null +++ b/{{ cookiecutter.namespace }}/requirements-min.txt @@ -0,0 +1,3 @@ +# minimum versions of package dependencies for installation +pynwb==1.5.0 +hdmf==2.5.6 \ No newline at end of file diff --git a/{{ cookiecutter.namespace }}/requirements-opt.txt b/{{ cookiecutter.namespace }}/requirements-opt.txt new file mode 100644 index 0000000..ebff77f --- /dev/null +++ b/{{ cookiecutter.namespace }}/requirements-opt.txt @@ -0,0 +1,3 @@ +# minimum versions of package dependencies for installation +pynwb==1.5.0 +hdmf==2.5.6 \ No newline at end of file From 3fb4150c03e9902fb7ce4b34d58ee83ddbf73510 Mon Sep 17 00:00:00 2001 From: rly Date: Tue, 13 Sep 2022 23:22:24 -0700 Subject: [PATCH 02/21] Fixes --- cookiecutter.json | 2 +- .../.github/workflows/run_all_tests.yml | 24 +++++++++---------- .../requirements-dev.txt | 1 + .../requirements-opt.txt | 4 +--- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/cookiecutter.json b/cookiecutter.json index 1123796..1bb221f 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -4,7 +4,7 @@ "author": "My Name", "email": "my_email@example.com", "github_username": "myname", - "copyright": "2021, {{ cookiecutter.author }}", + "copyright": "2022, {{ cookiecutter.author }}", "version": "0.1.0", "release": "alpha", "license": ["BSD-3", "MIT", "Apache Software License 2.0", "Other"], diff --git a/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml b/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml index 3b93428..0383d08 100644 --- a/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml +++ b/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml @@ -59,25 +59,25 @@ jobs: python -m pip check - name: Install run requirements (minimal) - if: ${{ "{{" }} matrix.requirements }} == "minimum" + if: ${{ "{{" }} matrix.requirements == "minimum" }} run: | python -m pip install -r requirements-min.txt -r requirements-dev.txt python -m pip install -e . - name: Install run requirements (pinned) - if: ${{ "{{" }} matrix.requirements }} == "pinned" + if: ${{ "{{" }} matrix.requirements }} == "pinned" }} run: | python -m pip install -r requirements.txt -r requirements-dev.txt python -m pip install -e . - name: Install run requirements (pinned, optional) - if: ${{ "{{" }} matrix.requirements }} == "optional" + if: ${{ "{{" }} matrix.requirements == "optional" }} run: | python -m pip install -r requirements.txt -r requirements-opt.txt -r requirements-dev.txt python -m pip install -e . - name: Install run requirements (upgraded, optional) - if: ${{ "{{" }} matrix.requirements }} == "upgraded" + if: ${{ "{{" }} matrix.requirements == "upgraded" }} run: | python -m pip install -r requirements-opt.txt -r requirements-dev.txt python -m pip install -U -e . @@ -93,7 +93,7 @@ jobs: ls -1 dist - name: Test installation from a wheel (POSIX) - if: ${{ "{{" }} matrix.os }} != "windows-latest" + if: ${{ "{{" }} matrix.os != "windows-latest" }} run: | python -m venv test-wheel-env source test-wheel-env/bin/activate @@ -101,7 +101,7 @@ jobs: python -c "import hdmf" - name: Test installation from a wheel (windows) - if: ${{ "{{" }} matrix.os }} == "windows-latest" + if: ${{ "{{" }} matrix.os == "windows-latest" }} run: | python -m venv test-wheel-env test-wheel-env/Scripts/activate.bat @@ -150,25 +150,25 @@ jobs: conda list - name: Install run requirements (minimal) - if: ${{ "{{" }} matrix.requirements }} == "minimum" + if: ${{ "{{" }} matrix.requirements == "minimum" }} run: | python -m pip install -r requirements-min.txt -r requirements-dev.txt python -m pip install -e . - name: Install run requirements (pinned) - if: ${{ "{{" }} matrix.requirements }} == "pinned" + if: ${{ "{{" }} matrix.requirements == "pinned" }} run: | python -m pip install -r requirements.txt -r requirements-dev.txt python -m pip install -e . - name: Install run requirements (pinned, optional) - if: ${{ "{{" }} matrix.requirements }} == "optional" + if: ${{ "{{" }} matrix.requirements == "optional" }} run: | python -m pip install -r requirements.txt -r requirements-opt.txt -r requirements-dev.txt python -m pip install -e . - name: Install run requirements (upgraded, optional) - if: ${{ "{{" }} matrix.requirements }} == "upgraded" + if: ${{ "{{" }} matrix.requirements == "upgraded" }} run: | python -m pip install -r requirements-opt.txt -r requirements-dev.txt python -m pip install -U -e . @@ -184,7 +184,7 @@ jobs: ls -1 dist - name: Test installation from a wheel (POSIX) - if: ${{ "{{" }} matrix.os }} != "windows-latest" + if: ${{ "{{" }} matrix.os != "windows-latest" }} run: | python -m venv test-wheel-env source test-wheel-env/bin/activate @@ -192,7 +192,7 @@ jobs: python -c "import hdmf" - name: Test installation from a wheel (windows) - if: ${{ "{{" }} matrix.os }} == "windows-latest" + if: ${{ "{{" }} matrix.os == "windows-latest" }} run: | python -m venv test-wheel-env test-wheel-env/Scripts/activate.bat diff --git a/{{ cookiecutter.namespace }}/requirements-dev.txt b/{{ cookiecutter.namespace }}/requirements-dev.txt index 1482a06..41ddfdb 100644 --- a/{{ cookiecutter.namespace }}/requirements-dev.txt +++ b/{{ cookiecutter.namespace }}/requirements-dev.txt @@ -1,5 +1,6 @@ # pinned dependencies to reproduce an entire development environment to run tests and check code style flake8==4.0.1 pytest==6.2.5 +pytest-cov==3.0.0 pytest-subtests==0.6.0 hdmf-docutils==0.4.4 diff --git a/{{ cookiecutter.namespace }}/requirements-opt.txt b/{{ cookiecutter.namespace }}/requirements-opt.txt index ebff77f..6322050 100644 --- a/{{ cookiecutter.namespace }}/requirements-opt.txt +++ b/{{ cookiecutter.namespace }}/requirements-opt.txt @@ -1,3 +1 @@ -# minimum versions of package dependencies for installation -pynwb==1.5.0 -hdmf==2.5.6 \ No newline at end of file +# pinned optional package dependencies for installation From 1a28b1020139373d9c5994a9436443c2d7028c39 Mon Sep 17 00:00:00 2001 From: rly Date: Tue, 13 Sep 2022 23:24:22 -0700 Subject: [PATCH 03/21] Fixes --- .../.github/workflows/check_external_links.yml | 1 + .../.github/workflows/run_all_tests.yml | 4 ++-- {{ cookiecutter.namespace }}/.github/workflows/run_flake8.yml | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml b/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml index 2a19133..75b3103 100644 --- a/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml +++ b/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml @@ -1,5 +1,6 @@ name: Check Sphinx external links on: + push: pull_request: schedule: - cron: '0 5 * * *' # once per day at midnight ET diff --git a/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml b/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml index 0383d08..84073bc 100644 --- a/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml +++ b/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml @@ -1,9 +1,9 @@ name: Run all tests on: + push: + pull_request: schedule: - cron: '0 5 * * *' # once per day at midnight ET - pull_request: - push: workflow_dispatch: jobs: diff --git a/{{ cookiecutter.namespace }}/.github/workflows/run_flake8.yml b/{{ cookiecutter.namespace }}/.github/workflows/run_flake8.yml index 8cc2fe1..025e472 100644 --- a/{{ cookiecutter.namespace }}/.github/workflows/run_flake8.yml +++ b/{{ cookiecutter.namespace }}/.github/workflows/run_flake8.yml @@ -1,5 +1,7 @@ name: Run style check -on: pull_request +on: + push: + pull_request: jobs: run-flake8: From baf61ec5f2221ed0243148dca3da009ea8032148 Mon Sep 17 00:00:00 2001 From: rly Date: Tue, 13 Sep 2022 23:29:55 -0700 Subject: [PATCH 04/21] Fix --- .../.github/workflows/run_all_tests.yml | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml b/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml index 84073bc..fabc300 100644 --- a/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml +++ b/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml @@ -59,25 +59,25 @@ jobs: python -m pip check - name: Install run requirements (minimal) - if: ${{ "{{" }} matrix.requirements == "minimum" }} + if: ${{ "{{" }} matrix.requirements == 'minimum' }} run: | python -m pip install -r requirements-min.txt -r requirements-dev.txt python -m pip install -e . - name: Install run requirements (pinned) - if: ${{ "{{" }} matrix.requirements }} == "pinned" }} + if: ${{ "{{" }} matrix.requirements == 'pinned' }} run: | python -m pip install -r requirements.txt -r requirements-dev.txt python -m pip install -e . - name: Install run requirements (pinned, optional) - if: ${{ "{{" }} matrix.requirements == "optional" }} + if: ${{ "{{" }} matrix.requirements == 'optional' }} run: | python -m pip install -r requirements.txt -r requirements-opt.txt -r requirements-dev.txt python -m pip install -e . - name: Install run requirements (upgraded, optional) - if: ${{ "{{" }} matrix.requirements == "upgraded" }} + if: ${{ "{{" }} matrix.requirements == 'upgraded' }} run: | python -m pip install -r requirements-opt.txt -r requirements-dev.txt python -m pip install -U -e . @@ -93,7 +93,7 @@ jobs: ls -1 dist - name: Test installation from a wheel (POSIX) - if: ${{ "{{" }} matrix.os != "windows-latest" }} + if: ${{ "{{" }} matrix.os != 'windows-latest' }} run: | python -m venv test-wheel-env source test-wheel-env/bin/activate @@ -101,7 +101,7 @@ jobs: python -c "import hdmf" - name: Test installation from a wheel (windows) - if: ${{ "{{" }} matrix.os == "windows-latest" }} + if: ${{ "{{" }} matrix.os == 'windows-latest' }} run: | python -m venv test-wheel-env test-wheel-env/Scripts/activate.bat @@ -150,25 +150,25 @@ jobs: conda list - name: Install run requirements (minimal) - if: ${{ "{{" }} matrix.requirements == "minimum" }} + if: ${{ "{{" }} matrix.requirements == 'minimum' }} run: | python -m pip install -r requirements-min.txt -r requirements-dev.txt python -m pip install -e . - name: Install run requirements (pinned) - if: ${{ "{{" }} matrix.requirements == "pinned" }} + if: ${{ "{{" }} matrix.requirements == 'pinned' }} run: | python -m pip install -r requirements.txt -r requirements-dev.txt python -m pip install -e . - name: Install run requirements (pinned, optional) - if: ${{ "{{" }} matrix.requirements == "optional" }} + if: ${{ "{{" }} matrix.requirements == 'optional' }} run: | python -m pip install -r requirements.txt -r requirements-opt.txt -r requirements-dev.txt python -m pip install -e . - name: Install run requirements (upgraded, optional) - if: ${{ "{{" }} matrix.requirements == "upgraded" }} + if: ${{ "{{" }} matrix.requirements == 'upgraded' }} run: | python -m pip install -r requirements-opt.txt -r requirements-dev.txt python -m pip install -U -e . @@ -184,7 +184,7 @@ jobs: ls -1 dist - name: Test installation from a wheel (POSIX) - if: ${{ "{{" }} matrix.os != "windows-latest" }} + if: ${{ "{{" }} matrix.os != 'windows-latest' }} run: | python -m venv test-wheel-env source test-wheel-env/bin/activate @@ -192,7 +192,7 @@ jobs: python -c "import hdmf" - name: Test installation from a wheel (windows) - if: ${{ "{{" }} matrix.os == "windows-latest" }} + if: ${{ "{{" }} matrix.os == 'windows-latest' }} run: | python -m venv test-wheel-env test-wheel-env/Scripts/activate.bat From dc63d989c1f5829f6949ab91b526152f979e745f Mon Sep 17 00:00:00 2001 From: rly Date: Tue, 13 Sep 2022 23:32:39 -0700 Subject: [PATCH 05/21] Fix wheel check --- .../.github/workflows/run_all_tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml b/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml index fabc300..d0667fa 100644 --- a/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml +++ b/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml @@ -98,7 +98,7 @@ jobs: python -m venv test-wheel-env source test-wheel-env/bin/activate python -m pip install dist/*-none-any.whl - python -c "import hdmf" + python -c "import {{ cookiecutter.py_pkg_name }}" - name: Test installation from a wheel (windows) if: ${{ "{{" }} matrix.os == 'windows-latest' }} @@ -106,7 +106,7 @@ jobs: python -m venv test-wheel-env test-wheel-env/Scripts/activate.bat python -m pip install dist/*-none-any.whl - python -c "import hdmf" + python -c "import {{ cookiecutter.py_pkg_name }}" run-all-tests-on-conda: name: ${{ "{{" }} matrix.name }} @@ -189,7 +189,7 @@ jobs: python -m venv test-wheel-env source test-wheel-env/bin/activate python -m pip install dist/*-none-any.whl - python -c "import hdmf" + python -c "import {{ cookiecutter.py_pkg_name }}" - name: Test installation from a wheel (windows) if: ${{ "{{" }} matrix.os == 'windows-latest' }} @@ -197,4 +197,4 @@ jobs: python -m venv test-wheel-env test-wheel-env/Scripts/activate.bat python -m pip install dist/*-none-any.whl - python -c "import hdmf" + python -c "import {{ cookiecutter.py_pkg_name }}" From 0425b28de4a8fe61b6fe266d8041505b97d6e21e Mon Sep 17 00:00:00 2001 From: rly Date: Wed, 14 Sep 2022 18:22:20 -0700 Subject: [PATCH 06/21] Fix tests --- .../.github/workflows/check_external_links.yml | 4 +++- {{ cookiecutter.namespace }}/requirements.txt | 4 ++-- {{ cookiecutter.namespace }}/setup.py | 2 +- .../src/pynwb/tests/test_tetrodeseries.py | 15 +++------------ 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml b/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml index 75b3103..dccac48 100644 --- a/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml +++ b/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml @@ -32,4 +32,6 @@ jobs: python -m pip install . - name: Check Sphinx external links - run: sphinx-build -b linkcheck ./docs/source ./test_build + run: | + cd docs # run_doc_autogen assumes spec is found in ../spec/ + sphinx-build -b linkcheck ./source ./test_build diff --git a/{{ cookiecutter.namespace }}/requirements.txt b/{{ cookiecutter.namespace }}/requirements.txt index 1709b58..43db395 100644 --- a/{{ cookiecutter.namespace }}/requirements.txt +++ b/{{ cookiecutter.namespace }}/requirements.txt @@ -1,3 +1,3 @@ # pinned dependencies to reproduce a working development environment -hdmf==3.1.1 -pynwb==2.0.0 +hdmf==3.4.3 +pynwb==2.1.0 diff --git a/{{ cookiecutter.namespace }}/setup.py b/{{ cookiecutter.namespace }}/setup.py index 771c1ff..507c211 100644 --- a/{{ cookiecutter.namespace }}/setup.py +++ b/{{ cookiecutter.namespace }}/setup.py @@ -31,7 +31,7 @@ 'url': '', 'license': '{{ cookiecutter.license }}', 'install_requires': [ - 'pynwb>=1.5.0,<3', + 'pynwb>=2.1.0,<3', 'hdmf>=2.5.6,<4', ], 'packages': find_packages('src/pynwb', exclude=["tests", "tests.*"]), diff --git a/{{ cookiecutter.namespace }}/src/pynwb/tests/test_tetrodeseries.py b/{{ cookiecutter.namespace }}/src/pynwb/tests/test_tetrodeseries.py index b058e5a..79d4e86 100644 --- a/{{ cookiecutter.namespace }}/src/pynwb/tests/test_tetrodeseries.py +++ b/{{ cookiecutter.namespace }}/src/pynwb/tests/test_tetrodeseries.py @@ -31,10 +31,6 @@ def set_up_nwbfile(): for i in np.arange(10.): nwbfile.add_electrode( - x=i, - y=i, - z=i, - imp=np.nan, location='location', filtering='filtering', group=electrode_group @@ -56,7 +52,7 @@ def test_constructor(self): description='all the electrodes' ) - data = np.random.rand(100, 3) + data = np.random.rand(100, 10) tetrode_series = TetrodeSeries( name='name', description='description', @@ -95,7 +91,7 @@ def test_roundtrip(self): description='all the electrodes' ) - data = np.random.rand(100, 3) + data = np.random.rand(100, 10) tetrode_series = TetrodeSeries( name='TetrodeSeries', description='description', @@ -134,14 +130,9 @@ def setUpContainer(self): self.table = get_electrode_table() # manually create a table of electrodes for i in np.arange(10.): self.table.add_row( - x=i, - y=i, - z=i, - imp=np.nan, location='location', filtering='filtering', group=self.group, - group_name='electrode_group' ) all_electrodes = DynamicTableRegion( @@ -151,7 +142,7 @@ def setUpContainer(self): table=self.table ) - data = np.random.rand(100, 3) + data = np.random.rand(100, 10) tetrode_series = TetrodeSeries( name='name', description='description', From 6538265dd8fed1cee86b483f49e024698911a3d8 Mon Sep 17 00:00:00 2001 From: rly Date: Wed, 14 Sep 2022 18:23:20 -0700 Subject: [PATCH 07/21] Update min reqs --- {{ cookiecutter.namespace }}/requirements-min.txt | 5 +++-- {{ cookiecutter.namespace }}/setup.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/{{ cookiecutter.namespace }}/requirements-min.txt b/{{ cookiecutter.namespace }}/requirements-min.txt index ebff77f..da86d23 100644 --- a/{{ cookiecutter.namespace }}/requirements-min.txt +++ b/{{ cookiecutter.namespace }}/requirements-min.txt @@ -1,3 +1,4 @@ # minimum versions of package dependencies for installation -pynwb==1.5.0 -hdmf==2.5.6 \ No newline at end of file +# NOTE: it may be possible to relax these minimum requirements +pynwb==2.1.0 +hdmf==3.4.3 \ No newline at end of file diff --git a/{{ cookiecutter.namespace }}/setup.py b/{{ cookiecutter.namespace }}/setup.py index 507c211..1a403b7 100644 --- a/{{ cookiecutter.namespace }}/setup.py +++ b/{{ cookiecutter.namespace }}/setup.py @@ -32,7 +32,7 @@ 'license': '{{ cookiecutter.license }}', 'install_requires': [ 'pynwb>=2.1.0,<3', - 'hdmf>=2.5.6,<4', + 'hdmf>=3.4.3,<4', ], 'packages': find_packages('src/pynwb', exclude=["tests", "tests.*"]), 'package_dir': {'': 'src/pynwb'}, From cfb1d4b371d2c37a88a7b2d1efe97dfc53c5a088 Mon Sep 17 00:00:00 2001 From: rly Date: Wed, 14 Sep 2022 18:26:25 -0700 Subject: [PATCH 08/21] Fix test --- .../src/pynwb/tests/test_tetrodeseries.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/{{ cookiecutter.namespace }}/src/pynwb/tests/test_tetrodeseries.py b/{{ cookiecutter.namespace }}/src/pynwb/tests/test_tetrodeseries.py index 79d4e86..59df39d 100644 --- a/{{ cookiecutter.namespace }}/src/pynwb/tests/test_tetrodeseries.py +++ b/{{ cookiecutter.namespace }}/src/pynwb/tests/test_tetrodeseries.py @@ -32,7 +32,6 @@ def set_up_nwbfile(): for i in np.arange(10.): nwbfile.add_electrode( location='location', - filtering='filtering', group=electrode_group ) @@ -131,8 +130,8 @@ def setUpContainer(self): for i in np.arange(10.): self.table.add_row( location='location', - filtering='filtering', group=self.group, + group_name='electrode_group' # necessary when using add_row instead of NWBFile.add_electrode ) all_electrodes = DynamicTableRegion( From 86df7a340b7e067c73a84b669db8fcde42f1c71a Mon Sep 17 00:00:00 2001 From: rly Date: Wed, 14 Sep 2022 22:52:57 -0700 Subject: [PATCH 09/21] Fix deprecations --- {{ cookiecutter.namespace }}/setup.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/{{ cookiecutter.namespace }}/setup.cfg b/{{ cookiecutter.namespace }}/setup.cfg index f6c4008..f059e12 100644 --- a/{{ cookiecutter.namespace }}/setup.cfg +++ b/{{ cookiecutter.namespace }}/setup.cfg @@ -1,4 +1,4 @@ -[wheel] +[bdist_wheel] universal = 1 [flake8] @@ -14,4 +14,4 @@ exclude = versioneer.py [metadata] -description-file = README.md +description_file = README.md From 93e67daa38f9e9fbf11247731afae2a4ccb9e6c8 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Sat, 21 Oct 2023 14:37:12 -0700 Subject: [PATCH 10/21] Update check_external_links.yml --- .../.github/workflows/check_external_links.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml b/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml index dccac48..4e5ed11 100644 --- a/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml +++ b/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cancel any previous incomplete runs - uses: styfle/cancel-workflow-action@0.9.1 + uses: styfle/cancel-workflow-action@0.12.0 with: all_but_latest: true access_token: ${{ "{{" }} github.token }} @@ -21,14 +21,14 @@ jobs: submodules: 'recursive' - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Install Sphinx dependencies and package run: | python -m pip install --upgrade pip - python -m pip install -r requirements-dev.txt -r requirements.txt + python -m pip install -r requirements-dev.txt python -m pip install . - name: Check Sphinx external links From d3e97687f41c2d9f866a78d71c620e383f969e67 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Sat, 21 Oct 2023 14:37:41 -0700 Subject: [PATCH 11/21] Update check_external_links.yml --- .../.github/workflows/check_external_links.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml b/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml index 4e5ed11..e48986c 100644 --- a/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml +++ b/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml @@ -19,6 +19,7 @@ jobs: - uses: actions/checkout@v3 with: submodules: 'recursive' + fetch-depth: 0 # tags are required for versioneer to determine the version - name: Set up Python uses: actions/setup-python@v4 From f48972941c68adf89033814b23ac5fb6711c16d9 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Sat, 21 Oct 2023 14:38:34 -0700 Subject: [PATCH 12/21] Update check_external_links.yml --- .../.github/workflows/check_external_links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml b/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml index e48986c..e00f682 100644 --- a/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml +++ b/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml @@ -29,7 +29,7 @@ jobs: - 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 -r requirements-dev.txt -r requirements-opt.txt python -m pip install . - name: Check Sphinx external links From b0879de9e7d8df94f11c58ffa34e498baf921b00 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Sat, 21 Oct 2023 14:41:05 -0700 Subject: [PATCH 13/21] Update requirements-min.txt --- {{ cookiecutter.namespace }}/requirements-min.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/{{ cookiecutter.namespace }}/requirements-min.txt b/{{ cookiecutter.namespace }}/requirements-min.txt index da86d23..b13eb8f 100644 --- a/{{ cookiecutter.namespace }}/requirements-min.txt +++ b/{{ cookiecutter.namespace }}/requirements-min.txt @@ -1,4 +1,4 @@ # minimum versions of package dependencies for installation # NOTE: it may be possible to relax these minimum requirements -pynwb==2.1.0 -hdmf==3.4.3 \ No newline at end of file +pynwb==2.5.0 +hdmf==3.11.0 From 671c0808f3f426c79fccd73fe2e6b7b0be7399ca Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Sat, 21 Oct 2023 14:41:38 -0700 Subject: [PATCH 14/21] Update pyproject.toml --- {{ cookiecutter.namespace }}/pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/{{ cookiecutter.namespace }}/pyproject.toml b/{{ cookiecutter.namespace }}/pyproject.toml index 1cbec14..d0e2060 100644 --- a/{{ cookiecutter.namespace }}/pyproject.toml +++ b/{{ cookiecutter.namespace }}/pyproject.toml @@ -38,7 +38,8 @@ keywords = [ 'ndx-extension', ] dependencies = [ - "pynwb>=2", + "pynwb>=2.5.0", + "hdmf>=3.11.0", ] # TODO: add URLs before release From b9f40af1fb8989fb265c51c2c1d0b5806f1e7541 Mon Sep 17 00:00:00 2001 From: rly Date: Sun, 22 Oct 2023 08:43:53 -0700 Subject: [PATCH 15/21] Update CI --- .../workflows/check_external_links.yml | 3 +- .../.github/workflows/codespell.yml | 15 ++++ .../.github/workflows/ruff.yml | 15 ++++ .../.github/workflows/run_all_tests.yml | 85 ++++++++----------- .../.github/workflows/run_coverage.yml | 11 +-- .../.github/workflows/run_flake8.yml | 32 ------- .../requirements-min.txt | 1 + .../requirements-opt.txt | 1 - 8 files changed, 73 insertions(+), 90 deletions(-) create mode 100644 {{ cookiecutter.namespace }}/.github/workflows/codespell.yml create mode 100644 {{ cookiecutter.namespace }}/.github/workflows/ruff.yml delete mode 100644 {{ cookiecutter.namespace }}/.github/workflows/run_flake8.yml delete mode 100644 {{ cookiecutter.namespace }}/requirements-opt.txt diff --git a/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml b/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml index e00f682..cfc9050 100644 --- a/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml +++ b/{{ cookiecutter.namespace }}/.github/workflows/check_external_links.yml @@ -8,6 +8,7 @@ on: jobs: check-external-links: + name: Check for broken Sphinx external links runs-on: ubuntu-latest steps: - name: Cancel any previous incomplete runs @@ -29,7 +30,7 @@ jobs: - name: Install Sphinx dependencies and package run: | python -m pip install --upgrade pip - python -m pip install -r requirements-dev.txt -r requirements-opt.txt + python -m pip install -r requirements-dev.txt python -m pip install . - name: Check Sphinx external links diff --git a/{{ cookiecutter.namespace }}/.github/workflows/codespell.yml b/{{ cookiecutter.namespace }}/.github/workflows/codespell.yml new file mode 100644 index 0000000..71317d4 --- /dev/null +++ b/{{ cookiecutter.namespace }}/.github/workflows/codespell.yml @@ -0,0 +1,15 @@ +name: Codespell +on: + push: + pull_request: + workflow_dispatch: + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Codespell + uses: codespell-project/actions-codespell@v2 \ No newline at end of file diff --git a/{{ cookiecutter.namespace }}/.github/workflows/ruff.yml b/{{ cookiecutter.namespace }}/.github/workflows/ruff.yml new file mode 100644 index 0000000..4679ceb --- /dev/null +++ b/{{ cookiecutter.namespace }}/.github/workflows/ruff.yml @@ -0,0 +1,15 @@ +name: Ruff +on: + push: + pull_request: + workflow_dispatch: + +jobs: + ruff: + name: Check for style errors and common problems + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Ruff + uses: chartboost/ruff-action@v1 \ No newline at end of file diff --git a/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml b/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml index d0667fa..365c373 100644 --- a/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml +++ b/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml @@ -8,10 +8,6 @@ on: jobs: run-all-tests: - # the only differences between this job and "run_tests.yml" is the "strategy.matrix.include" and the upload - # distributions step. - # GitHub Actions does not yet support YAML anchors, easily reusable components, or easy dynamic matrix - # configurations based on the github event, so this job is duplicated for the most part name: ${{ "{{" }} matrix.name }} runs-on: ${{ "{{" }} matrix.os }} defaults: @@ -21,34 +17,41 @@ jobs: fail-fast: false matrix: include: - - { name: linux-python3.7-minimum , requirements: minimum , python-ver: "3.7" , os: ubuntu-latest } - - { name: linux-python3.7 , requirements: pinned , python-ver: "3.7" , os: ubuntu-latest } + - { 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.10-optional , requirements: optional , python-ver: "3.10", os: ubuntu-latest } - - { name: linux-python3.10-upgraded , requirements: upgraded , python-ver: "3.10", os: ubuntu-latest } - - { name: windows-python3.7-minimum , requirements: minimum , python-ver: "3.7" , os: windows-latest } - - { name: windows-python3.7 , requirements: pinned , python-ver: "3.7" , os: windows-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.10-optional , requirements: optional , python-ver: "3.10", os: windows-latest } - - { name: windows-python3.10-upgraded , requirements: upgraded , python-ver: "3.10", os: windows-latest } - - { name: macos-python3.7-minimum , requirements: pinned , python-ver: "3.7" , os: macos-latest } - - { name: macos-python3.7 , requirements: pinned , python-ver: "3.7" , os: macos-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.10-optional , requirements: optional , python-ver: "3.10", os: macos-latest } - - { name: macos-python3.10-upgraded , requirements: upgraded , 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 } steps: + - name: Cancel non-latest runs + uses: styfle/cancel-workflow-action@0.11.0 + with: + all_but_latest: true + access_token: ${{ github.token }} + - uses: actions/checkout@v3 with: submodules: 'recursive' + fetch-depth: 0 # fetch tags - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: ${{ "{{" }} matrix.python-ver }} @@ -58,7 +61,7 @@ jobs: python -m pip list python -m pip check - - name: Install run requirements (minimal) + - name: Install run requirements (minimum) if: ${{ "{{" }} matrix.requirements == 'minimum' }} run: | python -m pip install -r requirements-min.txt -r requirements-dev.txt @@ -67,19 +70,12 @@ jobs: - name: Install run requirements (pinned) if: ${{ "{{" }} matrix.requirements == 'pinned' }} run: | - python -m pip install -r requirements.txt -r requirements-dev.txt + python -m pip install -r requirements-dev.txt python -m pip install -e . - - name: Install run requirements (pinned, optional) - if: ${{ "{{" }} matrix.requirements == 'optional' }} - run: | - python -m pip install -r requirements.txt -r requirements-opt.txt -r requirements-dev.txt - python -m pip install -e . - - - name: Install run requirements (upgraded, optional) + - name: Install run requirements (upgraded) if: ${{ "{{" }} matrix.requirements == 'upgraded' }} run: | - python -m pip install -r requirements-opt.txt -r requirements-dev.txt python -m pip install -U -e . - name: Run tests @@ -118,22 +114,23 @@ jobs: fail-fast: false matrix: include: - - { name: conda-linux-python3.7-minimum , requirements: minimum , python-ver: "3.7" , os: ubuntu-latest } - - { name: conda-linux-python3.7 , requirements: pinned , python-ver: "3.7" , os: ubuntu-latest } + - { 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.10-optional , requirements: optional , python-ver: "3.10", os: ubuntu-latest } - - { name: conda-linux-python3.10-upgraded , requirements: upgraded , 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: Cancel any previous incomplete runs - uses: styfle/cancel-workflow-action@0.9.1 + uses: styfle/cancel-workflow-action@0.11.0 with: access_token: ${{ "{{" }} github.token }} - uses: actions/checkout@v3 with: submodules: 'recursive' + fetch-depth: 0 # fetch tags - name: Set up Conda uses: conda-incubator/setup-miniconda@v2 @@ -147,9 +144,10 @@ jobs: run: | conda config --set always_yes yes --set changeps1 no conda info - conda list + conda config --show-sources + conda list --show-channel-urls - - name: Install run requirements (minimal) + - name: Install run requirements (minimum) if: ${{ "{{" }} matrix.requirements == 'minimum' }} run: | python -m pip install -r requirements-min.txt -r requirements-dev.txt @@ -161,16 +159,10 @@ jobs: python -m pip install -r requirements.txt -r requirements-dev.txt python -m pip install -e . - - name: Install run requirements (pinned, optional) - if: ${{ "{{" }} matrix.requirements == 'optional' }} - run: | - python -m pip install -r requirements.txt -r requirements-opt.txt -r requirements-dev.txt - python -m pip install -e . - - - name: Install run requirements (upgraded, optional) + - name: Install run requirements (upgraded) if: ${{ "{{" }} matrix.requirements == 'upgraded' }} run: | - python -m pip install -r requirements-opt.txt -r requirements-dev.txt + python -m pip install -r requirements-dev.txt python -m pip install -U -e . - name: Run tests @@ -184,17 +176,8 @@ jobs: ls -1 dist - name: Test installation from a wheel (POSIX) - if: ${{ "{{" }} matrix.os != 'windows-latest' }} 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 }}" - - - name: Test installation from a wheel (windows) - if: ${{ "{{" }} matrix.os == 'windows-latest' }} - run: | - python -m venv test-wheel-env - test-wheel-env/Scripts/activate.bat - python -m pip install dist/*-none-any.whl - python -c "import {{ cookiecutter.py_pkg_name }}" diff --git a/{{ cookiecutter.namespace }}/.github/workflows/run_coverage.yml b/{{ cookiecutter.namespace }}/.github/workflows/run_coverage.yml index bf149e0..b3b9caf 100644 --- a/{{ cookiecutter.namespace }}/.github/workflows/run_coverage.yml +++ b/{{ cookiecutter.namespace }}/.github/workflows/run_coverage.yml @@ -19,10 +19,10 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] env: # used by codecov-action OS: ${{ "{{" }} matrix.os }} - PYTHON: '3.10' + PYTHON: '3.11' steps: - name: Cancel any previous incomplete runs - uses: styfle/cancel-workflow-action@0.9.1 + uses: styfle/cancel-workflow-action@0.11.0 with: all_but_latest: true access_token: ${{ "{{" }} github.token }} @@ -30,16 +30,17 @@ jobs: - uses: actions/checkout@v3 with: submodules: 'recursive' + fetch-depth: 0 # fetch tags - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: ${{ "{{" }} env.PYTHON }} - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install -r requirements-dev.txt -r requirements.txt + python -m pip install -r requirements-dev.txt - name: Install package run: | diff --git a/{{ cookiecutter.namespace }}/.github/workflows/run_flake8.yml b/{{ cookiecutter.namespace }}/.github/workflows/run_flake8.yml deleted file mode 100644 index 025e472..0000000 --- a/{{ cookiecutter.namespace }}/.github/workflows/run_flake8.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Run style check -on: - push: - pull_request: - -jobs: - run-flake8: - runs-on: ubuntu-latest - steps: - - name: Cancel any previous incomplete runs - uses: styfle/cancel-workflow-action@0.9.1 - with: - all_but_latest: true - access_token: ${{ "{{" }} github.token }} - - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: '3.10' - - - name: Install flake8 - run: | - python -m pip install --upgrade pip - python -m pip install flake8 - python -m pip list - - - name: Run flake8 - run: flake8 diff --git a/{{ cookiecutter.namespace }}/requirements-min.txt b/{{ cookiecutter.namespace }}/requirements-min.txt index b13eb8f..5730ae4 100644 --- a/{{ cookiecutter.namespace }}/requirements-min.txt +++ b/{{ cookiecutter.namespace }}/requirements-min.txt @@ -1,4 +1,5 @@ # minimum versions of package dependencies for installation +# these should match the minimum versions specified in pyproject.toml # NOTE: it may be possible to relax these minimum requirements pynwb==2.5.0 hdmf==3.11.0 diff --git a/{{ cookiecutter.namespace }}/requirements-opt.txt b/{{ cookiecutter.namespace }}/requirements-opt.txt deleted file mode 100644 index 6322050..0000000 --- a/{{ cookiecutter.namespace }}/requirements-opt.txt +++ /dev/null @@ -1 +0,0 @@ -# pinned optional package dependencies for installation From 985f06c5e2a0cd6216fff74682e0c1ad2ac6f3d4 Mon Sep 17 00:00:00 2001 From: rly Date: Sun, 22 Oct 2023 08:45:41 -0700 Subject: [PATCH 16/21] Fix --- .../.github/workflows/run_all_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml b/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml index 365c373..2b7d6da 100644 --- a/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml +++ b/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml @@ -43,7 +43,7 @@ jobs: uses: styfle/cancel-workflow-action@0.11.0 with: all_but_latest: true - access_token: ${{ github.token }} + access_token: ${{ "{{" }} github.token }} - uses: actions/checkout@v3 with: From e0755897b84798fc75be9ca5d2de5d062c34dd91 Mon Sep 17 00:00:00 2001 From: rly Date: Sun, 22 Oct 2023 08:50:18 -0700 Subject: [PATCH 17/21] Fix --- {{ cookiecutter.namespace }}/pyproject.toml | 2 +- {{ cookiecutter.namespace }}/requirements-min.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/{{ cookiecutter.namespace }}/pyproject.toml b/{{ cookiecutter.namespace }}/pyproject.toml index d0e2060..15f9215 100644 --- a/{{ cookiecutter.namespace }}/pyproject.toml +++ b/{{ cookiecutter.namespace }}/pyproject.toml @@ -39,7 +39,7 @@ keywords = [ ] dependencies = [ "pynwb>=2.5.0", - "hdmf>=3.11.0", + "hdmf>=3.10.0", ] # TODO: add URLs before release diff --git a/{{ cookiecutter.namespace }}/requirements-min.txt b/{{ cookiecutter.namespace }}/requirements-min.txt index 5730ae4..695410a 100644 --- a/{{ cookiecutter.namespace }}/requirements-min.txt +++ b/{{ cookiecutter.namespace }}/requirements-min.txt @@ -2,4 +2,4 @@ # these should match the minimum versions specified in pyproject.toml # NOTE: it may be possible to relax these minimum requirements pynwb==2.5.0 -hdmf==3.11.0 +hdmf==3.10.0 From c8337cb68795aaf47517328573a6b147925e6f03 Mon Sep 17 00:00:00 2001 From: rly Date: Sun, 22 Oct 2023 09:00:17 -0700 Subject: [PATCH 18/21] Update CI --- .github/workflows/codespell.yml | 15 +++++++++++++++ .github/workflows/run_tests.yml | 20 +++++++++++--------- 2 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/codespell.yml diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 0000000..71317d4 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,15 @@ +name: Codespell +on: + push: + pull_request: + workflow_dispatch: + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Codespell + uses: codespell-project/actions-codespell@v2 \ No newline at end of file diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index c7d6764..fe15bd2 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -19,15 +19,17 @@ jobs: fail-fast: false matrix: include: - - { name: linux-python3.8 , os: ubuntu-latest , python-ver: "3.8" } - - { name: linux-python3.12 , os: ubuntu-latest , python-ver: "3.12" } - - { name: windows-python3.8 , os: windows-latest, python-ver: "3.8" } - - { 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.12 , os: macos-latest , python-ver: "3.12" } + - { 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: 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" } steps: - name: Cancel non-latest runs uses: styfle/cancel-workflow-action@0.12.0 From 7a2b300278c3833dd91924288e8244b7942036d2 Mon Sep 17 00:00:00 2001 From: rly Date: Sun, 22 Oct 2023 09:04:19 -0700 Subject: [PATCH 19/21] Update doc --- {{ cookiecutter.namespace }}/NEXTSTEPS.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/{{ cookiecutter.namespace }}/NEXTSTEPS.md b/{{ cookiecutter.namespace }}/NEXTSTEPS.md index b92e465..8e23caf 100644 --- a/{{ cookiecutter.namespace }}/NEXTSTEPS.md +++ b/{{ cookiecutter.namespace }}/NEXTSTEPS.md @@ -69,6 +69,11 @@ your extension. 8. Update the `CHANGELOG.md` to document changes to your extension. +8. Push your repository to GitHub. A default set of GitHub Actions workflows is set up to +test your code on Linux, Windows, Mac OS, and Linux using conda; upload code coverage +stats to codecov; check for spelling errors; check for style errors; and check for broken +links in the documentation. + 8. Make a release for the extension on GitHub with the version number specified. e.g. if version is {{ cookiecutter.version }}, then this page should exist: https://github.com/{{ github_username_list[0] }}/{{ cookiecutter.namespace }}/releases/tag/{{ cookiecutter.version }} . For instructions on how to make a release on GitHub see [here](https://help.github.com/en/github/administering-a-repository/creating-releases). 9. Publish your updated extension on [PyPI](https://pypi.org/). From b6e6f63d287f3ab14f9eb159df9707fa8d61cbee Mon Sep 17 00:00:00 2001 From: rly Date: Sun, 22 Oct 2023 10:19:19 -0700 Subject: [PATCH 20/21] Update CI --- .../.github/workflows/run_all_tests.yml | 3 ++- .../.github/workflows/run_coverage.yml | 9 +++++---- {{ cookiecutter.namespace }}/requirements-dev.txt | 2 ++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml b/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml index 2b7d6da..177ac4b 100644 --- a/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml +++ b/{{ cookiecutter.namespace }}/.github/workflows/run_all_tests.yml @@ -76,6 +76,7 @@ jobs: - name: Install run requirements (upgraded) if: ${{ "{{" }} matrix.requirements == 'upgraded' }} run: | + python -m pip install -r requirements-dev.txt python -m pip install -U -e . - name: Run tests @@ -156,7 +157,7 @@ jobs: - name: Install run requirements (pinned) if: ${{ "{{" }} matrix.requirements == 'pinned' }} run: | - python -m pip install -r requirements.txt -r requirements-dev.txt + python -m pip install -r requirements-dev.txt python -m pip install -e . - name: Install run requirements (upgraded) diff --git a/{{ cookiecutter.namespace }}/.github/workflows/run_coverage.yml b/{{ cookiecutter.namespace }}/.github/workflows/run_coverage.yml index b3b9caf..80483e1 100644 --- a/{{ cookiecutter.namespace }}/.github/workflows/run_coverage.yml +++ b/{{ cookiecutter.namespace }}/.github/workflows/run_coverage.yml @@ -53,7 +53,8 @@ jobs: python -m coverage xml # codecov uploader requires xml format python -m coverage report -m - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - fail_ci_if_error: true + # TODO uncomment after setting up repo on codecov.io + # - name: Upload coverage to Codecov + # uses: codecov/codecov-action@v3 + # with: + # fail_ci_if_error: true diff --git a/{{ cookiecutter.namespace }}/requirements-dev.txt b/{{ cookiecutter.namespace }}/requirements-dev.txt index 66463c2..7655a0a 100644 --- a/{{ cookiecutter.namespace }}/requirements-dev.txt +++ b/{{ cookiecutter.namespace }}/requirements-dev.txt @@ -3,8 +3,10 @@ black==23.9.1 codespell==2.2.6 coverage==7.3.2 +hdmf==3.10.0 hdmf-docutils==0.4.5 pre-commit==3.4.0 +pynwb==2.5.0 pytest==7.4.2 pytest-cov==4.1.0 python-dateutil==2.8.2 From 8a4853cafd464390f602ab8064ba6b3cec5c2c42 Mon Sep 17 00:00:00 2001 From: rly Date: Sun, 22 Oct 2023 10:41:08 -0700 Subject: [PATCH 21/21] Update doc --- {{ cookiecutter.namespace }}/NEXTSTEPS.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/{{ cookiecutter.namespace }}/NEXTSTEPS.md b/{{ cookiecutter.namespace }}/NEXTSTEPS.md index 8e23caf..816110d 100644 --- a/{{ cookiecutter.namespace }}/NEXTSTEPS.md +++ b/{{ cookiecutter.namespace }}/NEXTSTEPS.md @@ -71,8 +71,10 @@ your extension. 8. Push your repository to GitHub. A default set of GitHub Actions workflows is set up to test your code on Linux, Windows, Mac OS, and Linux using conda; upload code coverage -stats to codecov; check for spelling errors; check for style errors; and check for broken -links in the documentation. +stats to codecov.io; check for spelling errors; check for style errors; and check for broken +links in the documentation. For the code coverage workflow to work, you will need to +set up the repo on codecov.io and uncomment the "Upload coverage to Codecov" step +in `.github/workflows/run_coverage.yml`. 8. Make a release for the extension on GitHub with the version number specified. e.g. if version is {{ cookiecutter.version }}, then this page should exist: https://github.com/{{ github_username_list[0] }}/{{ cookiecutter.namespace }}/releases/tag/{{ cookiecutter.version }} . For instructions on how to make a release on GitHub see [here](https://help.github.com/en/github/administering-a-repository/creating-releases).