From 4e06a0d8da2808dcbe4695d54da17ea7349e3373 Mon Sep 17 00:00:00 2001 From: pciturri Date: Wed, 2 Oct 2024 12:59:05 +0200 Subject: [PATCH] ci: set up automatic versioning. --- .github/workflows/publish-pypi.yml | 10 +++++----- .gitignore | 2 +- pyproject.toml | 8 ++++++-- requirements_dev.txt | 1 + setup.cfg | 3 ++- setup.py | 6 +++++- 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index f8f540a..493854f 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -23,16 +23,16 @@ jobs: create-args: >- python=3.10 - - name: Install py-build + - name: Install py-build and setuptools-scm run: | - python3 -m pip install --upgrade build + micromamba run -n floatcsep python3 -m pip install --upgrade build setuptools-scm - name: Build run: | - python3 -m build --sdist --wheel --outdir dist/ + micromamba run -n your_env_name python3 -m build --sdist --wheel --outdir dist/ - name: Publish Package - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@v1.9.0 with: user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.gitignore b/.gitignore index fd66bd7..78c2091 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ .idea/ __pycache__ - +version diff --git a/pyproject.toml b/pyproject.toml index 1972590..7077838 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=52.0", "wheel"] +requires = ["setuptools>=52.0", "wheel", "setuptools-scm"] build-backend = "setuptools.build_meta" [tool.pytest.ini_options] @@ -16,4 +16,8 @@ target-version = ["py39", "py310", "py311"] [tool.flake8] ignore = ["E203", "W503", "F401"] -max-line-length = 96 \ No newline at end of file +max-line-length = 96 + +[tool.setuptools_scm] +version_scheme = "post-release" +local_scheme = "no-local-version" \ No newline at end of file diff --git a/requirements_dev.txt b/requirements_dev.txt index d056c16..68a65c6 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -21,6 +21,7 @@ pyyaml requests scipy seaborn +setuptools-scm shapely sphinx sphinx-autoapi diff --git a/setup.cfg b/setup.cfg index 32e31d1..7285b3a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,7 +6,7 @@ long_description_content_type = text/markdown author = Pablo Iturrieta author_email = pciturri@gfz-potsdam.de license = BSD 3-Clause License -version = 0.1.4 +version = attr: setuptools_scm.get_version platforms = unix, linux, osx, win32 classifiers = Programming Language :: Python :: 3 @@ -69,6 +69,7 @@ dev = requests scipy seaborn + setuptools-scm shapely sphinx sphinx-autoapi diff --git a/setup.py b/setup.py index 7f1a176..d747ba3 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,8 @@ from setuptools import setup if __name__ == "__main__": - setup() + setup( + name="floatcsep", + use_scm_version=True, + setup_requires=["setuptools-scm"], + )