Skip to content

Commit

Permalink
Chore/multiple fixes ci precommit (#41)
Browse files Browse the repository at this point in the history
* fix: change pre-cmmit autoupdate schedule to monthly

* fix: change the merge strategy for Changelog to Union

* fix: add .envrc to .gitignore

* ci: ignore pre-commit-config and readthedocs for changelog updates

* ci: fix to correct hpc workflow call

* fix: update precommit config

* chore: update pre-commits

* feat: add codeowners file

* chore: update dependencies

* ci: add hpc-config

* docs: changelog

* fix: respond to review comments

---------

Co-authored-by: Jesper Dramsch <[email protected]>
  • Loading branch information
theissenhelen and JesperDramsch authored Sep 18, 2024
1 parent dbee83b commit 43846f0
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 37 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHANGELOG.md merge=union
6 changes: 6 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# CODEOWNERS file

# Protect workflow files
/.github/ @theissenhelen @jesperdramsch @gmertes
/.pre-commit-config.yaml @theissenhelen @jesperdramsch @gmertes
/pyproject.toml @theissenhelen @jesperdramsch @gmertes
7 changes: 7 additions & 0 deletions .github/ci-hpc-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
build:
python: '3.10'
modules:
- ninja
python_dependencies:
- ecmwf/anemoi-utils@develop
parallel: 64
3 changes: 3 additions & 0 deletions .github/workflows/changelog-pr-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Check Changelog Update on PR
on:
pull_request:
types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
paths-ignore:
- .pre-commit-config.yaml
- .readthedocs.yaml
jobs:
Check-Changelog:
name: Check Changelog Action
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
downstream-ci-hpc:
name: downstream-ci-hpc
if: ${{ !github.event.pull_request.head.repo.fork && github.event.action != 'labeled' || github.event.label.name == 'approved-for-ci' }}
uses: ecmwf-actions/downstream-ci/.github/workflows/downstream-ci.yml@main
uses: ecmwf-actions/downstream-ci/.github/workflows/downstream-ci-hpc.yml@main
with:
anemoi-models: ecmwf/anemoi-models@${{ github.event.pull_request.head.sha || github.sha }}
secrets: inherit
31 changes: 23 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ repos:
- id: no-commit-to-branch # Prevent committing to main / master
- id: check-added-large-files # Check for large files added to git
- id: check-merge-conflict # Check for files that contain merge conflict
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0 # Use the ref you want to point at
hooks:
- id: python-use-type-annotations # Check for missing type annotations
- id: python-check-blanket-noqa # Check for # noqa: all
- id: python-no-log-warn # Check for log.warn
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.8.0
hooks:
Expand All @@ -34,7 +40,7 @@ repos:
- --force-single-line-imports
- --profile black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.3
rev: v0.6.4
hooks:
- id: ruff
# Next line if for documenation cod snippets
Expand All @@ -45,7 +51,7 @@ repos:
- --exit-non-zero-on-fix
- --preview
- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v0.9.1
rev: v1.0.0
hooks:
- id: sphinx-lint
# For now, we use it. But it does not support a lot of sphinx features
Expand All @@ -59,12 +65,21 @@ repos:
hooks:
- id: docconvert
args: ["numpy"]
- repo: https://github.com/b8raoult/optional-dependencies-all
rev: "0.0.6"
hooks:
- id: optional-dependencies-all
args: ["--inplace", "--exclude-keys=dev,docs,tests", "--group=dev=all,docs,tests"]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "2.2.1"
rev: "2.2.3"
hooks:
- id: pyproject-fmt
- repo: https://github.com/jshwi/docsig # Check docstrings against function sig
rev: v0.60.1
hooks:
- id: docsig
args:
- --ignore-no-params # Allow docstrings without parameters
- --check-dunders # Check dunder methods
- --check-overridden # Check overridden methods
- --check-protected # Check protected methods
- --check-class # Check class docstrings
- --disable=E113 # Disable empty docstrings
- --summary # Print a summary
ci:
autoupdate_schedule: monthly
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ Keep it human-readable, your future self will thank you!

- CI workflow to update the changelog on release
- Remapper: Preprocessor for remapping one variable to multiple ones. Includes changes to the data indices since the remapper changes the number of variables. With optional config keywords.
- Codeowners file
- Pygrep precommit hooks
- Docsig precommit hooks
- Changelog merge strategy

### Changed

- Update CI to inherit from common infrastructue reusable workflows
- run downstream-ci only when src and tests folders have changed
- New error messages for wrongs graphs.
- Bugfixes for CI

### Removed

Expand Down
34 changes: 6 additions & 28 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,13 @@
[build-system]
build-backend = "setuptools.build_meta"

requires = [
"setuptools>=61",
"setuptools-scm>=8",
]
requires = [ "setuptools>=61", "setuptools-scm>=8" ]

[project]
name = "anemoi-models"
description = "A package to hold various functions to support training of ML models."
readme = "README.md"
keywords = [
"ai",
"models",
"tools",
]
keywords = [ "ai", "models", "tools" ]

license = { file = "LICENSE" }
authors = [
Expand All @@ -47,29 +40,17 @@ classifiers = [
"Programming Language :: Python :: Implementation :: PyPy",
]

dynamic = [
"version",
]
dynamic = [ "version" ]
dependencies = [
"anemoi-utils>=0.1.9",
"einops>=0.6.1",
"hydra-core>=1.3",
"torch>=2.2",
"torch-geometric>=2.3,<2.5",
]
optional-dependencies.all = [
]
optional-dependencies.all = [ ]

optional-dependencies.dev = [
"hypothesis",
"nbsphinx",
"pandoc",
"pytest",
"rstfmt",
"sphinx",
"sphinx-argparse<0.5",
"sphinx-rtd-theme",
]
optional-dependencies.dev = [ "anemoi-models[all,docs,tests]" ]

optional-dependencies.docs = [
"nbsphinx",
Expand All @@ -80,10 +61,7 @@ optional-dependencies.docs = [
"sphinx-rtd-theme",
]

optional-dependencies.tests = [
"hypothesis",
"pytest",
]
optional-dependencies.tests = [ "hypothesis", "pytest" ]

urls.Documentation = "https://anemoi-models.readthedocs.io/"
urls.Homepage = "https://github.com/ecmwf/anemoi-models/"
Expand Down

0 comments on commit 43846f0

Please sign in to comment.