Skip to content

Commit 05b8bd2

Browse files
committed
Project metadata: Add versioning based on Git tags, using versioningit
1 parent 643de58 commit 05b8bd2

File tree

10 files changed

+38
-26
lines changed

10 files changed

+38
-26
lines changed

.bumpversion.cfg

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
- name: Setup project
6262
run: |
6363
# Install package in editable mode.
64-
pip install wheel
64+
pip install versioningit wheel
6565
pip install --editable=.[test,develop]
6666
6767
- name: Check code style

CHANGES.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ in progress
77
===========
88

99
- Modernize Docker configuration, now using Debian bullseye and Python 3.11.
10+
- Improve nightly and on-PR Docker builds.
11+
- Add versioning based on Git tags, using ``versioningit``. This will aid in
12+
telling PR- and nightly releases apart from GA releases when running
13+
``mqttwarn --version``.
1014

1115

1216
2022-11-21 0.31.0

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ RUN chown -R mqttwarn:mqttwarn /etc/mqttwarn
1717

1818
# Install mqttwarn
1919
COPY . /src
20-
RUN pip install wheel
20+
RUN pip install versioningit wheel
2121
RUN pip install /src
2222

2323
# Make process run as "mqttwarn" user

Dockerfile.full

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ RUN chown -R mqttwarn:mqttwarn /etc/mqttwarn
2121

2222
# Install mqttwarn
2323
COPY . /src
24-
RUN pip install wheel
24+
RUN pip install versioningit wheel
2525
RUN pip install /src[all]
2626

2727
# Make process run as "mqttwarn" user

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ $(eval venvpath := .venv)
1111
$(eval pip := $(venvpath)/bin/pip)
1212
$(eval python := $(venvpath)/bin/python)
1313
$(eval pytest := $(venvpath)/bin/pytest)
14-
$(eval bumpversion := $(venvpath)/bin/bumpversion)
14+
$(eval minibump := $(venvpath)/bin/minibump)
1515
$(eval twine := $(venvpath)/bin/twine)
1616
$(eval sphinx := $(venvpath)/bin/sphinx-build)
1717
$(eval isort := $(venvpath)/bin/isort)
@@ -21,6 +21,7 @@ $(eval poe := $(venvpath)/bin/poe)
2121
# Setup Python virtualenv
2222
setup-virtualenv:
2323
@test -e $(python) || python3 -m venv $(venvpath)
24+
$(pip) install versioningit
2425

2526

2627
# -------
@@ -71,7 +72,7 @@ docs-html: install-doctools
7172
# Utility targets
7273
# ===============
7374
bumpversion: install-releasetools
74-
@$(bumpversion) $(bump)
75+
@$(minibump) bump --relax $(bump)
7576

7677
push:
7778
git push && git push --tags

mqttwarn/__init__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# -*- coding: utf-8 -*-
2-
# (c) 2014-2018 The mqttwarn developers
3-
4-
__version__ = "0.31.0"
2+
# (c) 2014-2023 The mqttwarn developers
53

64
__author__ = "Jan-Piet Mens <jpmens()gmail.com>, Ben Jones <ben.jones12()gmail.com>"
75
__copyright__ = "Copyright 2014-2022 Jan-Piet Mens"
86
__license__ = "Eclipse Public License - v 2.0 (http://www.eclipse.org/legal/epl-2.0/)"
7+
8+
try:
9+
from importlib.metadata import version
10+
except ImportError:
11+
from importlib_metadata import version
12+
13+
__version__ = version("mqttwarn")

pyproject.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# ==================
2+
# Build system setup
3+
# ==================
4+
5+
[build-system]
6+
requires = [
7+
"setuptools>=42", # At least v42 of setuptools required!
8+
"versioningit",
9+
]
10+
build-backend = "setuptools.build_meta"
11+
12+
13+
[tool.versioningit]
14+
15+
116
# =========================
217
# Linter and code formatter
318
# =========================

requirements-release.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
bump2version
1+
minibump<1; python_version>='3.10'
22
twine
33
keyring

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# -*- coding: utf-8 -*-
2-
# (c) 2014-2022 The mqttwarn developers
2+
# (c) 2014-2023 The mqttwarn developers
33
import os
44
import platform
55

66
from setuptools import find_packages, setup
7+
from versioningit import get_cmdclasses
78

89
here = os.path.abspath(os.path.dirname(__file__))
910
README = open(os.path.join(here, "README.rst")).read()
@@ -16,6 +17,7 @@
1617
"docopt<1",
1718
"requests<3",
1819
"future>=0.18.0,<1",
20+
"importlib-metadata; python_version<'3.8'",
1921
]
2022

2123
extras = {
@@ -170,8 +172,8 @@
170172

171173

172174
setup(
175+
cmdclass=get_cmdclasses(),
173176
name="mqttwarn",
174-
version="0.31.0",
175177
description="mqttwarn - subscribe to MQTT topics and notify pluggable services",
176178
long_description=README,
177179
license="EPL 2.0",

0 commit comments

Comments
 (0)