Skip to content

Commit

Permalink
Merge branch 'develop' into feature/activation_function
Browse files Browse the repository at this point in the history
  • Loading branch information
JesperDramsch committed Aug 28, 2024
2 parents a5c76b2 + 5525e7a commit 85d45ae
Show file tree
Hide file tree
Showing 10 changed files with 142 additions and 39 deletions.
3 changes: 3 additions & 0 deletions .github/ci-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dependency_branch: develop
parallelism_factor: 8
self_build: false # Only for python packages
34 changes: 34 additions & 0 deletions .github/workflows/changelog-release-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# .github/workflows/update-changelog.yaml
name: "Update Changelog"

on:
release:
types: [released]

permissions:
pull-requests: write
contents: write

jobs:
update:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.target_commitish }}

- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.tag_name }}
heading-text: ${{ github.event.release.name }}

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
branch: docs/changelog-update-${{ github.event.release.tag_name }}
title: '[Changelog] Update to ${{ github.event.release.tag_name }}'
add-paths: |
CHANGELOG.md
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: ci

on:
# Trigger the workflow on push to master or develop, except tag creation
push:
branches:
- 'main'
- 'develop'
tags-ignore:
- '**'
paths:
- "src/**"
- "tests/**"

# Trigger the workflow on pull request
pull_request: ~

# Trigger the workflow manuallyp instals
workflow_dispatch: ~

# Trigger after public PR approved for CI
pull_request_target:
types: [labeled]

jobs:
# Run CI including downstream packages on self-hosted runners
downstream-ci:
name: downstream-ci
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
with:
anemoi-models: ecmwf/anemoi-models@${{ github.event.pull_request.head.sha || github.sha }}
codecov_upload: true
secrets: inherit

# Build downstream packages on HPC
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
with:
anemoi-models: ecmwf/anemoi-models@${{ github.event.pull_request.head.sha || github.sha }}
secrets: inherit
10 changes: 10 additions & 0 deletions .github/workflows/label-public-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Manage labels of pull requests that originate from forks
name: label-public-pr

on:
pull_request_target:
types: [opened, synchronize]

jobs:
label:
uses: ecmwf-actions/reusable-workflows/.github/workflows/label-pr.yml@v2
27 changes: 3 additions & 24 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v2
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -48,27 +48,6 @@ jobs:
run: pytest

deploy:

if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
needs: [checks, quality]

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m build
twine upload dist/*
uses: ecmwf-actions/reusable-workflows/.github/workflows/cd-pypi.yml@v2
secrets: inherit
22 changes: 22 additions & 0 deletions .github/workflows/readthedocs-pr-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Read the Docs PR Preview
on:
pull_request_target:
types:
- opened
- synchronize
- reopened
# Execute this action only on PRs that touch
# documentation files.
paths:
- "docs/**"

permissions:
pull-requests: write

jobs:
documentation-links:
runs-on: ubuntu-latest
steps:
- uses: readthedocs/actions/preview@v1
with:
project-slug: "anemoi-models"
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repos:
- 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/psf/black-pre-commit-mirror
rev: 24.4.2
rev: 24.8.0
hooks:
- id: black
args: [--line-length=120]
Expand All @@ -34,7 +34,7 @@ repos:
- --force-single-line-imports
- --profile black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.6
rev: v0.6.2
hooks:
- id: ruff
# Next line if for documenation cod snippets
Expand Down Expand Up @@ -65,6 +65,6 @@ repos:
- 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.1.3"
rev: "2.2.1"
hooks:
- id: pyproject-fmt
31 changes: 22 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,28 @@ Keep it human-readable, your future self will thank you!
## [Unreleased]

### Added
- CI workflow to update the changelog on release

### 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.

### Removed

## [0.2.1] - Dependency update

### Added

- downstream-ci pipeline
- readthedocs PR update check action

### Removed

## 0.2.0
- anemoi-datasets dependency

## [0.2.0] - Support Heterodata

### Added

Expand All @@ -26,18 +42,15 @@ Keep it human-readable, your future self will thank you!

- Updated to support new PyTorch Geometric HeteroData structure (defined by `anemoi-graphs` package).

### Removed

## 0.1.0 Initial Release
## [0.1.0] - Initial Release

### Added
- Documentation
- Initial code release with models, layers, distributed, preprocessing, and data_indices
- Added Changelog

### Changed

### Removed

## Git Diffs:
<!-- Add Git Diffs for Links above -->
[unreleased]: https://github.com/ecmwf/anemoi-models/compare/0.2.1...HEAD
[0.2.1]: https://github.com/ecmwf/anemoi-models/compare/0.2.0...0.2.1
[0.2.0]: https://github.com/ecmwf/anemoi-models/compare/0.1.0...0.2.0
[0.1.0]: https://github.com/ecmwf/anemoi-models/releases/tag/0.1.0
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ dynamic = [
"version",
]
dependencies = [
"anemoi-datasets>=0.2.1",
"anemoi-utils>=0.1.9",
"einops>=0.6.1",
"hydra-core>=1.3",
Expand Down
4 changes: 2 additions & 2 deletions src/anemoi/models/layers/mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ def _register_edges(
trainable_size : int
Trainable tensor size
"""
if edge_attributes is None:
raise ValueError("Edge attributes must be provided")
assert sub_graph, f"{self.__class__.__name__} needs a valid sub_graph to register edges."
assert edge_attributes is not None, "Edge attributes must be provided"

edge_attr_tensor = torch.cat([sub_graph[attr] for attr in edge_attributes], axis=1)

Expand Down

0 comments on commit 85d45ae

Please sign in to comment.