Skip to content

Commit

Permalink
Merge pull request #36 from mdr78/setuptools-git-versioning
Browse files Browse the repository at this point in the history
Added support for setuptools-git-versioning
  • Loading branch information
klejejs authored Sep 3, 2024
2 parents e6c1358 + d51cbe9 commit ff2b68a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/publish-release-to-pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
python-version: "3.x"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel twine
pip install -U -r requirements_release.txt
- name: Build and publish release
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
if [ -z ${{ github.event.inputs.version }} ]; then VERSION=${{ github.event.release.tag_name }}; else VERSION=${{ github.event.inputs.version }}; fi
python setup.py sdist bdist_wheel $VERSION
twine upload dist/*
python setup.py sdist bdist_wheel
twine upload dist/*
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
requests
requests >= 2.32.3
4 changes: 4 additions & 0 deletions requirements_release.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
setuptools >= 74.1.0
setuptools_git_versioning >= 2.0.0
twine >= 5.1.1
wheel >= 0.44.0
18 changes: 7 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
import sys
from setuptools import setup
import setuptools
from pathlib import Path

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

version = sys.argv[3:]
if version:
version = str(version[0])
sys.argv.remove(version)
else:
raise Exception("Version is not set")

setup(
setuptools.setup(
name="ThermiaOnlineAPI",
packages=[
"ThermiaOnlineAPI",
Expand All @@ -22,7 +14,10 @@
"ThermiaOnlineAPI.model",
"ThermiaOnlineAPI.utils",
],
version=version,
setuptools_git_versioning={
"enabled": True,
"dev_template": "{tag}",
},
license="GPL-3.0",
description="A Python API for Thermia heat pumps using https://online.thermia.se",
long_description=long_description,
Expand All @@ -33,5 +28,6 @@
download_url="https://github.com/klejejs/python-thermia-online-api/releases",
keywords=["Thermia", "Online"],
install_requires=[],
setup_requires=["setuptools-git-versioning"],
classifiers=[],
)

0 comments on commit ff2b68a

Please sign in to comment.