Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/fv3_translate_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ jobs:
fv3_translate_tests:
uses: NOAA-GFDL/pyFV3/.github/workflows/translate.yaml@develop
with:
component_trigger: true
component_trigger: true
component_name: NDSL
24 changes: 12 additions & 12 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install pre-commit
run: pip install pre-commit
- name: Install pre-commit
run: pip install pre-commit

- name: Run lint via pre-commit
run: pre-commit run --all-files
- name: Run lint via pre-commit
run: pre-commit run --all-files
2 changes: 1 addition & 1 deletion .github/workflows/pace_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ jobs:
pace_main_tests:
uses: NOAA-GFDL/pace/.github/workflows/main_unit_tests.yaml@develop
with:
component_trigger: true
component_trigger: true
component_name: NDSL
2 changes: 1 addition & 1 deletion .github/workflows/shield_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ jobs:
shield_translate_tests:
uses: NOAA-GFDL/pySHiELD/.github/workflows/translate.yaml@develop
with:
component_trigger: true
component_trigger: true
component_name: NDSL
28 changes: 14 additions & 14 deletions .github/workflows/unit_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ jobs:
image: ghcr.io/noaa-gfdl/miniforge:mpich
steps:

- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Install Python packages
run: pip3 install .[test]
- name: Install Python packages
run: pip3 install .[test]

- name: Run serial-cpu tests
run: coverage run --rcfile=setup.cfg -m pytest tests
- name: Run serial-cpu tests
run: coverage run --rcfile=pyproject.toml -m pytest tests

- name: Run parallel-cpu tests
run: mpiexec -np 6 --oversubscribe coverage run --rcfile=setup.cfg -m mpi4py -m pytest tests/mpi
- name: Run parallel-cpu tests
run: mpiexec -np 6 --oversubscribe coverage run --rcfile=pyproject.toml -m mpi4py -m pytest tests/mpi

- name: Output code coverage
run: |
coverage combine
coverage report
- name: Output code coverage
run: |
coverage combine
coverage report
79 changes: 44 additions & 35 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,59 @@ default_language_version:
python: python3

repos:
- repo: https://github.com/psf/black
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
additional_dependencies: ["click==8.0.4"]
- id: black
additional_dependencies: ["click==8.0.4"]

- repo: https://github.com/pre-commit/mirrors-isort
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
- id: isort
args: ["--profile", "black"]
- id: isort
args: ["--profile", "black"]

- repo: https://github.com/pre-commit/mirrors-mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.16.1
hooks:
- id: mypy
name: mypy-ndsl
args: [--config-file, setup.cfg]
additional_dependencies: [types-PyYAML]
files: ndsl
exclude: |
(?x)^(
ndsl/ndsl/gt4py_utils.py |
)$
- repo: https://github.com/pre-commit/pre-commit-hooks
- id: mypy
name: mypy-ndsl
args: ["--config-file", "pyproject.toml"]
additional_dependencies: [types-PyYAML]
files: ndsl
exclude: |
(?x)^(
ndsl/ndsl/gt4py_utils.py |
)$

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pycqa/flake8
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/pycqa/flake8
rev: 7.3.0
hooks:
- id: flake8
name: flake8
language_version: python3
args: [--config, setup.cfg]
exclude: |
(?x)^(
.*/__init__.py |
)$
- id: flake8
name: flake8 __init__.py files
files: "__init__.py"
# ignore unused import error in __init__.py files
args: ["--ignore=F401,E203", --config, setup.cfg]
- id: flake8
name: flake8
language_version: python3
additional_dependencies: [Flake8-pyproject]
exclude: |
(?x)^(
.*/__init__.py |
)$
- id: flake8
additional_dependencies: [Flake8-pyproject]
name: flake8 __init__.py files
files: "__init__.py"

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.15.0
hooks:
- id: pretty-format-toml
args: [--autofix, --indent, "2"]
- id: pretty-format-yaml
args: [--autofix, --preserve-quotes, --indent, "2", --offset, "2"]
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cd NDSL/
python -m venv .venv/
source ./venv/bin/activate

# Choose pip install -e .[develop] if you'd like to contribute
# Choose pip install -e .[dev] if you'd like to contribute
pip install .[demos]
```

Expand Down Expand Up @@ -57,11 +57,11 @@ See [quickstart](#quickstart) above on how to pull and setup a virtual environme
- `ndsl[test]`: extra dependencies to run tests (based on `pytest`)
- `ndsl[demos]`: extra dependencies to run [NDSL examples](./examples/NDSL/)
- `ndsl[docs]`: extra dependencies to build the docs
- `ndsl[develop]`: installs tools for development, docs, and tests.
- `ndsl[dev]`: installs tools for development, docs, and tests.

### Running tests

Tests are available via `pytest` (don't forget to install the `test` or `develop` extras).
Tests are available via `pytest` (don't forget to install the `test` or `dev` extras).

To run serial tests on CPU (GPU tests also run if `cupy` is available)

Expand All @@ -79,15 +79,15 @@ mpirun -np 6 pytest tests/mpi

### Code/contribution guidelines

1. Code quality is enforced by `pre-commit` (which is part of the "develop" extra). Run `pre-commit install` to install the pre-commit hooks locally or make sure to run `pre-commit run -a` before submitting a pull request.
1. Code quality is enforced by `pre-commit` (which is part of the "dev" extra). Run `pre-commit install` to install the pre-commit hooks locally or make sure to run `pre-commit run -a` before submitting a pull request.
2. While we don't strictly enforce type hints, we add them on new code.
3. Pull requests have to merged as "squash merge" to keep the `git` history clean.

### Documentation

We are using [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/), which allows us to write the docs in Markdown files and optionally serve it as a static site.

To view the documentation, install NDSL with the `docs` or `develop` extras. Then run the following:
To view the documentation, install NDSL with the `docs` or `dev` extras. Then run the following:

```bash
mkdocs serve
Expand Down
16 changes: 8 additions & 8 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ nav:
- Home: index.md
- User documentation: user/index.md
- Porting:
- General Concepts: porting/index.md
- Testing Infrastructure: porting/translate/index.md
- General Concepts: porting/index.md
- Testing Infrastructure: porting/translate/index.md
- Under the hood:
- Technical Documentation: dev/index.md
- DaCe: dev/dace.md
- GT4Py: dev/gt4py.md
- Technical Documentation: dev/index.md
- DaCe: dev/dace.md
- GT4Py: dev/gt4py.md


markdown_extensions:
Expand All @@ -39,9 +39,9 @@ markdown_extensions:
- pymdownx.superfences:
custom_fences:
# support for mermaid graphs
- name: mermaid
class: mermaid
format: python/name:pymdownx.superfences.fence_code_format
- name: mermaid
class: mermaid
format: python/name:pymdownx.superfences.fence_code_format
# image inclusion

plugins:
Expand Down
Loading