Skip to content

Commit 00c0b32

Browse files
committed
feat: release_service_utils as python package
scripts/python/* is now shipped as python package which can be imported as release_service_utils Assisted-By: claude Signed-off-by: Jindrich Luza <jluza@redhat.com>
1 parent 0f2e5b4 commit 00c0b32

22 files changed

Lines changed: 63 additions & 28 deletions

pyproject.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,21 @@ dependencies = [
2323
"confluent-kafka",
2424
]
2525

26+
[build-system]
27+
requires = ["setuptools>=61.0.0", "wheel"]
28+
build-backend = "setuptools.build_meta"
29+
30+
[tool.setuptools]
31+
packages = [
32+
"release_service_utils",
33+
"release_service_utils.helpers",
34+
"release_service_utils.tasks",
35+
"release_service_utils.tasks.internal",
36+
]
37+
38+
[tool.setuptools.package-dir]
39+
"release_service_utils" = "scripts/python"
40+
2641
[tool.black]
2742
line-length = 95
2843

scripts/python/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Release Service Utils Python Package."""

scripts/python/helpers/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
11
"""Reusable Python helpers for release task scripts."""
2+
__all__ = [
3+
"authentication",
4+
"file",
5+
"http_client",
6+
"image_ref",
7+
"logger",
8+
"osidb",
9+
"retry",
10+
"tekton"
11+
]

scripts/python/helpers/authentication.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from collections.abc import Sequence
1414
from pathlib import Path
1515

16-
import retry
16+
from release_service_utils.helpers import retry
1717

1818

1919
def read_mounted_text(mount: Path, filename: str) -> str:

scripts/python/helpers/osidb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import json
1717
from typing import Any
1818

19-
import http_client
19+
from release_service_utils.helpers import http_client
2020
from requests_kerberos import HTTPKerberosAuth, OPTIONAL
2121

2222

scripts/python/helpers/tests/__init__.py

Whitespace-only changes.

scripts/python/helpers/test_authentication.py renamed to scripts/python/helpers/tests/test_authentication.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import pytest
1111

12-
import authentication
12+
from release_service_utils.helpers import authentication
1313

1414

1515
def test_read_mounted_text_strips_whitespace(tmp_path: Path) -> None:
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
from pathlib import Path
66

7-
import file
87
import pytest
98

9+
from release_service_utils.helpers import file
10+
1011

1112
def test_path_from_env_variable_uses_set_value(
1213
tmp_path: Path, monkeypatch: pytest.MonkeyPatch

scripts/python/helpers/test_http_client.py renamed to scripts/python/helpers/tests/test_http_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import requests
99
from requests.adapters import HTTPAdapter
1010

11-
import http_client
11+
from release_service_utils.helpers import http_client
1212

1313

1414
def test_retries_policy_defaults() -> None:

scripts/python/helpers/test_image_ref.py renamed to scripts/python/helpers/tests/test_image_ref.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
from __future__ import annotations
44

5-
import image_ref
5+
from release_service_utils.helpers import image_ref
6+
67
import pytest
78

89

0 commit comments

Comments
 (0)