Skip to content

Commit

Permalink
Merge branch 'master' into pr/1417
Browse files Browse the repository at this point in the history
  • Loading branch information
fkiraly committed Sep 7, 2024
2 parents 7720d07 + e2bf3fd commit 3c8e30b
Show file tree
Hide file tree
Showing 70 changed files with 10,999 additions and 10,030 deletions.
69 changes: 12 additions & 57 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,65 +7,20 @@ on:
branches: [master]

jobs:
linter-black:
name: Check code formatting with Black
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Black
run: pip install black[jupyter]
- name: Run Black
run: black --check .

imports-check-isort:
name: Check valid import formatting with isort
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install isort
run: pip install isort==5.6.4
- name: Run isort
run: isort --check-only --diff .

linter-flake8:
name: Check valid formatting with flake8
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: pip install flake8
- name: Run checks
run: flake8


pre-commit-hooks:
name: Check that pre-commit hooks pass
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: repository checkout step
uses: actions/checkout@v4
- name: python environment step
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
run: pip install pre-commit

- name: Run checks
run: pre-commit run --all-files
python-version: "3.11"
- name: install pre-commit
run: python3 -m pip install pre-commit
- id: changed-files
name: identify modified files
uses: tj-actions/changed-files@v44
- name: run pre-commit hooks on modified files
run: pre-commit run --color always --files ${{ steps.changed-files.outputs.all_changed_files }} --show-diff-on-failure
2 changes: 1 addition & 1 deletion .github/workflows/pypi_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.11

- name: Install poetry
shell: bash
Expand Down
123 changes: 76 additions & 47 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,45 @@ on:
pull_request:
branches: [master]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
run-notebook-tutorials:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ".[dev,all_extras,github-actions]"
- name: Show dependencies
run: python -m pip list

- name: Run example notebooks
run: build_tools/run_examples.sh
shell: bash

pytest-nosoftdeps:
name: no-softdeps
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest] # add windows-2019 when poetry allows installation with `-f` flag
python-version: ["3.8", "3.9", "3.10"]
os: [ubuntu-latest, macos-13, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

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

Expand All @@ -30,58 +56,63 @@ jobs:
run: |
brew install libomp # https://github.com/pytorch/pytorch/issues/20030
- name: Setup macOS
if: runner.os == 'windows'
run: |
brew install libomp # https://github.com/pytorch/pytorch/issues/20030
- name: Get full Python version
id: full-python-version
shell: bash
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
run: echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT

- name: Install poetry
- name: Install dependencies
shell: bash
run: |
curl -sSL https://install.python-poetry.org | python3 -
pip install ".[dev,github-actions]"
- name: Set poetry path variable
run: echo "/Users/runner/.local/bin" >> $GITHUB_PATH
- name: Show dependencies
run: python -m pip list

- name: Configure poetry
- name: Run pytest
shell: bash
run: poetry config virtualenvs.in-project true
run: python -m pytest tests

- name: Set up cache
uses: actions/cache@v2
id: cache
pytest:
name: Run pytest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
python-version: ${{ matrix.python-version }}

- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
shell: bash
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
- name: Setup macOS
if: runner.os == 'macOS'
run: |
brew install libomp # https://github.com/pytorch/pytorch/issues/20030
- name: Upgrade pip
- name: Get full Python version
id: full-python-version
shell: bash
run: poetry run python -m pip install pip -U
run: echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT

- name: Install dependencies
shell: bash
run: poetry install -E "github-actions graph mqf2"
run: |
pip install ".[dev,all_extras,github-actions]"
- name: Install pytorch geometric dependencies
shell: bash
run: poetry run pip install torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.12.1+cpu.html
- name: Show dependencies
run: python -m pip list

- name: Run pytest
shell: bash
run: poetry run pytest tests
run: python -m pytest tests

- name: Statistics
if: success()
run: |
pip install coverage
coverage report
Expand All @@ -99,43 +130,41 @@ jobs:
fail_ci_if_error: false

docs:
name: Test docs build
name: Docs build
runs-on: ubuntu-latest

defaults:
run:
shell: bash
steps:
- name: Check out Git repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: 3.11

- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('docs/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
restore-keys: ${{ runner.os }}-pip-

- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y pandoc
python -m pip install --upgrade pip
sudo apt-get update --fix-missing
sudo apt-get install -y pandoc
pip install -r docs/requirements.txt
shell: bash
- name: Build sphinx documentation
run: |
cd docs
make clean
make html --debug --jobs 2 SPHINXOPTS="-W"
working-directory: docs/
run: make html --debug --jobs 2 SPHINXOPTS="-W"

- name: Upload built docs
uses: actions/upload-artifact@v2
with:
name: docs-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}
path: docs/build/html/
# Use always() to always run this step to publish test results when there are test failures
if: success()
#if: success()
24 changes: 12 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-ast
- repo: https://gitlab.com/pycqa/flake8
rev: "3.9.2"
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-ast
- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: flake8
- id: flake8
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
- id: isort
- id: isort
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 24.8.0
hooks:
- id: black
- id: black
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.3.1
rev: 1.8.7
hooks:
- id: nbqa-black
- id: nbqa-isort
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version: 2
# reference: https://docs.readthedocs.io/en/stable/config-file/v2.html#sphinx
sphinx:
configuration: docs/source/conf.py
fail_on_warning: true
# fail_on_warning: true

# Build documentation with MkDocs
#mkdocs:
Expand All @@ -21,6 +21,6 @@ formats:

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.8
version: 3.11
install:
- requirements: docs/requirements.txt
16 changes: 13 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Release Notes

## v0.10.4 UNRELEASED (xx/xx/xxxx)
## v1.0.0 Update to pytorch 2.0 (10/04/2023)


### Breaking Changes

- Upgraded to pytorch 2.0 and lightning 2.0. This brings a couple of changes, such as configuration of trainers. See the [lightning upgrade guide](https://lightning.ai/docs/pytorch/latest/upgrade/migration_guide.html). For PyTorch Forecasting, this particularly means if you are developing own models, the class method `epoch_end` has been renamed to `on_epoch_end` and replacing `model.summarize()` with `ModelSummary(model, max_depth=-1)` and `Tuner(trainer)` is its own class, so `trainer.tuner` needs replacing. (#1280)
- Changed the `predict()` interface returning named tuple - see tutorials.

### Changes

- The predict method is now using the lightning predict functionality and allows writing results to disk (#1280).

### Fixed

Expand Down Expand Up @@ -81,7 +91,7 @@

### Added

- Added support for running `pytorch_lightning.trainer.test` (#759)
- Added support for running `lightning.trainer.test` (#759)

### Fixed

Expand Down Expand Up @@ -402,7 +412,7 @@ This release has only one purpose: Allow usage of PyTorch Lightning 1.0 - all te
- Using `LearningRateMonitor` instead of `LearningRateLogger`
- Use `EarlyStopping` callback in trainer `callbacks` instead of `early_stopping` argument
- Update metric system `update()` and `compute()` methods
- Use `trainer.tuner.lr_find()` instead of `trainer.lr_find()` in tutorials and examples
- Use `Tuner(trainer).lr_find()` instead of `trainer.lr_find()` in tutorials and examples
- Update poetry to 1.1.0

---
Expand Down
Loading

0 comments on commit 3c8e30b

Please sign in to comment.