From c48e3897d3ca801745b08526c5b5c610b3f91650 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Fri, 6 Oct 2023 20:35:59 +0100 Subject: [PATCH] Update repo from copier template and tweak README --- .copier-answers.yml | 3 +- .github/workflows/release.yml | 89 +++++++++++++++++++++++++++++++++++ .github/workflows/testing.yml | 42 ++++++++--------- .pre-commit-config.yaml | 3 +- CONTRIBUTING.md | 5 +- INSTALL.md | 20 ++++++++ README.md | 38 ++++----------- pyproject.toml | 7 ++- 8 files changed, 150 insertions(+), 57 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 INSTALL.md diff --git a/.copier-answers.yml b/.copier-answers.yml index 8dbe8bd..156eb3e 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -_commit: 7a70b18 +_commit: d0e6447 _src_path: git@github.com:Matgenix/Matgenix-copier-template author_email: david.waroquiers@matgenix.com author_fullname: David Waroquiers @@ -15,3 +15,4 @@ repository_namespace: matgenix repository_provider: https://github.com short_description: QToolKit is a python wrapper interfacing with job queues (e.g. PBS, SLURM, ...). + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1e56097 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,89 @@ +name: Publish and Deploy + +on: + release: + types: + - published + +env: + PUBLISH_UPDATE_BRANCH: main + GIT_USER_NAME: Matgenix + GIT_USER_EMAIL: "dev@matgenix.com" + +jobs: + + publish: + name: Publish package + runs-on: ubuntu-latest + if: github.repository == 'matgenix/qtoolkit' && startsWith(github.ref, 'refs/tags/v') + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Python dependencies + run: | + python -m pip install -U pip + pip install -U setuptools wheel + pip install -e .[all] + + - name: Update changelog + uses: CharMixer/auto-changelog-action@v1 + with: + token: ${{ secrets.RELEASE_PAT_BOT }} + release_branch: ${{ env.PUBLISH_UPDATE_BRANCH }} + exclude_labels: "duplicate,question,invalid,wontfix,dependency_updates,skip_changelog" + + - name: Update '${{ env.PUBLISH_UPDATE_BRANCH }}' + uses: CasperWA/push-protected@v2 + with: + token: ${{ secrets.RELEASE_PAT_BOT }} + branch: ${{ env.PUBLISH_UPDATE_BRANCH }} + unprotect_reviews: true + sleep: 15 + force: true + tags: true + + - name: Get tagged versions + run: echo "PREVIOUS_VERSION=$(git tag -l --sort -version:refname | sed -n 2p)" >> $GITHUB_ENV + + - name: Create release-specific changelog + uses: CharMixer/auto-changelog-action@v1 + with: + token: ${{ secrets.RELEASE_PAT_BOT }} + release_branch: ${{ env.PUBLISH_UPDATE_BRANCH }} + since_tag: "${{ env.PREVIOUS_VERSION }}" + output: "release_changelog.md" + exclude_labels: "duplicate,question,invalid,wontfix,dependency_updates,skip_changelog" + + - name: Append changelog to release body + run: | + gh api /repos/${{ github.repository }}/releases/${{ github.event.release.id }} --jq '.body' > release_body.md + cat release_changelog.md >> release_body.md + gh api /repos/${{ github.repository }}/releases/${{ github.event.release.id }} -X PATCH -F body='@release_body.md' + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_PAT_BOT }} + + - name: Build source distribution + run: python -m build + + - name: Publish package to Test PyPI first + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_PASSWORD }} + repository-url: https://test.pypi.org/legacy/ + + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_PASSWORD }} diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index d35a5a5..4523ad9 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: '3.10' cache: pip cache-dependency-path: pyproject.toml @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v3 @@ -49,22 +49,22 @@ jobs: - name: Test run: pytest --cov=qtoolkit --cov-report=xml -# docs: -# runs-on: ubuntu-latest -# -# steps: -# - uses: actions/checkout@v3 -# -# - uses: actions/setup-python@v4 -# with: -# python-version: '3.11' -# cache: pip -# cache-dependency-path: pyproject.toml -# -# - name: Install dependencies -# run: | -# python -m pip install --upgrade pip -# pip install .[strict,docs] -# -# - name: Build -# run: jupyter-book build docs --path-output docs_build + docs: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: '3.11' + cache: pip + cache-dependency-path: pyproject.toml + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install .[strict,docs] + + - name: Build + run: jupyter-book build docs --path-output docs_build diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 91c5c57..41dca2c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,6 +9,7 @@ repos: - id: fix-encoding-pragma args: [--remove] - id: end-of-file-fixer + exclude: .copier-answers.yml - id: trailing-whitespace - repo: https://github.com/myint/autoflake rev: v2.0.0 @@ -67,4 +68,4 @@ repos: rev: v3.3.1 hooks: - id: pyupgrade - args: [--py38-plus] + args: [--py39-plus] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 544eb78..592e896 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,5 @@ # Contributing to QToolKit -Full name is Queue Tool Kit - We love your input! We want to make contributing to as easy and transparent as possible, whether it's: @@ -64,6 +62,9 @@ We have a few tips for writing good PRs that are accepted into the main repo: to python](https://docs.python-guide.org/writing/tests) for some good resources on writing good tests. - Understand your contributions will fall under the same license as this repo. +- This project uses `pre-commit` for uniform linting across many developers. You can install + it through the extra dev dependencies with `pip install -e .[dev]` and then run `pre-commit install` + to activate it for you local repository. When you submit your PR, our CI service will automatically run your tests. We welcome good discussion on the best ways to write your code, and the comments diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000..2b48ecd --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,20 @@ +# Installation + +Clone this repository and then install with `pip` in the virtual environment of your choice. + +``` +git clone git@https://github.com:matgenix/qtoolkit +cd qtoolkit +pip install . +``` + +## Development installation + +You can use + +``` +pip install -e .[dev,tests] +``` + +to perform an editable installation with additional development and test dependencies. +You can then activate `pre-commit` in your local repository with `pre-commit install`. diff --git a/README.md b/README.md index c53fbc8..f98191f 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,20 @@ # QToolKit -[![tests](https://img.shields.io/github/actions/workflow/status/matgenix/qtoolkit/testing.yml?branch=main&label=tests)](https://github.com/matgenix/qtoolkit/actions?query=workflow%3Atesting) +[![tests](https://img.shields.io/github/actions/workflow/status/matgenix/qtoolkit/testing.yml?branch=main&label=tests)](https://github.com/matgenix/qtoolkit/actions/workflows/testing.yml) [![code coverage](https://img.shields.io/codecov/c/gh/matgenix/qtoolkit)](https://codecov.io/gh/matgenix/qtoolkit) [![pypi version](https://img.shields.io/pypi/v/qtoolkit?color=blue)](https://pypi.org/project/qtoolkit) ![supported python versions](https://img.shields.io/pypi/pyversions/qtoolkit) -** [Full Documentation][docs] ** +**[Full Documentation][docs]** -QToolKit is a python software for ... Features of QToolKit include - -- Feature A -- Feature B -- ... - -## Quick start - -How to get started. - -## Installation - -How to install. - -## User guide - -How to use the software. +> **Warning**: +> :construction: This repository is still under construction. :construction: ## Need help? Ask questions about QToolKit on the [QToolKit support forum][help-forum]. If you've found an issue with QToolKit, please submit a bug report on [GitHub Issues][issues]. -## Reference - -Full reference - ## What’s new? Track changes to qtoolkit through the [changelog][changelog]. @@ -60,11 +41,12 @@ QToolKit is developed and maintained by Matgenix SRL. A full list of all contributors can be found [here][contributors]. -[help-forum]: https://github.com/materialsproject/atomate2/issues -[issues]: https://github.com/materialsproject/atomate2/issues -[installation]: https://matgenix.github.io/qtoolkit/user/install.html +[help-forum]: https://https://github.com/matgenix/qtoolkit/issues +[issues]: https://https://github.com/matgenix/qtoolkit/issues +[installation]: https://https://github.com/matgenix/qtoolkit/blob/main/INSTALL.md [contributing]: https://github.com/matgenix/qtoolkit/blob/main/CONTRIBUTING.md [codeofconduct]: https://github.com/matgenix/qtoolkit/blob/main/CODE_OF_CONDUCT.md -[contributors]: https://matgenix.github.io/qtoolkit/about/contributors.html -[license]: https://raw.githubusercontent.com/matgenix//main/LICENSE +[changelog]: https://https://github.com/matgenix/qtoolkit/blob/main/CHANGELOG.md +[contributors]: https://matgenix.github.io/qtoolkit/graphs/contributors +[license]: https://raw.githubusercontent.com/matgenix/qtoolkit/main/LICENSE [docs]: https://matgenix.github.io/qtoolkit/ diff --git a/pyproject.toml b/pyproject.toml index 92453e6..817bded 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,6 @@ authors = [{ name = "David Waroquiers", email = "david.waroquiers@matgenix.com" dynamic = ["version"] classifiers = [ "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -24,8 +23,8 @@ classifiers = [ "Topic :: Other/Nonlisted Topic", "Topic :: Scientific/Engineering", ] -requires-python = ">=3.8" -dependencies = [] +requires-python = ">=3.9" +dependencies =[] [project.optional-dependencies] dev = [ @@ -73,7 +72,7 @@ max-line-length = 88 max-doc-length = 88 select = "C, E, F, W, B" extend-ignore = "E203, W503, E501, F401, RST21" -min-python-version = "3.8.0" +min-python-version = "3.9.0" docstring-convention = "numpy" rst-roles = "class, func, ref, obj"