Skip to content

Commit

Permalink
Merge branch 'master' into enh/pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
Moritz-Alexander-Kern authored Sep 4, 2024
2 parents 42c7664 + 0984e19 commit 0aad87a
Show file tree
Hide file tree
Showing 64 changed files with 645 additions and 357 deletions.
112 changes: 59 additions & 53 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ on:
branches:
- master

# Cancel previous workflows on the same pull request
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# jobs define the steps that will be executed on the runner
jobs:

Expand Down Expand Up @@ -69,6 +74,11 @@ jobs:
- name: Get current year-month
id: date
run: echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT

- name: Get pip cache dir
id: pip-cache
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3

Expand All @@ -82,7 +92,7 @@ jobs:
- name: Cache test_env
uses: actions/cache@v3
with:
path: /home/runner/.cache/pip
path: ${{ steps.pip-cache.outputs.dir }}
# Look to see if there is a cache hit for the corresponding requirements files
# cache will be reset on changes to any requirements or every month
key: ${{ runner.os }}-venv-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/requirements-tests.txt') }}
Expand All @@ -93,10 +103,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install coveralls
pip install -r requirements/requirements-tests.txt
pip install -r requirements/requirements.txt
pip install -r requirements/requirements-extras.txt
pip install -e .
pip install -e .[extras,tests]
- name: List packages
run: |
Expand All @@ -105,7 +112,8 @@ jobs:
- name: Test with pytest
run: |
coverage run --source=elephant -m pytest && coveralls --service=github || echo "Coveralls submission failed"
coverage run --source=elephant -m pytest
coveralls --service=github || echo "Coveralls submission failed"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -123,22 +131,22 @@ jobs:
fail-fast: false
matrix:
# OS [ubuntu-latest, macos-latest, windows-latest]
os: [macos-11,macos-12]
python-version: [3.9]
os: [macos-12,macos-13]
python-version: [3.11]
steps:
- name: Get current year-month
id: date
run: echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT

- uses: actions/checkout@v3
- uses: actions/checkout@v4.1.6

- name: Cache conda
uses: actions/cache@v3
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{hashFiles('requirements/environment.yml') }}-${{ hashFiles('**/CI.yml') }}-${{ steps.date.outputs.date }}

- uses: conda-incubator/setup-miniconda@030178870c779d9e5e1b4e563269f3aa69b04081 # corresponds to v3.0.3
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # corresponds to v3.0.4
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
Expand All @@ -152,9 +160,7 @@ jobs:
shell: bash -l {0}
run: |
python --version
mamba install mpi4py openmpi
mamba install pytest
mamba install pytest-cov coveralls
mamba install pytest pytest-cov coveralls
pip install -e .[extras]
- name: List packages
Expand All @@ -181,25 +187,17 @@ jobs:
strategy:
matrix:
# python versions for elephant: [3.8, 3.9, 3.10, 3.11]
python-version: [3.8,]
python-version: [3.11,]
# OS [ubuntu-latest, macos-latest, windows-latest]
os: [windows-latest]
include:
# - os: ubuntu-latest
# path: ~/.cache/pip
# - os: macos-latest
# path: ~/Library/Caches/pip
- os: windows-latest
path: ~\AppData\Local\pip\Cache
# do not cancel all in-progress jobs if any matrix job fails
fail-fast: false

steps:
- name: Get current year-month
id: date
run: echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT

- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand All @@ -208,19 +206,16 @@ jobs:
- name: Cache pip
uses: actions/cache@v3
with:
path: ${{ matrix.path }}
path: ~\AppData\Local\pip\Cache
# Look to see if there is a cache hit for the corresponding requirements files
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/requirements-tests.txt') }}
-${{ hashFiles('**/requirements-extras.txt') }}-${{ hashFiles('setup.py') }} -${{ hashFiles('**/CI.yml') }}-${{ steps.date.outputs.date }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/requirements-tests.txt
pip install -r requirements/requirements.txt
pip install -r requirements/requirements-extras.txt
pip install pytest-cov coveralls
pip install -e .
pip install -e .[extras,tests]
- name: List packages
run: |
Expand Down Expand Up @@ -261,11 +256,16 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Get pip cache dir
id: pip-cache
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Cache test_env
uses: actions/cache@v3
with:
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements files
path: ${{ steps.pip-cache.outputs.dir }}
# look to see if there is a cache hit for the corresponding requirements files
# cache will be reset on changes to any requirements or every month
key: ${{ runner.os }}-venv-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/requirements-tests.txt') }}
-${{ hashFiles('**/requirements-extras.txt') }}-${{ hashFiles('setup.py') }} -${{ hashFiles('**/CI.yml') }}-${{ steps.date.outputs.date }}
Expand All @@ -277,12 +277,8 @@ jobs:
python -m pip install --upgrade pip
pip install mpi4py
pip install coveralls
pip install -r requirements/requirements-tests.txt
pip install -r requirements/requirements.txt
pip install -r requirements/requirements-extras.txt
pip install pytest-cov coveralls
pip install -e .
pip install -e .[extras,tests]
- name: List packages
run: |
Expand All @@ -291,7 +287,8 @@ jobs:
- name: Test with pytest
run: |
mpiexec -n 1 python -m mpi4py -m coverage run --source=elephant -m pytest && coveralls --service=github || echo "Coveralls submission failed"
mpiexec -n 1 python -m mpi4py -m coverage run --source=elephant -m pytest
coveralls --service=github || echo "Coveralls submission failed"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -306,26 +303,37 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# python versions for elephant: [3.8, 3.9, 3.10, 3.11]
python-version: [3.11]
# OS [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest]

# do not cancel all in-progress jobs if any matrix job fails
fail-fast: false

steps:
- name: Get current year-month
id: date
run: echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT

- uses: actions/checkout@v3

- name: Get pip cache dir
id: pip-cache
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
path: ${{ steps.pip-cache.outputs.dir }}

key: ${{ runner.os }}-pip-${{hashFiles('requirements/environment-tests.yml') }}-${{ hashFiles('**/CI.yml') }}-${{ steps.date.outputs.date }}

- uses: conda-incubator/setup-miniconda@030178870c779d9e5e1b4e563269f3aa69b04081 # corresponds to v3.0.3
with:
auto-update-conda: true
python-version: 3.11
python-version: ${{ matrix.python-version }}
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true
Expand All @@ -337,8 +345,7 @@ jobs:
run: |
python --version
conda install mpi4py openmpi
mamba install pytest
mamba install pytest-cov coveralls
mamba install pytest pytest-cov coveralls
pip install -e .
- name: List packages
Expand All @@ -365,6 +372,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# python versions for elephant: [3.8, 3.9, 3.10, 3.11, 3.12]
python-version: [3.12]
# OS [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest]

Expand All @@ -376,18 +385,23 @@ jobs:

- uses: actions/checkout@v3

- name: Get pip cache dir
id: pip-cache
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
path: ${{ steps.pip-cache.outputs.dir }}
# Look to see if there is a cache hit for the corresponding requirements files
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-docs.txt') }}-${{ hashFiles('**/requirements-tutorials.txt') }}-${{ hashFiles('**/environment-docs.yml') }}
-${{ hashFiles('**/CI.yml') }}-${{ steps.date.outputs.date }}

- uses: conda-incubator/setup-miniconda@030178870c779d9e5e1b4e563269f3aa69b04081 # corresponds to v3.0.3
with:
auto-update-conda: true
python-version: 3.11
python-version: ${{ matrix.python-version }}
mamba-version: "*"
activate-environment: elephant
environment-file: requirements/environment.yml
Expand All @@ -401,9 +415,7 @@ jobs:
conda install -c conda-forge openmpi pandoc libstdcxx-ng # fix libstdc++.so.6: version for new scipy versions > 1.9.1
mamba env update --file requirements/environment-docs.yml --name elephant
python -m pip install --upgrade pip
pip install -r requirements/requirements-docs.txt
pip install -r requirements/requirements-tutorials.txt
pip install -e .[extras]
pip install -e .[extras,tutorials,docs]
# run notebooks
sed -i -E "s/nbsphinx_execute *=.*/nbsphinx_execute = 'always'/g" doc/conf.py
Expand Down Expand Up @@ -431,9 +443,6 @@ jobs:
# OS [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest]

# do not cancel all in-progress jobs if any matrix job fails
fail-fast: false

steps:
# used to reset cache every month
- name: Get current year-month
Expand All @@ -442,7 +451,7 @@ jobs:
- uses: actions/checkout@v3

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

Expand All @@ -465,11 +474,8 @@ jobs:
python -m pip install --upgrade pip
pip install mpi4py
pip install -r requirements/requirements-tests.txt
pip install -r requirements/requirements.txt
pip install -r requirements/requirements-extras.txt
pip install pytest-cov coveralls
pip install -e .
pip install -e .[extras,tests]
- name: List packages
run: |
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/ruff-formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Ruff formatting

on:
workflow_dispatch:
schedule:
- cron: "0 12 * * 0" # Weekly at noon UTC on Sundays


jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Check with Ruff
id: ruff-check
uses: chartboost/ruff-action@v1
with:
src: './elephant'
args: 'format --check'
continue-on-error: true

- name: Fix with Ruff
uses: chartboost/ruff-action@v1
if : ${{ steps.ruff-check.outcome == 'failure' }}
with:
src: './elephant'
args: 'format --verbose'

- name: Create PR
uses: peter-evans/create-pull-request@v5
if : ${{ steps.ruff-check.outcome == 'failure' }}
with:
commit-message: ruff formatting
title: Ruff formatting
body: Reformatting code with ruff
branch: ruff-formatting
6 changes: 3 additions & 3 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"creators": [
{
"orcid": "0000-0003-1255-7300",
"affiliation": "Institute of Neuroscience and Medicine (INM-6) and Institute for Advanced Simulation (IAS-6) and JARA-Institute Brain Structure-Function Relationships (INM-10), Jülich Research Centre, Jülich, Germany",
"affiliation": "Institute for Advanced Simulation (IAS-6), Jülich Research Centre, Jülich, Germany",
"name": "Denker, Michael"
},
{
"orcid": "0000-0001-7292-1982",
"affiliation": "Institute of Neuroscience and Medicine (INM-6) and Institute for Advanced Simulation (IAS-6) and JARA-Institute Brain Structure-Function Relationships (INM-10), Jülich Research Centre, Jülich, Germany",
"affiliation": "Institute for Advanced Simulation (IAS-6), Jülich Research Centre, Jülich, Germany",
"name": "Kern, Moritz"
},
{
Expand All @@ -17,7 +17,7 @@
}
],

"title": "Elephant 1.0.0",
"title": "Elephant 1.1.0",

"keywords": [
"neuroscience",
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014-2023, Elephant authors and contributors
Copyright (c) 2014-2024, Elephant authors and contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Modified BSD License, see [LICENSE.txt](LICENSE.txt) for details.

#### Copyright

:copyright: 2014-2023 by the [Elephant team](doc/authors.rst).
:copyright: 2014-2024 by the [Elephant team](doc/authors.rst).


#### Acknowledgments
Expand Down
Loading

0 comments on commit 0aad87a

Please sign in to comment.