Skip to content

Add build and venv directories to flake8 config #1218

Add build and venv directories to flake8 config

Add build and venv directories to flake8 config #1218

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
[push, pull_request]
concurrency:
group: ${{ github.workflow}}-${{ github.ref }}
cancel-in-progress: true
jobs:
pytest:
runs-on: ubuntu-latest
timeout-minutes: 10
if: always()
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[tests]
- name: Test with pytest
run: pytest
integrated-tests:
runs-on: ubuntu-latest
timeout-minutes: 15
if: always()
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[tests]
- name: Integrated tests
run: |
pip install pytest xarray
cd integrated_tests/
./test_suite.py
examples:
runs-on: ubuntu-latest
timeout-minutes: 30
if: always()
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install sympy
pip install -e .
- name: Examples
run: |
cd examples/tokamak
./tokamak_example.py --no-plot lsn
./tokamak_example.py --no-plot usn
./tokamak_example.py --no-plot cdn
./tokamak_example.py --no-plot ldn
./tokamak_example.py --no-plot udn
./tokamak_example.py --no-plot udn2
cd ../torpex-xpoint
hypnotoad-torpex --noplot torpex-coils.yaml
hypnotoad-torpex --noplot torpex-coils-nonorth.yaml
utilities:
# Check that various command line utilities provided by hypnotoad keep
# running without errors. Correctness of output is not tested!
runs-on: ubuntu-latest
timeout-minutes: 30
if: always()
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install xbout
pip install -e .
- name: Utilities
run: |
cd integrated_tests/grid_files
hypnotoad-plot-equilibrium --no-show --output test-single-null.pdf test_single-null.eqdsk
hypnotoad-plot-equilibrium --no-show --wall --separatrix --psi-labels --color-contours --highlight-region 0.99 1.01 --highlight-color blue test_single-null.eqdsk
hypnotoad-plot-equilibrium --no-show --wall --separatrix --psi-labels --color-contours --highlight-region 0.99 1.01 --highlight-color blue test_connected-double-null.eqdsk
hypnotoad-plot-equilibrium --no-show --wall --separatrix --psi-labels --color-contours --highlight-region 0.99 1.01 --highlight-color blue test_disconnected-double-null.eqdsk
echo "psinorm_core: 0.99" > test.yml
echo "psinorm_sol: 1.01" >> test.yml
hypnotoad-get-flux-surfaces test_single-null.eqdsk test.yml
hypnotoad-get-flux-surfaces --output test1.nc --save-plot test.png test_single-null.eqdsk test.yml
hypnotoad-get-flux-surfaces --output test2.nc --save-plot test.pdf test_connected-double-null.eqdsk test.yml
# modify input file so that we actually detect the disconnection within the grid
echo "nx_inter_sep: 2" >> test.yml
hypnotoad-get-flux-surfaces --output test3.nc --save-plot test.pdf test_disconnected-double-null.eqdsk test.yml
cd ../connected_doublenull_orthogonal
hypnotoad-plot-grid-cells --no-show --save-as test.svg expected_orthogonal.grd.nc
hypnotoad-plot-grid-cells --no-show --mxg 3 --branch-cuts --separatrix --targets expected_orthogonal.grd.nc
hypnotoad-recreate-inputs -g test1.eqdsk expected_orthogonal.grd.nc
hypnotoad-recreate-inputs -g test2.eqdsk -y test.yml expected_orthogonal.grd.nc
flake8:
runs-on: ubuntu-latest
timeout-minutes: 10
if: always()
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
- name: Lint with flake8
run: |
pip install flake8
flake8
black:
runs-on: ubuntu-latest
timeout-minutes: 10
if: always()
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Check formatting with black
run: |
pip install black
black --check --diff --color .