Skip to content

Commit

Permalink
Merge pull request #121 from dnvgl/update-dynamic-versioning
Browse files Browse the repository at this point in the history
Dev: update dynamic versioning
  • Loading branch information
eneelo authored Dec 7, 2023
2 parents 0d9ddc7 + 57524e5 commit 54c4da4
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,6 @@ tmp*/*

# Poetry
poetry.lock

# version file generated by poetry dynamic versioning
*/_version.py
15 changes: 1 addition & 14 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# qats documentation build configuration file,
# originally created by sphinx-quickstart
#
from importlib import metadata
import os
import sys
# import the package to be documented
Expand All @@ -15,19 +14,7 @@
THEME = 'furo' # 'sphinx_rtd_theme'

# determine qats version
#
# note:
# As of v5.0.4, qats.__version__ returns "0.0.0" when in a an editable install
# (e.g., if installed from repo using `poetry install` or `pip install -e .`).
# This is, however, exactly the case when documentation is built for readthedocs.
# Therefore, qats version must be determined using importlib instead.
# warning:
# importlib.metadata may be tricked if an old folder 'qats.egg-info' is present
# (e.g., originating from a previous call to `pip install -e .`). The version
# string obtained may then be outdated. However, it is safe to delete this old
# folder. Also, this should not be an issue when docs are built by readthedocs.
__version__ = metadata.version("qats")

__version__ = qats.__version__

# print("Generating doc for QATS version {version} installed in {path}"
# .format(version=qats.__version__, path=qats.__path__))
Expand Down
11 changes: 10 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ license = "MIT"
readme = "README.md"
include = [
"LICENSE",
"CHANGELOG.md"
"CHANGELOG.md",
"*/_version.py"
]
# some urls given here instead of ulrs section (affects listed order on PyPi)
homepage = "https://github.com/dnvgl/qats"
Expand Down Expand Up @@ -72,6 +73,14 @@ format-jinja = """
{%- endif -%}
"""

[tool.poetry-dynamic-versioning.files."qats/_version.py"]
persistent-substitution = true
initial-content = """
# file generated by poetry dynamic versioning during poetry build/install
# 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
8 changes: 7 additions & 1 deletion qats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
"""
from .ts import TimeSeries
from .tsdb import TsDB
from ._version import __version__, __version_tuple__

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

# summary
__summary__ = __doc__
4 changes: 0 additions & 4 deletions qats/_version.py

This file was deleted.

0 comments on commit 54c4da4

Please sign in to comment.