Skip to content

Commit 52969b3

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

File tree

11 files changed

+49
-26
lines changed

11 files changed

+49
-26
lines changed

.bumpversion.cfg

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

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
*
2+
!.git
23
!etc
34
!mqttwarn
45
!tests
6+
!pyproject.toml
57
!setup.py
68
!MANIFEST.in
79
!*.ini

.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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
#
88
FROM python:3.11-slim-bullseye
99

10+
# Install additional requirements
11+
RUN apt-get update && apt-get install --yes git
12+
1013
# Create /etc/mqttwarn
1114
RUN mkdir -p /etc/mqttwarn
1215
WORKDIR /etc/mqttwarn
@@ -17,7 +20,7 @@ RUN chown -R mqttwarn:mqttwarn /etc/mqttwarn
1720

1821
# Install mqttwarn
1922
COPY . /src
20-
RUN pip install wheel
23+
RUN pip install versioningit wheel
2124
RUN pip install /src
2225

2326
# Make process run as "mqttwarn" user

Dockerfile.full

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
FROM python:3.11-slim-bullseye
99

1010
# Install additional requirements
11+
RUN apt-get update && apt-get install --yes git
12+
1113
# FIXME: Skip all packages needing compilation
1214
#RUN apt-get update && apt-get install --yes librrd-dev
1315

@@ -21,7 +23,7 @@ RUN chown -R mqttwarn:mqttwarn /etc/mqttwarn
2123

2224
# Install mqttwarn
2325
COPY . /src
24-
RUN pip install wheel
26+
RUN pip install versioningit wheel
2527
RUN pip install /src[all]
2628

2729
# 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 # type: ignore[no-redef]
12+
13+
__version__ = version("mqttwarn")

pyproject.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
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+
[tool.versioningit.vcs]
16+
method = "git"
17+
default-tag = "0.0.0"
18+
19+
120
# =========================
221
# Linter and code formatter
322
# =========================

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

0 commit comments

Comments
 (0)