Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to python module (pyproject.toml) #659

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include Pipfile
2 changes: 1 addition & 1 deletion app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# command and debug level
#

exec python producer.py
exec packages-releases-job
30 changes: 12 additions & 18 deletions producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,19 @@
import logging
import asyncio
import random
from typing import List

import os

import click as cli
from typing import List

from version import __version__
from importlib.metadata import version
from prometheus_client import CollectorRegistry, Gauge, Counter, push_to_gateway
import click as cli

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

from prometheus_client import CollectorRegistry, Gauge, Counter, push_to_gateway

from thoth.python import __version__ as __python__version__
from thoth.python import Source
from thoth.python import AIOSource
from thoth.python.exceptions import NotFoundError
Expand All @@ -53,7 +44,14 @@
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
__version__: str = "0.11.11"

__service_version__ = (
f"{__version__}+"
+ ".".join(version(f"thoth-{p}") for p in ["storages", "common", "messaging"])
+ f".python.{version('thoth-python')}"
)

_LOGGER.info("Thoth-package-releases-job-producer v%s", __service_version__)

_THOTH_DEPLOYMENT_NAME = os.environ["THOTH_DEPLOYMENT_NAME"]
Expand Down Expand Up @@ -307,7 +305,3 @@ def main(
)
except Exception as e:
_LOGGER.exception(f"An error occurred pushing the metrics: {str(e)}")


if __name__ == "__main__":
main()
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ description = "Check packages updates on Python package indexes"
readme = "README.rst"
requires-python = ">=3.8"
license = {file = "LICENSE"}
version = "v0.11.10"
dynamic = ["version", "dependencies"]

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

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

[tool.setuptools.dynamic]
version = {attr = "producer.__version__"}

[tool.setuptools-pipfile]

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

This file was deleted.