Skip to content

Commit

Permalink
Adds github workflow
Browse files Browse the repository at this point in the history
Moves verion to pyproject.toml file
Updates __init__ to gather __version__ via importlib
  • Loading branch information
gadamc committed Feb 7, 2023
1 parent 9572889 commit 892d242
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 6 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "qt3rfsynthcontrol"
dynamic = ["version"] # version is defined in __init__.py
version = "1.0.1.dev1"

description = "A package for controlling the Windfreak SynthHD RF generator."
readme = "README.md"
Expand Down Expand Up @@ -52,6 +52,3 @@ dependencies = [
"Source" = "https://github.com/qt3uw/qt3rfsynthcontrol"
"Bug Tracker" = "https://github.com/qt3uw/qt3rfsynthcontrol/issues"
"Changelog" = "https://github.com/qt3uw/qt3rfsynthcontrol/releases"

[tool.setuptools.dynamic]
version = {attr = "qt3rfsynthcontrol.__version__"}
4 changes: 2 additions & 2 deletions src/qt3rfsynthcontrol/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .device import QT3SynthHD, discover_devices

__version__ = '1.0.1.dev0'
from importlib.metadata import version
__version__ = version(__package__)

0 comments on commit 892d242

Please sign in to comment.