diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..a19ade0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +CHANGELOG.md merge=union diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..a2c619f --- /dev/null +++ b/.github/CODEOWNERS @@ -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 diff --git a/.github/ci-hpc-config.yml b/.github/ci-hpc-config.yml new file mode 100644 index 0000000..5c27b03 --- /dev/null +++ b/.github/ci-hpc-config.yml @@ -0,0 +1,7 @@ +build: + python: '3.10' + modules: + - ninja + python_dependencies: + - ecmwf/anemoi-utils@develop + parallel: 64 diff --git a/.github/workflows/changelog-pr-update.yml b/.github/workflows/changelog-pr-update.yml index 43acb1c..e7ed9a2 100644 --- a/.github/workflows/changelog-pr-update.yml +++ b/.github/workflows/changelog-pr-update.yml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5867ee0..8b2926b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c042b1f..f3c3962 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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: @@ -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 @@ -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 @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 55fba06..e6553c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 05a99c4..214f82c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 = [ @@ -47,9 +40,7 @@ classifiers = [ "Programming Language :: Python :: Implementation :: PyPy", ] -dynamic = [ - "version", -] +dynamic = [ "version" ] dependencies = [ "anemoi-utils>=0.1.9", "einops>=0.6.1", @@ -57,19 +48,9 @@ dependencies = [ "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", @@ -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/"