From cf873391a5c1afffc026a20d8c038dae87c8e8a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicholas=20Kr=C3=A4mer?= Date: Mon, 7 Feb 2022 12:21:34 +0100 Subject: [PATCH 1/4] automated versioning --- .gitignore | 2 ++ pyproject.toml | 12 ++++++++++++ src/probfindiff/__init__.py | 2 ++ 3 files changed, 16 insertions(+) diff --git a/.gitignore b/.gitignore index 715b946..295fee5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ + +src/probfindiff/_version.py .idea # Byte-compiled / optimized / DLL files diff --git a/pyproject.toml b/pyproject.toml index b9be18b..4e2a0e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,10 +2,22 @@ requires = [ "setuptools>=42", "wheel", + "setuptools_scm[toml]", ] build-backend = "setuptools.build_meta" +[tool.setuptools_scm] +local_scheme = "no-local-version" +write_to = "src/probfindiff/_version.py" +write_to_template = """ +# pylint: skip-file +# coding: utf-8 +# file generated by setuptools_scm +# don't change, don't track in version control +version = \"{version}\" +""" + # Configuration of the black code style checker # For more information about Black's usage of this file, see # https://github.com/psf/black#pyprojecttoml diff --git a/src/probfindiff/__init__.py b/src/probfindiff/__init__.py index 91ec64a..253f926 100644 --- a/src/probfindiff/__init__.py +++ b/src/probfindiff/__init__.py @@ -1,5 +1,6 @@ """Probabilistic numerical finite difference methods.""" + from ._toplevel_api import ( FiniteDifferenceScheme, backward, @@ -9,6 +10,7 @@ forward, from_grid, ) +from ._version import version as __version__ __all__ = [ "differentiate", From edca10e2424cbfb4af8f415f021e4316a163f15b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicholas=20Kr=C3=A4mer?= Date: Mon, 7 Feb 2022 12:43:39 +0100 Subject: [PATCH 2/4] pypi workflow --- .github/workflows/pypi-publish.yaml | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/pypi-publish.yaml diff --git a/.github/workflows/pypi-publish.yaml b/.github/workflows/pypi-publish.yaml new file mode 100644 index 0000000..27df8f2 --- /dev/null +++ b/.github/workflows/pypi-publish.yaml @@ -0,0 +1,37 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# +# Source: +# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries + +name: Upload Python Package + +on: + release: + types: [published] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - 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 + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PyPi_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PyPi_PASSWORD }} + run: | + python -m build + twine upload dist/*py3-none-any.whl From 891fc68be2ce6711263b7dafe8f0492ccc495196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicholas=20Kr=C3=A4mer?= Date: Mon, 7 Feb 2022 12:45:13 +0100 Subject: [PATCH 3/4] install twine --- .github/workflows/pypi-publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi-publish.yaml b/.github/workflows/pypi-publish.yaml index 27df8f2..cc7e99c 100644 --- a/.github/workflows/pypi-publish.yaml +++ b/.github/workflows/pypi-publish.yaml @@ -27,7 +27,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install build + pip install --upgrade build twine - name: Build and publish env: TWINE_USERNAME: ${{ secrets.PyPi_USERNAME }} From 8129abac491fc0054d81563a8f67e297129fa81b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicholas=20Kr=C3=A4mer?= Date: Mon, 7 Feb 2022 12:45:54 +0100 Subject: [PATCH 4/4] workflow --- .github/workflows/pypi-publish.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi-publish.yaml b/.github/workflows/pypi-publish.yaml index cc7e99c..1930edf 100644 --- a/.github/workflows/pypi-publish.yaml +++ b/.github/workflows/pypi-publish.yaml @@ -30,8 +30,8 @@ jobs: pip install --upgrade build twine - name: Build and publish env: - TWINE_USERNAME: ${{ secrets.PyPi_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PyPi_PASSWORD }} + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | python -m build twine upload dist/*py3-none-any.whl