Skip to content

Commit

Permalink
Use dynamic versioning with git tags
Browse files Browse the repository at this point in the history
  • Loading branch information
VannTen committed Sep 19, 2022
1 parent 6c78038 commit 8e06110
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 27 deletions.
16 changes: 11 additions & 5 deletions producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,12 @@

import click as cli

from version import __version__
from importlib.metadata import version, PackageNotFoundError

from thoth.common import __version__ as __common__version__
from thoth.common import init_logging

from thoth.storages import __version__ as __storages__version__
from thoth.storages import GraphDatabase

from thoth.messaging import __version__ as __messaging__version__
import thoth.messaging.producer as producer
from thoth.messaging import package_released_message
from thoth.messaging.package_releases import MessageContents as PackageReleasedContent
Expand All @@ -46,14 +43,23 @@
from thoth.python import AIOSource
from thoth.python.exceptions import NotFoundError

try:
__version__ = version(__package__)
except PackageNotFoundError:
__version__ = "v0.11.10" # TODO makes this unnecessary by fixing users of the package

init_logging()

prometheus_registry = CollectorRegistry()

p = producer.create_producer()

_LOGGER = logging.getLogger("thoth.package_releases_job")
__service_version__ = f"{__version__}+storages.{__storages__version__}.common.{__common__version__}.messaging.{__messaging__version__}.python.{__python__version__}" # noqa: E501
__service_version__ = (
f"{__version__}+"
+ ".".join(version(f"thoth-{p}") for p in ["storages", "common", "messaging"])
+ f".python.{__python__version__}"
)
_LOGGER.info("Thoth-package-releases-job-producer v%s", __service_version__)

_THOTH_DEPLOYMENT_NAME = os.environ["THOTH_DEPLOYMENT_NAME"]
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ description = "Check packages updates on Python package indexes"
readme = "README.rst"
requires-python = ">=3.8"
license = {file = "LICENSE"}
version = "v0.11.10"
dynamic = ["version"]

[project.scripts]
package-releases-job = "producer:main"

[build-system]
requires = ["setuptools", "wheel"]
requires = ["setuptools", "wheel", "setuptools_scm"]

[tool.setuptools_scm]

[tool.black]
line-length = 120
Expand Down
20 changes: 0 additions & 20 deletions version.py

This file was deleted.

0 comments on commit 8e06110

Please sign in to comment.