From 68039f6f34e57b34b3b0e17e515550c13b118cde Mon Sep 17 00:00:00 2001 From: Lukas Koch Date: Sat, 17 Oct 2020 19:20:28 +0100 Subject: [PATCH] Switch to automatic versioning. (#26) * Switch to automated versioning. * Install new build dependencies. * Fixes #25 --- .github/workflows/pythonpublish.yml | 4 ++-- .gitignore | 1 + histoprint/__init__.py | 1 + pyproject.toml | 11 +++++++++++ setup.py | 3 ++- 5 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 pyproject.toml diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index c869a92..74047fd 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -18,10 +18,10 @@ jobs: uses: actions/setup-python@v1 with: python-version: '3.x' - - name: Install dependencies + - name: Install build dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine + pip install setuptools setuptools_scm toml wheel twine - name: Build and publish env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} diff --git a/.gitignore b/.gitignore index b6e4761..4974277 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,4 @@ dmypy.json # Pyre type checker .pyre/ +histoprint/version.py diff --git a/histoprint/__init__.py b/histoprint/__init__.py index 7f5f8d3..2857650 100644 --- a/histoprint/__init__.py +++ b/histoprint/__init__.py @@ -1,3 +1,4 @@ """histoprint - Pretty-print histograms to the terminal""" +from .version import version as __version__ from histoprint.formatter import * diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..6bb701e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,11 @@ +[build-system] +requires = [ + "setuptools>=42", + "setuptools_scm[toml]>=3.4", + "wheel" +] + +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +write_to = "histoprint/version.py" diff --git a/setup.py b/setup.py index 6ec73d5..a0f6d83 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,6 @@ from setuptools import setup +import setuptools_scm # noqa: F401 +import toml # noqa: F401 # make open consistent between py2 and py3 as we need encoding param from io import open @@ -20,7 +22,6 @@ setup( name="histoprint", - version="1.5.1", description=description, long_description=long_description, url="https://github.com/scikit-hep/histoprint",