From 006b1351f2710bfc3d46746a5c5252e84838418e Mon Sep 17 00:00:00 2001 From: AA Turner <9087854+AA-Turner@users.noreply.github.com> Date: Wed, 22 Sep 2021 23:54:07 +0100 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=94=A5=20Remove=20hard-coded=20versio?= =?UTF-8?q?n=20from=20setup.cfg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.cfg | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index a5fdcc09..16769a1c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,8 +1,9 @@ # setuptools metadata [metadata] name = compass-interface-core -version = 0.20.0 -# version = attr: src.VERSION +# this is only needed for pyroma linting and is generated by `ci/pyroma-version-fixer.py` +# the actual package version is set by setuptools-scm +version = file: ci/version.txt description = The unofficial API to the TSA Compass membership database long_description = file: README.md long_description_content_type = text/markdown From f4a9d27453de8ba1def2e97fae90c5040b74b088 Mon Sep 17 00:00:00 2001 From: AA Turner <9087854+AA-Turner@users.noreply.github.com> Date: Thu, 23 Sep 2021 00:34:57 +0100 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=94=A7=20Use=20setuptools-scm=20for?= =?UTF-8?q?=20versioning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 05f56cec..901cc085 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,15 @@ # Build system requirements. [build-system] -requires = ["setuptools>=41.0", "wheel"] #"setuptools-scm", +requires = ["setuptools>=45.0", "wheel", "setuptools-scm>=6.2"] build-backend = "setuptools.build_meta" +[tool.setuptools_scm] +write_to = "compass/core/__version__.py" +write_to_template = """\ +__version__ = "{version}" +__version_info__ = {version_tuple} +""" + # Black configuration [tool.black] line-length = 132 # 120*1.1 From 5eea09ab3fec0c39386056122b4b574cef31fa35 Mon Sep 17 00:00:00 2001 From: AA Turner <9087854+AA-Turner@users.noreply.github.com> Date: Fri, 24 Sep 2021 01:02:11 +0100 Subject: [PATCH 3/5] =?UTF-8?q?=E2=9C=A8=20Add=20`ci.=5F=5Fversion=5F=5F`?= =?UTF-8?q?=20and=20`ci.=5F=5Fversion=5Finfo=5F=5F`=20metadata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compass/core/__init__.py | 5 +++++ compass/core/__version__.py | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 compass/core/__version__.py diff --git a/compass/core/__init__.py b/compass/core/__init__.py index 0c93e85a..413a2395 100644 --- a/compass/core/__init__.py +++ b/compass/core/__init__.py @@ -5,6 +5,8 @@ from __future__ import annotations from compass.core import logger +from compass.core.__version__ import __version__ +from compass.core.__version__ import __version_info__ from compass.core.errors import CompassAuthenticationError from compass.core.errors import CompassError from compass.core.errors import CompassNetworkError @@ -63,6 +65,9 @@ def login(username: str, password: str, /, *, role: str | None = None, location: __all__ = ( + # public metadata + "__version__", + "__version_info__", # public sub-modules "logger", # public classes diff --git a/compass/core/__version__.py b/compass/core/__version__.py new file mode 100644 index 00000000..35c56f1f --- /dev/null +++ b/compass/core/__version__.py @@ -0,0 +1,2 @@ +__version__ = "0.20.0" +__version_info__ = (0, 20, 0) From 9e8d6ca43a95dd24a34c1f2b20ba4aeade84955a Mon Sep 17 00:00:00 2001 From: AA Turner <9087854+AA-Turner@users.noreply.github.com> Date: Fri, 24 Sep 2021 01:48:50 +0100 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=94=A7=20Use=20pip=20for=20pyroma?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- environment.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 69f93143..50e8f992 100644 --- a/environment.yml +++ b/environment.yml @@ -35,7 +35,7 @@ dependencies: - pep8-naming - pydocstyle - bandit - - pyroma +# - pyroma (outdated on CF as at 2021-09-24) - mypy - lxml-stubs @@ -45,3 +45,6 @@ dependencies: - pip: # Type validation - phonenumberslite + + # Linting + - pyroma From 205a81214990ec48e0cf6571dccd0deee6414796 Mon Sep 17 00:00:00 2001 From: AA Turner <9087854+AA-Turner@users.noreply.github.com> Date: Fri, 24 Sep 2021 18:33:30 +0100 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=8E=A8=20Fix=20version=20for=20pyroma?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/linting.yml | 2 +- ci/pyroma-version-fixer.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 ci/pyroma-version-fixer.py diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 9e54aa39..6b77c6ae 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -30,7 +30,7 @@ jobs: deps: "bandit" # packaging (CheeseShop) compliance - tool: "pyroma" - command: "pyroma ." + command: "python ci/pyroma-version-fixer.py && pyroma ." deps: "pyroma" # type checking - tool: "mypy" diff --git a/ci/pyroma-version-fixer.py b/ci/pyroma-version-fixer.py new file mode 100644 index 00000000..96ff198c --- /dev/null +++ b/ci/pyroma-version-fixer.py @@ -0,0 +1,11 @@ +from pathlib import Path + +Path(__file__, "..", "version.txt").resolve().write_text( + # read version file + Path(__file__, "..", "..", "compass", "core", "__version__.py").resolve().read_text(encoding="utf-8") + # get first line + .split("\n")[0] + # remove lead and tail + .removeprefix('__version__ = "').removesuffix('"'), + encoding="utf-8", +)