Skip to content

Commit

Permalink
Merge branch 'master' into yge/tr_direct
Browse files Browse the repository at this point in the history
  • Loading branch information
YigitElma authored Dec 12, 2024
2 parents e64f764 + 7778894 commit 47719ca
Show file tree
Hide file tree
Showing 103 changed files with 5,614 additions and 1,367 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"
10 changes: 6 additions & 4 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ jobs:
source .venv-${{ matrix.python-version }}/bin/activate
pwd
lscpu
pip list
cd tests/benchmarks
python -m pytest benchmark_cpu_small.py -vv \
--benchmark-save='Latest_Commit' \
Expand All @@ -108,6 +109,7 @@ jobs:
source .venv-${{ matrix.python-version }}/bin/activate
pwd
lscpu
pip list
cd tests/benchmarks
python -m pytest benchmark_cpu_small.py -vv \
--benchmark-save='master' \
Expand Down Expand Up @@ -149,12 +151,12 @@ jobs:
- 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
1 change: 1 addition & 0 deletions .github/workflows/jax_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
run: |
pwd
lscpu
pip list
python -m pytest -m unit \
--durations=0 \
--mpl \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/mpl_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,5 @@ jobs:
run: |
pwd
lscpu
pip list
python -m pytest tests/test_plotting.py --durations=0 --mpl --maxfail=1
1 change: 1 addition & 0 deletions .github/workflows/notebook_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ jobs:
source .venv-${{ matrix.python-version }}/bin/activate
pwd
lscpu
pip list
export PYTHONPATH=$(pwd)
pytest -v --nbmake "./docs/notebooks" \
--nbmake-timeout=2000 \
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/regression_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
source .venv-${{ matrix.python-version }}/bin/activate
pwd
lscpu
pip list
python -m pytest -v -m regression\
--durations=0 \
--cov-report xml:cov.xml \
Expand All @@ -106,14 +107,9 @@ jobs:
- name: Upload coverage
if: env.has_changes == 'true'
id : codecov
uses: Wandalen/wretry.action@v3.5.0
uses: codecov/codecov-action@v5
with:
action: codecov/codecov-action@v4
with: |
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-umbrella
files: ./cov.xml
fail_ci_if_error: true
verbose: true
attempt_limit: 10
attempt_delay: 60000 # ms, 1 min
name: codecov-umbrella
files: ./cov.xml
fail_ci_if_error: true
verbose: true
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Build package
run: python -m build --sdist --wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
16 changes: 6 additions & 10 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ jobs:
source .venv-${{ matrix.combos.python_version }}/bin/activate
pwd
lscpu
pip list
python -m pytest -v -m unit \
--durations=0 \
--cov-report xml:cov.xml \
Expand All @@ -112,14 +113,9 @@ jobs:
- name: Upload coverage
if: env.has_changes == 'true'
id : codecov
uses: Wandalen/wretry.action@v3.5.0
uses: codecov/codecov-action@v5
with:
action: codecov/codecov-action@v4
with: |
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-umbrella
files: ./cov.xml
fail_ci_if_error: true
verbose: true
attempt_limit: 10
attempt_delay: 60000 # ms, 1 min
name: codecov-umbrella
files: ./cov.xml
fail_ci_if_error: true
verbose: true
75 changes: 75 additions & 0 deletions .github/workflows/update_notebook_examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Update Notebooks and Examples
on:
schedule:
# runs on the first of every month at noon
- cron: '00 12 1 * *'

jobs:
create_issue:
name: Create issues to update notebooks and examples
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Create issue to update notebooks
run: |
if [[ $CLOSE_PREVIOUS == true ]]; then
previous_issue_number=$(gh issue list \
--label "$LABELS" \
--json number \
--jq '.[0].number')
if [[ -n $previous_issue_number ]]; then
gh issue close "$previous_issue_number"
gh issue unpin "$previous_issue_number"
fi
fi
new_issue_url=$(gh issue create \
--title "$TITLE" \
--assignee "$ASSIGNEES" \
--label "$LABELS" \
--body "$BODY")
if [[ $PINNED == true ]]; then
gh issue pin "$new_issue_url"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
TITLE: Update Notebooks
ASSIGNEES: f0uriest, dpanici, ddudt, rahulgaur104, kianorr, YigitElma
LABELS: monthly_update_notebooks
BODY: |
Reminder to check that notebooks evaluate correctly, and to update
if necessary.
PINNED: false
CLOSE_PREVIOUS: true
- name: Create issue to update notebooks
run: |
if [[ $CLOSE_PREVIOUS == true ]]; then
previous_issue_number=$(gh issue list \
--label "$LABELS" \
--json number \
--jq '.[0].number')
if [[ -n $previous_issue_number ]]; then
gh issue close "$previous_issue_number"
gh issue unpin "$previous_issue_number"
fi
fi
new_issue_url=$(gh issue create \
--title "$TITLE" \
--assignee "$ASSIGNEES" \
--label "$LABELS" \
--body "$BODY")
if [[ $PINNED == true ]]; then
gh issue pin "$new_issue_url"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
TITLE: Update Examples
ASSIGNEES: f0uriest, dpanici, ddudt, rahulgaur104, kianorr, YigitElma
LABELS: monthly_update_examples
BODY: |
Reminder to check that examples run correctly, and to update
if necessary.
PINNED: false
CLOSE_PREVIOUS: true
1 change: 1 addition & 0 deletions .github/workflows/weekly_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
run: |
pwd
lscpu
pip list
python -m pytest -v -m unit \
--durations=0 \
--splits 4 \
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
repos:
- repo: https://github.com/psf/black
rev: 24.3.0
rev: 24.10.0
hooks:
- id: black-jupyter
log_file: devtools/pre-commit.log
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v5.0.0
hooks:
- id: check-added-large-files
log_file: devtools/pre-commit.log
Expand All @@ -22,20 +22,20 @@ repos:
- id: no-commit-to-branch
log_file: devtools/pre-commit.log
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
args: ["--profile", "black"]
log_file: devtools/pre-commit.log
- repo: https://github.com/PyCQA/flake8
rev: "5.0.4"
rev: "7.1.1"
hooks:
- id: flake8
additional_dependencies: ["flake8-docstrings", "flake8-eradicate", "flake8-isort"]
log_file: devtools/pre-commit.log
- repo: https://github.com/asottile/pyupgrade
rev: v3.2.0
rev: v3.19.0
hooks:
- id: pyupgrade
log_file: devtools/pre-commit.log
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ New Feature

- Adds a new profile class ``PowerProfile`` for raising profiles to a power.

Bug Fixes

- Small bug fix to use the correct normalization length ``a`` in the BallooningStability objective

v0.13.0
-------

Expand All @@ -27,6 +31,7 @@ New Features
- Adds ``eq_fixed`` flag to ``ToroidalFlux`` to allow for the equilibrium/QFM surface to vary during optimization, useful for single-stage optimizations.
- Adds tutorial notebook showcasing QFM surface capability.
- Adds ``rotate_zeta`` function to ``desc.compat`` to rotate an ``Equilibrium`` around Z axis.
- Adds an option ``scaled_termination`` (defaults to True) to all of the desc optimizers to measure the norms for ``xtol`` and ``gtol`` in the scaled norm provided by ``x_scale`` (which defaults to using an adaptive scaling based on the Jacobian or Hessian). This should make things more robust when optimizing parameters with widely different magnitudes. The old behavior can be recovered by passing ``options={"scaled_termination": False}``.

Bug Fixes

Expand Down
2 changes: 1 addition & 1 deletion desc/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def main(cl_args=sys.argv[1:]):
and (inputs[-1]["pres_ratio"] is None)
and (inputs[-1]["bdry_ratio"] is None)
):
eq = Equilibrium(**inputs[-1], check_kwargs=False)
eq = Equilibrium(**inputs[-1], check_kwargs=False, ensure_nested=False)
equil_fam = EquilibriaFamily.solve_continuation_automatic(
eq,
objective=inputs[-1]["objective"],
Expand Down
4 changes: 2 additions & 2 deletions desc/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
from jax.lax import cond, fori_loop, scan, switch, while_loop
from jax.nn import softmax as softargmax
from jax.numpy import bincount, flatnonzero, repeat, take
from jax.numpy.fft import irfft, rfft, rfft2
from jax.numpy.fft import ifft, irfft, irfft2, rfft, rfft2
from jax.scipy.fft import dct, idct
from jax.scipy.linalg import block_diag, cho_factor, cho_solve, qr, solve_triangular
from jax.scipy.special import gammaln
Expand Down Expand Up @@ -434,7 +434,7 @@ def tangent_solve(g, y):
jit = lambda func, *args, **kwargs: func
execute_on_cpu = lambda func: func
import scipy.optimize
from numpy.fft import irfft, rfft, rfft2 # noqa: F401
from numpy.fft import ifft, irfft, irfft2, rfft, rfft2 # noqa: F401
from scipy.fft import dct, idct # noqa: F401
from scipy.integrate import odeint # noqa: F401
from scipy.linalg import ( # noqa: F401
Expand Down
1 change: 1 addition & 0 deletions desc/compute/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
_field,
_geometry,
_metric,
_neoclassical,
_omnigenity,
_profiles,
_stability,
Expand Down
Loading

0 comments on commit 47719ca

Please sign in to comment.