Skip to content

Commit

Permalink
Use poetry dynamic versioning plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Darwinkel committed Feb 27, 2024
1 parent 460b0e2 commit ad64d05
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/build_docker_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,13 @@ jobs:
run: curl -sSL https://install.python-poetry.org | python3 -

- name: Install poetry export plugin
run: poetry self add poetry-plugin-export
run: poetry self add poetry-plugin-export poetry-dynamic-versioning[plugin]

- name: Export requirements
run: poetry export -o requirements.txt --only main,deploy

- name: Install setuptools_scm
run: pip install --upgrade setuptools setuptools_scm

- name: Write version file
run: python -m setuptools_scm > shepardtts/_version.txt
- name: Update version file
run: poetry dynamic-versioning

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ quality:
make format
make check
make typing

build:
poetry build -f wheel
16 changes: 11 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@ authors = ["Patrick Darwinkel"]
readme = "README.md"
packages = [{include = "shepardtts"}]

[tool.poetry-dynamic-versioning]
enable = true
vcs = "git"
style = "pep440"
metadata = true
tagged-metadata = true
dirty = true
bump = true

# Build configuration
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.setuptools_scm]
version_file = "code/_version.py"
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
build-backend = "poetry_dynamic_versioning.backend"

# Poetry dependency configuration
[tool.poetry.dependencies]
Expand Down
10 changes: 0 additions & 10 deletions shepardtts/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
"""Init ShepardTTS module."""

from pathlib import Path

__version__ = "dev"

version_file = Path("_version.txt")

if version_file.is_file():
with version_file.open() as fp:
__version__ = fp.read().strip()
4 changes: 4 additions & 0 deletions shepardtts/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""Version file that is dynamically updated by Poetry."""

__version__ = "0.0.1-dev"
__version_tuple__ = (0, 0, 1, "dev")
2 changes: 1 addition & 1 deletion shepardtts/app_helpers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Helper functions for ShepardTTS Gradio web interface."""

from __init__ import __version__
from __version__ import __version__

title = "ShepardTTS"

Expand Down

0 comments on commit ad64d05

Please sign in to comment.