From 26d465685709decd5bd22923eb9c6a0cc2361494 Mon Sep 17 00:00:00 2001 From: Marvin Friede <51965259+marvinfriede@users.noreply.github.com> Date: Fri, 26 Apr 2024 07:23:54 +0200 Subject: [PATCH] Adapt GA workflows (#56) --- .github/workflows/macos.yaml | 95 +++++++++++++++++++ .../workflows/{python.yaml => ubuntu.yaml} | 20 +--- .github/workflows/windows.yaml | 91 ++++++++++++++++++ README.rst | 90 ++++++++++++------ docs/conf.py | 3 +- docs/installation.rst | 19 +++- 6 files changed, 271 insertions(+), 47 deletions(-) create mode 100644 .github/workflows/macos.yaml rename .github/workflows/{python.yaml => ubuntu.yaml} (81%) create mode 100644 .github/workflows/windows.yaml diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml new file mode 100644 index 0000000..e55819e --- /dev/null +++ b/.github/workflows/macos.yaml @@ -0,0 +1,95 @@ +# This file is part of tad-dftd3. +# SPDX-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: Tests (macOS) + +on: + push: + branches: + - main + - master + paths-ignore: + - "doc*/**" + - "./*.ya?ml" + - "**/*.md" + - "**/*.rst" + + pull_request: + paths-ignore: + - "doc*/**" + - "./*.ya?ml" + - "**/*.md" + - "**/*.rst" + + workflow_dispatch: + +jobs: + main: + strategy: + fail-fast: false + matrix: + os: [macos-12, macos-13, macos-14] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + # only test oldest and newest version of torch + torch-version: ["1.11.0", "2.2.2"] + exclude: + # PyTorch now fully supports Python=<3.11 + # see: https://github.com/pytorch/pytorch/issues/86566 + # + # PyTorch does not support Python 3.12 (all platforms) + # see: https://github.com/pytorch/pytorch/issues/110436 + - python-version: "3.12" + # PyTorch<1.13.0 does only support Python=<3.10 + # On macOS and Windows, 1.13.x is also not supported for Python>=3.10 + - python-version: "3.11" + torch-version: "1.11.0" + - python-version: "3.11" + torch-version: "1.12.1" + - python-version: "3.11" + torch-version: "1.13.1" + # Python 3.8/3.9 is not on macos-latest (macos-14-arm64) + # https://github.com/actions/setup-python/issues/696 + - os: macos-14 + python-version: "3.8" + - os: macos-14 + python-version: "3.9" + + runs-on: ${{ matrix.os }} + + defaults: + run: + shell: bash {0} + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install tox + + - name: Determine TOXENV + run: echo "TOXENV=py$(echo ${{ matrix.python-version }} | tr -d '.')-torch$(echo ${{ matrix.torch-version }} | tr -d '.')" >> $GITHUB_ENV + + - name: Print TOXENV + run: echo "TOXENV is set to '${{ env.TOXENV }}'." + + - name: Unittests with tox + run: tox -e ${{ env.TOXENV }} diff --git a/.github/workflows/python.yaml b/.github/workflows/ubuntu.yaml similarity index 81% rename from .github/workflows/python.yaml rename to .github/workflows/ubuntu.yaml index e86fb3c..47b48c3 100644 --- a/.github/workflows/python.yaml +++ b/.github/workflows/ubuntu.yaml @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -name: Tests +name: Tests (Ubuntu) on: push: @@ -39,7 +39,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest] python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] torch-version: ["1.11.0", "1.12.1", "1.13.1", "2.0.1", "2.1.2", "2.2.2"] exclude: @@ -48,24 +48,12 @@ jobs: # # PyTorch does not support Python 3.12 (all platforms) # see: https://github.com/pytorch/pytorch/issues/110436 - - os: ubuntu-latest - python-version: "3.12" - - os: macos-latest - python-version: "3.12" - - os: windows-latest - python-version: "3.12" + - python-version: "3.12" # PyTorch<1.13.0 does only support Python=<3.10 - python-version: "3.11" torch-version: "1.11.0" - python-version: "3.11" torch-version: "1.12.1" - # On macOS and Windows, 1.13.x is also not supported for Python>=3.10 - - os: macos-latest - python-version: "3.11" - torch-version: "1.13.1" - - os: windows-latest - python-version: "3.11" - torch-version: "1.13.1" runs-on: ${{ matrix.os }} @@ -78,7 +66,7 @@ jobs: uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml new file mode 100644 index 0000000..883afae --- /dev/null +++ b/.github/workflows/windows.yaml @@ -0,0 +1,91 @@ +# This file is part of tad-dftd3. +# SPDX-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: Tests (Windows) + +on: + push: + branches: + - main + - master + paths-ignore: + - "doc*/**" + - "./*.ya?ml" + - "**/*.md" + - "**/*.rst" + + pull_request: + paths-ignore: + - "doc*/**" + - "./*.ya?ml" + - "**/*.md" + - "**/*.rst" + + workflow_dispatch: + +jobs: + main: + strategy: + fail-fast: false + matrix: + os: [windows-latest] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + # only test oldest and newest version of torch + torch-version: ["1.11.0", "2.2.2"] + exclude: + # PyTorch now fully supports Python=<3.11 + # see: https://github.com/pytorch/pytorch/issues/86566 + # + # PyTorch does not support Python 3.12 (all platforms) + # see: https://github.com/pytorch/pytorch/issues/110436 + - os: windows-latest + python-version: "3.12" + # PyTorch<1.13.0 does only support Python=<3.10 + - python-version: "3.11" + torch-version: "1.11.0" + - python-version: "3.11" + torch-version: "1.12.1" + # On macOS and Windows, 1.13.x is also not supported for Python>=3.10 + - os: windows-latest + python-version: "3.11" + torch-version: "1.13.1" + + runs-on: ${{ matrix.os }} + + defaults: + run: + shell: bash {0} + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install tox + + - name: Determine TOXENV + run: echo "TOXENV=py$(echo ${{ matrix.python-version }} | tr -d '.')-torch$(echo ${{ matrix.torch-version }} | tr -d '.')" >> $GITHUB_ENV + + - name: Print TOXENV + run: echo "TOXENV is set to '${{ env.TOXENV }}'." + + - name: Unittests with tox + run: tox -e ${{ env.TOXENV }} diff --git a/README.rst b/README.rst index b307890..6320920 100644 --- a/README.rst +++ b/README.rst @@ -1,34 +1,14 @@ Torch autodiff for DFT-D3 ========================= -.. image:: https://img.shields.io/github/v/release/dftd3/tad-dftd3 - :target: https://github.com/dftd3/tad-dftd3/releases/latest - :alt: Release - -.. image:: https://img.shields.io/pypi/v/tad-dftd3 - :target: https://pypi.org/project/tad-dftd3/ - :alt: PyPI - -.. image:: https://img.shields.io/github/license/dftd3/tad-dftd3 - :target: LICENSE - :alt: Apache-2.0 - -.. image:: https://github.com/dftd3/tad-dftd3/actions/workflows/python.yaml/badge.svg - :target: https://github.com/dftd3/tad-dftd3/actions/workflows/python.yaml - :alt: CI - -.. image:: https://readthedocs.org/projects/tad-dftd3/badge/?version=latest - :target: https://tad-dftd3.readthedocs.io - :alt: Documentation Status - -.. image:: https://codecov.io/gh/dftd3/tad-dftd3/branch/main/graph/badge.svg?token=D3rMNnl26t - :target: https://codecov.io/gh/dftd3/tad-dftd3 - :alt: Coverage - -.. image:: https://results.pre-commit.ci/badge/github/dftd3/tad-dftd3/main.svg - :target: https://results.pre-commit.ci/latest/github/dftd3/tad-dftd3/main - :alt: pre-commit.ci status - +|release| +|license| +|testubuntu| +|testmacos| +|testwindows| +|docs| +|coverage| +|precommit| Implementation of the DFT-D3 dispersion model in PyTorch. This module allows to process a single structure or a batch of structures for the calculation of atom-resolved dispersion energies. @@ -56,12 +36,25 @@ Installation pip ~~~ +|pypi| + The project can easily be installed with ``pip``. .. code:: pip install tad-dftd3 +conda +~~~~~ + +|conda| + +*tad-dftd3* is also available from ``conda``. + +.. code:: + + conda install tad-dftd3 + From source ~~~~~~~~~~~ @@ -292,3 +285,44 @@ Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions. + + +.. |release| image:: https://img.shields.io/github/v/release/dftd3/tad-dftd3 + :target: https://github.com/dftd3/tad-dftd3/releases/latest + :alt: Release + +.. |pypi| image:: https://img.shields.io/pypi/v/tad-dftd3 + :target: https://pypi.org/project/tad-dftd3/ + :alt: PyPI + +.. |conda| image:: https://img.shields.io/conda/vn/conda-forge/tad-dftd3.svg + :target: https://anaconda.org/conda-forge/tad-dftd3 + :alt: Conda Version + +.. |license| image:: https://img.shields.io/github/license/dftd3/tad-dftd3 + :target: LICENSE + :alt: Apache-2.0 + +.. |testubuntu| image:: https://github.com/dftd3/tad-dftd3/actions/workflows/ubuntu.yaml/badge.svg + :target: https://github.com/dftd3/tad-dftd3/actions/workflows/ubuntu.yaml + :alt: Tests Ubuntu + +.. |testmacos| image:: https://github.com/dftd3/tad-dftd3/actions/workflows/macos.yaml/badge.svg + :target: https://github.com/dftd3/tad-dftd3/actions/workflows/macos.yaml + :alt: Tests macOS + +.. |testwindows| image:: https://github.com/dftd3/tad-dftd3/actions/workflows/windows.yaml/badge.svg + :target: https://github.com/dftd3/tad-dftd3/actions/workflows/windows.yaml + :alt: Tests Windows + +.. |docs| image:: https://readthedocs.org/projects/tad-dftd3/badge/?version=latest + :target: https://tad-dftd3.readthedocs.io + :alt: Documentation Status + +.. |coverage| image:: https://codecov.io/gh/dftd3/tad-dftd3/branch/main/graph/badge.svg?token=D3rMNnl26t + :target: https://codecov.io/gh/dftd3/tad-dftd3 + :alt: Coverage + +.. |precommit| image:: https://results.pre-commit.ci/badge/github/dftd3/tad-dftd3/main.svg + :target: https://results.pre-commit.ci/latest/github/dftd3/tad-dftd3/main + :alt: pre-commit.ci status diff --git a/docs/conf.py b/docs/conf.py index ab68d07..351f3f2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -29,12 +29,11 @@ extensions = [ "sphinx_design", "sphinx_copybutton", - "sphinx_design", "sphinx.ext.autosummary", "sphinx.ext.autodoc", "sphinx.ext.intersphinx", - "sphinx.ext.viewcode", "sphinx.ext.napoleon", + "sphinx.ext.viewcode", ] html_theme = "sphinx_book_theme" diff --git a/docs/installation.rst b/docs/installation.rst index 470d031..adc48c4 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -4,12 +4,29 @@ Installation pip ~~~ -The project can easily be installed with ``pip``. +.. image:: https://img.shields.io/pypi/v/tad-dftd3 + :target: https://pypi.org/project/tad-dftd3/ + :alt: PyPI + +*tad-dftd3* can easily be installed with ``pip``. .. code:: pip install tad-dftd3 +conda +~~~~~ + +.. image:: https://img.shields.io/conda/vn/conda-forge/tad-dftd3.svg + :target: https://anaconda.org/conda-forge/tad-dftd3 + :alt: Conda Version + +*tad-dftd3* is also available from ``conda``. + +.. code:: + + conda install tad-dftd3 + From source ~~~~~~~~~~~