Skip to content

Commit

Permalink
Merge pull request #116 from dnvgl/fix-dynamic-versioning
Browse files Browse the repository at this point in the history
Fix version string in built distribution
  • Loading branch information
eneelo authored Dec 6, 2023
2 parents 935bedb + 7fe18e4 commit d2a283d
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 36 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,11 @@ jobs:
run: poetry publish --build
env:
POETRY_PYPI_TOKEN_PYPI : ${{ secrets.PYPI_API_TOKEN }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: builds
path: |
dist/qats-*.tar.gz
dist/qats-*.whl
10 changes: 10 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ jobs:
# Consider specifying version (version: 1.7.1 on Python 3.11)
virtualenvs-create: true
virtualenvs-in-project: true #.venv in current directory
- name: Install dynamic versioning plugin
run: poetry self add "poetry-dynamic-versioning[plugin]"
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
Expand Down Expand Up @@ -105,3 +107,11 @@ jobs:
run: |
source .venv/bin/activate
sphinx-build -b html docs/source docs/_build
- name: Upload artifacts
if: ${{ matrix.python-version == '3.11' }}
uses: actions/upload-artifact@v3
with:
name: test-builds
path: |
dist/qats-*.tar.gz
dist/qats-*.whl
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,5 @@ code-snippets/
# local test folders
tmp*/*

# version file written by poetry dynamic versioning
*/_version.py

# Poetry
poetry.lock
26 changes: 6 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ authors = [
"Per Voie <[email protected]>",
"Erling Lone <[email protected]>"
]
# Repo and docs are optional fields in the project section. Consider to keep it here or to gather
# all URLs in the url section
repository = "https://github.com/dnvgl/qats"
documentation = "https://qats.readthedocs.io"
license = "MIT"
readme = "README.md"
include = [
"LICENSE",
"CHANGELOG.md"
]

[tool.poetry.urls]
Source = "https://github.com/dnvgl/qats"
Documentation = "https://qats.readthedocs.io"
Download = "https://pypi.org/project/qats/"
Issues = "https://github.com/dnvgl/qats/issues"

[tool.poetry.dependencies]
python = ">=3.8.1,<3.13"
h5py = ">=3.5.0"
Expand Down Expand Up @@ -51,13 +53,6 @@ myst-parser = ">=2.0.0"
[tool.poetry.scripts]
qats = "qats.cli:main"


[tool.poetry.urls]
Source = "https://github.com/dnvgl/qats"
Documentation = "https://qats.readthedocs.io"
Download = "https://pypi.org/project/qats/"
Issues = "https://github.com/dnvgl/qats/issues"

# enable dynamic versioning using Git tags
# https://pypi.org/project/poetry-dynamic-versioning/
[tool.poetry-dynamic-versioning]
Expand All @@ -73,15 +68,6 @@ format-jinja = """
{%- endif -%}
"""

[tool.poetry-dynamic-versioning.files."qats/_version.py"]
persistent-substitution = true
initial-content = """
# file generated by poetry dynamic versioning
# don't change, don't track in version control
__version__ = "0.0.0"
__version_tuple__ = (0, 0, 0)
"""

[build-system]
# https://pypi.org/project/poetry-dynamic-versioning/
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.1.1,<2.0.0"]
Expand Down
7 changes: 1 addition & 6 deletions qats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
"""
from .ts import TimeSeries
from .tsdb import TsDB

# version string
try:
from ._version import __version__
except ImportError:
__version__ = "0.0.0"
from ._version import __version__, __version_tuple__

# summary
__summary__ = __doc__
4 changes: 4 additions & 0 deletions qats/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# version substituted by poetry dynamic versioning during poetry build
# don't change
__version__ = "0.0.0"
__version_tuple__ = (0, 0, 0)
7 changes: 1 addition & 6 deletions qats/app/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,7 @@
from .logger import QLogger
from .threading import Worker
from .widgets import CustomTableWidget, CustomTableWidgetItem, CustomTabWidget
# version string
# from .._version import __version__
try:
from .._version import __version__
except ImportError:
__version__ = "0.0.0"
from .. import __version__

LOGGING_LEVELS = dict(
debug=logging.DEBUG,
Expand Down
1 change: 0 additions & 1 deletion qats/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import argparse
import os
import sys
import sysconfig

from pkg_resources import resource_filename
from qtpy.QtWidgets import QApplication
Expand Down

0 comments on commit d2a283d

Please sign in to comment.