From e26be994b5670d402302c02062a5776e6565477a Mon Sep 17 00:00:00 2001 From: Junfeng Qiao Date: Mon, 3 Jul 2023 19:15:15 +0200 Subject: [PATCH] Update github workflows --- .ci/install_script.sh | 27 ----- .github/workflows/ci.yml | 174 ++++++++++++++++-------------- .github/workflows_source/ci.yml | 90 ---------------- .pre-commit-config.yaml | 21 +--- .readthedocs.yml | 2 +- CHANGELOG.md | 12 ++- pyproject.toml | 1 + utils/interpolate_yaml_anchors.py | 60 ----------- 8 files changed, 107 insertions(+), 280 deletions(-) delete mode 100755 .ci/install_script.sh delete mode 100644 .github/workflows_source/ci.yml delete mode 100755 utils/interpolate_yaml_anchors.py diff --git a/.ci/install_script.sh b/.ci/install_script.sh deleted file mode 100755 index 02a7829..0000000 --- a/.ci/install_script.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -# Author: Dominik Gresch - -# Be verbose, and stop with error as soon there's one -set -ev - -pip install -U pip wheel setuptools - -case "$INSTALL_TYPE" in - testing) - pip install codecov - pip install -e .[testing] - ;; - testing_sdist) - python setup.py sdist - ls -1 dist/ | xargs -I % pip install dist/%[testing] - ;; - dev_precommit) - pip install .[dev_precommit,testing] - ;; - docs) - pip install .[docs] - ;; -esac - -reentry scan diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19d26e9..3c57a08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,101 +1,111 @@ name: Continuous Integration on: [push, pull_request] + jobs: - docs: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.8] - install-type: [docs] - steps: - - name: Checkout code - uses: actions/checkout@v2 - - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: pip-${{ matrix.python-version }}-${{ matrix.install-type }}-${{ hashFiles('**/setup.json') - }} - restore-keys: pip-${{ matrix.python-version }}-${{ matrix.install-type }} - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install the python project - env: - INSTALL_TYPE: ${{ matrix.install-type }} - run: .ci/install_script.sh - - name: Build documentation - env: - READTHEDOCS: 'True' - run: SPHINXOPTS='-nW' make -C docs html - - uses: actions/upload-artifact@v2 - with: - name: doc-build - path: docs/build/html pre-commit: runs-on: ubuntu-latest + strategy: matrix: - python-version: [3.8] - install-type: [dev_precommit] + python-version: [3.11] + steps: - - name: Checkout code - uses: actions/checkout@v2 - - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: pip-${{ matrix.python-version }}-${{ matrix.install-type }}-${{ hashFiles('**/setup.json') - }} - restore-keys: pip-${{ matrix.python-version }}-${{ matrix.install-type }} - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install the python project - env: - INSTALL_TYPE: ${{ matrix.install-type }} - run: .ci/install_script.sh - - name: Run pre-commit - run: pre-commit run --all-files || ( git status --short ; git diff ; exit 1 - ) + - name: Checkout code + uses: actions/checkout@v3 + + - name: Cache Python dependencies + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: pip-pre-commit-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} + restore-keys: pip-pre-commit-${{ matrix.python-version }} + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install the python project + run: pip install -e .[pre-commit] + + - name: Run pre-commit + run: pre-commit run --all-files || ( git status --short; git diff; exit 1 ) + tests: runs-on: ubuntu-latest + strategy: matrix: - python-version: [3.7, 3.8, 3.9] - install-type: [testing] - include: - - python-version: 3.8 - install-type: testing_sdist + python-version: [3.8, 3.9, 3.10, 3.11] + services: postgres: - image: postgres:10 + image: postgres:12 ports: - - 5432:5432 + - 5432:5432 rabbitmq: image: rabbitmq:latest ports: - - 5672:5672 + - 5672:5672 + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Cache Python dependencies + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: pip-tests-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} + restore-keys: pip-tests-${{ matrix.python-version }} + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install the python project + run: pip install -e .[tests] + + - name: Run pytest + run: pytest --cov=aiida_wannier90 --cov-report=xml --cov-config=.coveragerc + working-directory: tests + + - name: Upload coverage data + run: codecov --file tests/coverage.xml + + docs: + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: [3.11] + steps: - - name: Checkout code - uses: actions/checkout@v2 - - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: pip-${{ matrix.python-version }}-${{ matrix.install-type }}-${{ hashFiles('**/setup.json') - }} - restore-keys: pip-${{ matrix.python-version }}-${{ matrix.install-type }} - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install the python project - env: - INSTALL_TYPE: ${{ matrix.install-type }} - run: .ci/install_script.sh - - name: Run pytest - run: pytest --cov=aiida_wannier90 --cov-report=xml --cov-config=.coveragerc - working-directory: tests - - name: Upload coverage data - if: ${{ matrix.install-type == 'testing' }} - run: codecov --file tests/coverage.xml + - name: Checkout code + uses: actions/checkout@v3 + + - name: Cache Python dependencies + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: pip-docs-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} + restore-keys: pip-docs-${{ matrix.python-version }} + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install the python project + run: pip intall -e .[docs] + + - name: Build documentation + env: + READTHEDOCS: "True" + run: SPHINXOPTS='-nW' make -C docs html + + - uses: actions/upload-artifact@v3 + with: + name: doc-build + path: docs/build/html diff --git a/.github/workflows_source/ci.yml b/.github/workflows_source/ci.yml deleted file mode 100644 index afd8199..0000000 --- a/.github/workflows_source/ci.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: Continuous Integration - -on: [push, pull_request] - -_anchors: - checkout: &CHECKOUT - name: Checkout code - uses: actions/checkout@v2 - - pip-cache: &PIP_CACHE - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: pip-${{ matrix.python-version }}-${{ matrix.install-type }}-${{ hashFiles('**/setup.json') }} - restore-keys: pip-${{ matrix.python-version }}-${{ matrix.install-type }} - - python-setup: &PYTHON_SETUP - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - install-project: &INSTALL_PROJECT - name: Install the python project - env: - INSTALL_TYPE: ${{ matrix.install-type }} - run: .ci/install_script.sh - -jobs: - docs: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.8] - install-type: [docs] - steps: - - *CHECKOUT - - *PIP_CACHE - - *PYTHON_SETUP - - *INSTALL_PROJECT - - name: Build documentation - env: - READTHEDOCS: "True" - run: SPHINXOPTS='-nW' make -C docs html - - uses: actions/upload-artifact@v2 - with: - name: doc-build - path: docs/build/html - pre-commit: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.8] - install-type: [dev_precommit] - steps: - - *CHECKOUT - - *PIP_CACHE - - *PYTHON_SETUP - - *INSTALL_PROJECT - - name: Run pre-commit - run: pre-commit run --all-files || ( git status --short ; git diff ; exit 1 ) - tests: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.7, 3.8, 3.9] - install-type: [testing] - include: - - python-version: 3.8 - install-type: testing_sdist - services: - postgres: - image: postgres:10 - ports: - - 5432:5432 - rabbitmq: - image: rabbitmq:latest - ports: - - 5672:5672 - steps: - - *CHECKOUT - - *PIP_CACHE - - *PYTHON_SETUP - - *INSTALL_PROJECT - - name: Run pytest - run: pytest --cov=aiida_wannier90 --cov-report=xml --cov-config=.coveragerc - working-directory: tests - - name: Upload coverage data - if: ${{ matrix.install-type == 'testing' }} # Coverage data is present only when installed with -e - run: codecov --file tests/coverage.xml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e28c09e..86dba32 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,13 +25,13 @@ repos: - id: check-toml - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.8.0 hooks: - id: pyupgrade args: ["--py37-plus"] - repo: https://github.com/ikamensh/flynt/ - rev: "0.77" + rev: "0.78" hooks: - id: flynt args: ["--line-length=120", "--fail-on-change"] @@ -43,7 +43,7 @@ repos: additional_dependencies: ["toml"] - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 23.3.0 hooks: - id: black @@ -59,21 +59,8 @@ repos: args: ["--ignore=D104,D202,D203,D213"] - repo: https://github.com/PyCQA/pylint - rev: v2.16.2 + rev: v3.0.0a6 hooks: - id: pylint language: system exclude: *exclude_pyfiles - - - repo: local - hooks: - - id: interpolate-workflows - name: Interpolate Github workflows - entry: python ./utils/interpolate_yaml_anchors.py - language: system - files: | - (?x)^( - .github/(.)*| - utils/interpolate_yaml_anchors.py - )$ - pass_filenames: false diff --git a/.readthedocs.yml b/.readthedocs.yml index 7bdf7ac..70b2c84 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -14,7 +14,7 @@ formats: [] # Optionally set the version of Python and requirements required to build your docs python: - version: 3.7 + version: 3.11 install: - method: pip path: . diff --git a/CHANGELOG.md b/CHANGELOG.md index 31d6819..1af963c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v2.1.0 + +## New features + +- Support AiiDA v2.0 [[#117]](https://github.com/aiidateam/aiida-wannier90/issues/117) + # v2.0.1 ## Fixes and general improvements @@ -33,9 +39,9 @@ - General update of the documentation to include all new changes [[#91]](https://github.com/aiidateam/aiida-wannier90/pull/91) [[#52]](https://github.com/aiidateam/aiida-wannier90/pull/52) -- Use aiida calcjob directive in documentation [[#86]](https://github.com/aiidateam/aiida-wannier90/pull/86) +- Use aiida calcjob directive in documentation [[#86]](https://github.com/aiidateam/aiida-wannier90/pull/86) - Example of GaAs wannierization (both as a single submission, and via a workchain using Quantum ESPRESSO) [[#77]](https://github.com/aiidateam/aiida-wannier90/pull/77) [[#84]](https://github.com/aiidateam/aiida-wannier90/pull/84) - + # v1.0.0 -First working version of the plugin \ No newline at end of file +First working version of the plugin diff --git a/pyproject.toml b/pyproject.toml index 2a00b63..54fb0c4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,7 @@ classifiers = [ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Natural Language :: English", "Topic :: Scientific/Engineering :: Physics", "Intended Audience :: Science/Research" diff --git a/utils/interpolate_yaml_anchors.py b/utils/interpolate_yaml_anchors.py deleted file mode 100755 index 9d37ddf..0000000 --- a/utils/interpolate_yaml_anchors.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python - -# Copyright © 2020 Elijah Shaw-Rutschman - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the “Software”), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -# noqa -""" -Interpolates aliases in YAML. -""" - -import pathlib - -from ruamel import yaml - - -class InterpolatingDumper(yaml.RoundTripDumper): - def ignore_aliases(self, data): - # Always interpolate aliases - return True - - -def interpolate_aliases(in_stream, out_stream): - data = yaml.load(in_stream, Loader=yaml.RoundTripLoader) - if "_anchors" in data: - # Remove top-level _anchors section - del data["_anchors"] - out_stream.write(yaml.dump(data, Dumper=InterpolatingDumper)) - - -if __name__ == "__main__": - ROOT_DIR = pathlib.Path(__file__).absolute().parent.parent - GITHUB_DIR = ROOT_DIR / ".github" - - TEMPLATE_DIR = GITHUB_DIR / "workflows_source" - assert TEMPLATE_DIR.exists() - - WORKFLOW_DIR = GITHUB_DIR / "workflows" - assert WORKFLOW_DIR.exists() - - for in_file in TEMPLATE_DIR.iterdir(): - out_file = WORKFLOW_DIR / in_file.name - with open(in_file) as in_f, open(out_file, "w") as out_f: - interpolate_aliases(in_f, out_f)