Skip to content

Commit

Permalink
Merge branch 'master' into dp/shareparams
Browse files Browse the repository at this point in the history
  • Loading branch information
dpanici committed Feb 13, 2025
2 parents d159675 + f4cb154 commit d9943d6
Show file tree
Hide file tree
Showing 208 changed files with 829,236 additions and 431,742 deletions.
44 changes: 44 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "pip"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
groups:
# group similar dependencies together into fewer PRs
docs:
patterns:
- "sphinx"
linting:
patterns:
- "flake8"
- "black"
- "pre-commit"
testing:
patterns:
- "pytest"
- "qic"
- "qsc"
- "shapely"
minor_packages:
patterns:
- "colorama"
- "nvgpu"
- "psutil"
- "pylatexenc"
- "termcolor"
jax:
patterns:
- "jax"
- "diffrax"
- "interpax"
- "orthax"
- "quadax"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
43 changes: 28 additions & 15 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,30 +58,45 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Check full Python version
run: |
python --version
python_version=$(python --version 2>&1 | cut -d' ' -f2)
echo "Python version: $python_version"
echo "version=$python_version" >> $GITHUB_ENV
- name: Restore Python environment cache
if: env.has_changes == 'true'
id: restore-env
uses: actions/cache/restore@v4
with:
path: .venv-${{ matrix.python-version }}
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }}
path: .venv-${{ env.version }}
key: ${{ runner.os }}-venv-${{ env.version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }}

- name: Set up virtual environment if not restored from cache
if: steps.restore-env.outputs.cache-hit != 'true' && env.has_changes == 'true'
run: |
gh cache list
python -m venv .venv-${{ matrix.python-version }}
source .venv-${{ matrix.python-version }}/bin/activate
python -m venv .venv-${{ env.version }}
source .venv-${{ env.version }}/bin/activate
python -m pip install --upgrade pip
pip install -r devtools/dev-requirements.txt
pip install matplotlib==3.9.2
- name: Benchmark with pytest-benchmark (PR)
- name: Action Details
if: env.has_changes == 'true'
run: |
source .venv-${{ matrix.python-version }}/bin/activate
source .venv-${{ env.version }}/bin/activate
which python
python --version
pwd
lscpu
pip list
- name: Benchmark with pytest-benchmark (PR)
if: env.has_changes == 'true'
run: |
source .venv-${{ env.version }}/bin/activate
cd tests/benchmarks
python -m pytest benchmark_cpu_small.py -vv \
--benchmark-save='Latest_Commit' \
Expand All @@ -105,9 +120,7 @@ jobs:
- name: Benchmark with pytest-benchmark (MASTER)
if: env.has_changes == 'true'
run: |
source .venv-${{ matrix.python-version }}/bin/activate
pwd
lscpu
source .venv-${{ env.version }}/bin/activate
cd tests/benchmarks
python -m pytest benchmark_cpu_small.py -vv \
--benchmark-save='master' \
Expand All @@ -120,7 +133,7 @@ jobs:
- name: Put benchmark results in same folder
if: env.has_changes == 'true'
run: |
source .venv-${{ matrix.python-version }}/bin/activate
source .venv-${{ env.version }}/bin/activate
pwd
cd tests/benchmarks
find .benchmarks/ -type f -printf "%T@ %p\n" | sort -n | cut -d' ' -f 2- | tail -n 1 > temp1
Expand All @@ -141,20 +154,20 @@ jobs:
- name: Compare latest commit results to the master branch results
if: env.has_changes == 'true'
run: |
source .venv-${{ matrix.python-version }}/bin/activate
source .venv-${{ env.version }}/bin/activate
cd tests/benchmarks
pwd
python compare_bench_results.py
cat commit_msg.txt
- name: Comment PR with the results
if: env.has_changes == 'true'
uses: thollander/actions-comment-pull-request@v2
uses: thollander/actions-comment-pull-request@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
with:
filePath: tests/benchmarks/commit_msg.txt
comment_tag: benchmark
file-path: tests/benchmarks/commit_msg.txt
comment-tag: benchmark

- name: Upload benchmark data
if: always() && env.has_changes == 'true'
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,32 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Check full Python version
run: |
python --version
python_version=$(python --version 2>&1 | cut -d' ' -f2)
echo "Python version: $python_version"
echo "version=$python_version" >> $GITHUB_ENV
- name: Restore Python environment cache
id: restore-env
uses: actions/cache/restore@v4
with:
path: .venv-${{ matrix.python-version }}
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }}
path: .venv-${{ env.version }}
key: ${{ runner.os }}-venv-${{ env.version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }}

- name: Set up virtual environment if not restored from cache
if: steps.restore-env.outputs.cache-hit != 'true'
run: |
gh cache list
python -m venv .venv-${{ matrix.python-version }}
source .venv-${{ matrix.python-version }}/bin/activate
python -m venv .venv-${{ env.version }}
source .venv-${{ env.version }}/bin/activate
python -m pip install --upgrade pip
pip install -r devtools/dev-requirements.txt
- name: Check files using the black formatter
run: |
source .venv-${{ matrix.python-version }}/bin/activate
source .venv-${{ env.version }}/bin/activate
black --version
black --check desc/ tests/ || black_return_code=$?
echo "BLACK_RETURN_CODE=$black_return_code" >> $GITHUB_ENV
Expand Down
22 changes: 15 additions & 7 deletions .github/workflows/cache_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,28 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Check full Python version
run: |
python --version
python_version=$(python --version 2>&1 | cut -d' ' -f2)
echo "Python version: $python_version"
echo "version=$python_version" >> $GITHUB_ENV
- name: Delete old cached file with same python version
run: |
echo "Current Cached files list"
gh cache list
echo "Deleting cached files with pattern: ${{ runner.os }}-venv-${{ matrix.python-version }}-"
for cache_key in $(gh cache list --json key -q ".[] | select(.key | startswith(\"${{ runner.os }}-venv-${{ matrix.python-version }}-\")) | .key"); do
echo "Deleting cached files with pattern: ${{ runner.os }}-venv-${{ env.version }}-"
for cache_key in $(gh cache list --json key -q ".[] | select(.key | startswith(\"${{ runner.os }}-venv-${{ env.version }}-\")) | .key"); do
echo "Deleting cache with key: $cache_key"
gh cache delete "$cache_key"
done
# Update the matplotlib version if needed later
- name: Set up virtual environment
run: |
python -m venv .venv-${{ matrix.python-version }}
source .venv-${{ matrix.python-version }}/bin/activate
python -m venv .venv-${{ env.version }}
source .venv-${{ env.version }}/bin/activate
python -m pip install --upgrade pip
pip install -r devtools/dev-requirements.txt
pip install matplotlib==3.9.2
Expand All @@ -47,12 +54,13 @@ jobs:
id: cache-env
uses: actions/cache@v4
with:
path: .venv-${{ matrix.python-version }}
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }}
path: .venv-${{ env.version }}
key: ${{ runner.os }}-venv-${{ env.version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }}

- name: Verify virtual environment activation
run: |
source .venv-${{ matrix.python-version }}/bin/activate
source .venv-${{ env.version }}/bin/activate
which python
python --version
pip --version
pip list
3 changes: 2 additions & 1 deletion .github/workflows/jax_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ jobs:
jax-version: [0.4.12, 0.4.13, 0.4.14, 0.4.16, 0.4.17,
0.4.18, 0.4.19, 0.4.20, 0.4.21, 0.4.22, 0.4.23,
0.4.24, 0.4.25, 0.4.26, 0.4.27, 0.4.28, 0.4.29,
0.4.30, 0.4.31, 0.4.33, 0.4.34, 0.4.35]
0.4.30, 0.4.31, 0.4.33, 0.4.34, 0.4.35, 0.4.37]
# 0.4.32 is not available on PyPI
# earlier jax versions are not compatible with other
# dependencies as of 2024-10-04
# 0.4.36 has a bug that causes tests to fail
group: [1, 2]
steps:
- uses: actions/checkout@v4
Expand Down
41 changes: 14 additions & 27 deletions .github/workflows/mpl_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,8 @@ jobs:
strategy:
fail-fast: false
matrix:
mpl-version: [3.0.0]
mpl-version: [3.5.0]
include:
- mpl-version: 3.0.0
- mpl-version: 3.0.1
- mpl-version: 3.0.2
- mpl-version: 3.0.3
- mpl-version: 3.1.0
- mpl-version: 3.1.1
- mpl-version: 3.1.2
- mpl-version: 3.1.3
- mpl-version: 3.2.0
- mpl-version: 3.2.1
- mpl-version: 3.2.2
- mpl-version: 3.3.0
- mpl-version: 3.3.1
- mpl-version: 3.3.2
- mpl-version: 3.3.3
- mpl-version: 3.3.4
- mpl-version: 3.4.0
- mpl-version: 3.4.1
- mpl-version: 3.4.2
- mpl-version: 3.4.3
- mpl-version: 3.5.0
- mpl-version: 3.5.1
- mpl-version: 3.5.2
- mpl-version: 3.5.3
Expand All @@ -55,6 +34,8 @@ jobs:
- mpl-version: 3.8.4
- mpl-version: 3.9.0
- mpl-version: 3.9.2
- mpl-version: 3.9.3
- mpl-version: 3.10.0

steps:
- uses: actions/checkout@v4
Expand All @@ -63,13 +44,19 @@ jobs:
with:
python-version: '3.10'
cache: pip
- name: Install dependencies
- name: Install dependencies with given Matplotlib version
run: |
python -m pip install --upgrade pip
pip install -r devtools/dev-requirements.txt
pip install "matplotlib==${{ matrix.mpl-version }}"
- name: Test with pytest
sed -i '/matplotlib/d' ./requirements.txt
sed -i '1i\matplotlib == ${{ matrix.mpl-version }}' ./requirements.txt
cat ./requirements.txt
pip install -r ./devtools/dev-requirements.txt
- name: Action Details
run: |
pwd
lscpu
pip list
- name: Test with pytest
run: |
python -m pytest tests/test_plotting.py --durations=0 --mpl --maxfail=1
27 changes: 21 additions & 6 deletions .github/workflows/notebook_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,30 +51,45 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Check full Python version
run: |
python --version
python_version=$(python --version 2>&1 | cut -d' ' -f2)
echo "Python version: $python_version"
echo "version=$python_version" >> $GITHUB_ENV
- name: Restore Python environment cache
if: env.has_changes == 'true'
id: restore-env
uses: actions/cache/restore@v4
with:
path: .venv-${{ matrix.python-version }}
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }}
path: .venv-${{ env.version }}
key: ${{ runner.os }}-venv-${{ env.version }}-${{ hashFiles('devtools/dev-requirements.txt', 'requirements.txt') }}

- name: Set up virtual environment if not restored from cache
if: steps.restore-env.outputs.cache-hit != 'true' && env.has_changes == 'true'
run: |
gh cache list
python -m venv .venv-${{ matrix.python-version }}
source .venv-${{ matrix.python-version }}/bin/activate
python -m venv .venv-${{ env.version }}
source .venv-${{ env.version }}/bin/activate
python -m pip install --upgrade pip
pip install -r devtools/dev-requirements.txt
pip install matplotlib==3.9.2
- name: Test notebooks with pytest and nbmake
- name: Action Details
if: env.has_changes == 'true'
run: |
source .venv-${{ matrix.python-version }}/bin/activate
source .venv-${{ env.version }}/bin/activate
which python
python --version
pwd
lscpu
pip list
- name: Test notebooks with pytest and nbmake
if: env.has_changes == 'true'
run: |
source .venv-${{ env.version }}/bin/activate
export PYTHONPATH=$(pwd)
pytest -v --nbmake "./docs/notebooks" \
--nbmake-timeout=2000 \
Expand Down
Loading

0 comments on commit d9943d6

Please sign in to comment.