Skip to content

Commit ff2b68a

Browse files
authored
Merge pull request #36 from mdr78/setuptools-git-versioning
Added support for setuptools-git-versioning
2 parents e6c1358 + d51cbe9 commit ff2b68a

4 files changed

Lines changed: 16 additions & 17 deletions

File tree

.github/workflows/publish-release-to-pypi.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,15 @@ jobs:
2020
- name: Set up Python
2121
uses: actions/setup-python@v2
2222
with:
23-
python-version: '3.x'
23+
python-version: "3.x"
2424
- name: Install Python dependencies
2525
run: |
2626
python -m pip install --upgrade pip
27-
pip install -U setuptools wheel twine
27+
pip install -U -r requirements_release.txt
2828
- name: Build and publish release
2929
env:
3030
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
3131
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
3232
run: |
33-
if [ -z ${{ github.event.inputs.version }} ]; then VERSION=${{ github.event.release.tag_name }}; else VERSION=${{ github.event.inputs.version }}; fi
34-
python setup.py sdist bdist_wheel $VERSION
35-
twine upload dist/*
33+
python setup.py sdist bdist_wheel
34+
twine upload dist/*

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
requests
1+
requests >= 2.32.3

requirements_release.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
setuptools >= 74.1.0
2+
setuptools_git_versioning >= 2.0.0
3+
twine >= 5.1.1
4+
wheel >= 0.44.0

setup.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
1-
import sys
2-
from setuptools import setup
1+
import setuptools
32
from pathlib import Path
43

54
# read the contents of your README file
65
current_directory = Path(__file__).parent
76
long_description = (current_directory / "README.md").read_text()
87

9-
version = sys.argv[3:]
10-
if version:
11-
version = str(version[0])
12-
sys.argv.remove(version)
13-
else:
14-
raise Exception("Version is not set")
15-
16-
setup(
8+
setuptools.setup(
179
name="ThermiaOnlineAPI",
1810
packages=[
1911
"ThermiaOnlineAPI",
@@ -22,7 +14,10 @@
2214
"ThermiaOnlineAPI.model",
2315
"ThermiaOnlineAPI.utils",
2416
],
25-
version=version,
17+
setuptools_git_versioning={
18+
"enabled": True,
19+
"dev_template": "{tag}",
20+
},
2621
license="GPL-3.0",
2722
description="A Python API for Thermia heat pumps using https://online.thermia.se",
2823
long_description=long_description,
@@ -33,5 +28,6 @@
3328
download_url="https://github.com/klejejs/python-thermia-online-api/releases",
3429
keywords=["Thermia", "Online"],
3530
install_requires=[],
31+
setup_requires=["setuptools-git-versioning"],
3632
classifiers=[],
3733
)

0 commit comments

Comments
 (0)