Skip to content

Commit 2090eb6

Browse files
chore(deps): update from template
1 parent 3e49310 commit 2090eb6

7 files changed

Lines changed: 66 additions & 29 deletions

File tree

.copier-answers.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
_commit: v0.6.0
1+
_commit: v0.6.12
22
_src_path: gh:helmut-hoffer-von-ankershoffen/oe-python-template
33
author_email: helmuthva@gmail.com
44
author_github_username: helmut-hoffer-von-ankershoffen
55
author_name: Helmut Hoffer von Ankershoffen
6+
docker_io_enabled: true
67
docker_io_image_name: oe-python-template-example
78
docker_io_owner: helmuthva
89
github_repository_name: oe-python-template-example
@@ -16,6 +17,7 @@ project_description: Example project scaffolded and kept up to date with OE Pyth
1617
project_icon: 🧠
1718
project_name: OE Python Template Example
1819
pypi_distribution_name: oe-python-template-example
20+
readthedocs_domain: readthedocs.org
1921
readthedocs_project_key: oe-python-template-example
2022
sonarqube_key: helmut-hoffer-von-ankershoffen_oe-python-template-example
2123
streamlit_project_key: oe-python-template-example

.github/workflows/docker-image-build-publish.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
tags:
66
- "v*.*.*"
77

8+
89
env:
910
REGISTRY: docker.io
1011
IMAGE_NAME: helmuthva/oe-python-template-example
@@ -28,25 +29,38 @@ jobs:
2829
- name: Set up Docker Buildx
2930
uses: docker/setup-buildx-action@v3
3031

32+
33+
3134
- name: Log in to Docker Hub
3235
uses: docker/login-action@v3
3336
with:
37+
3438
username: ${{ secrets.DOCKER_USERNAME }}
3539
password: ${{ secrets.DOCKER_PASSWORD }}
3640

41+
42+
3743
- name: Log in to GitHub container registry
3844
uses: docker/login-action@v3
3945
with:
4046
registry: ghcr.io
47+
4148
username: ${{ github.actor }}
4249
password: ${{ secrets.GITHUB_TOKEN }}
50+
51+
4352
- name: Extract metadata (tags, labels) for Docker
4453
id: meta
4554
uses: docker/metadata-action@v5
4655
with:
56+
57+
4758
images: |
4859
${{ env.IMAGE_NAME }}
4960
ghcr.io/${{ github.repository }}
61+
62+
63+
5064
tags: |
5165
# set latest tag for releases
5266
type=raw,value=latest
@@ -55,6 +69,8 @@ jobs:
5569
type=semver,pattern={{major}}.{{minor}}
5670
type=semver,pattern={{major}}
5771
72+
73+
5874
- name: Build and push Docker image
5975
id: push
6076
uses: docker/build-push-action@v6
@@ -66,6 +82,9 @@ jobs:
6682
tags: ${{ steps.meta.outputs.tags }}
6783
labels: ${{ steps.meta.outputs.labels }}
6884

85+
86+
87+
6988
- name: Generate artifact attestation
7089
uses: actions/attest-build-provenance@v2
7190
with:

SERVICE_CONNECTIONS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
4. On https://app.readthedocs.org/projects/oe-python-template-example/ wait for the build of the documentation to finish
2828
5. Goto https://oe-python-template-example.readthedocs.io/en/latest/
2929

30+
## Automatic dependency updates via Rennovate (https://github.com/apps/renovate)
31+
32+
1. Goto https://github.com/apps/renovate and click the "Configure" button
33+
2. Select the owner of your project's repository and configure "Repository access"
34+
3. Rennovate creates a [Dependency Dashboard](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/issues) as an issue in your repository
35+
3036
## Publishing package to Python Package Index (pypi.org)
3137

3238
1. Execute `uv build`. This will generate the build files (wheel and tar.gz) in the `dist` folder

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def bump(session: nox.Session) -> None:
191191
version_part = session.posargs[0] if session.posargs else "patch"
192192

193193
# Check if the version_part is a specific version (e.g., 1.2.3)
194-
if re.match(r"^[0-9]+\.[0-9]+\.[0-9]+$", version_part):
194+
if re.match(r"^\d+\.\d+\.\d+$", version_part):
195195
session.run("bump-my-version", "bump", "--new-version", version_part, external=True)
196196
else:
197197
session.run("bump-my-version", "bump", version_part, external=True)

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sonar.links.homepage=https://oe-python-template-example.readthedocs.io/en/latest
66
sonar.links.scm=https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example
77
sonar.links.ci=https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/actions
88
sonar.links.issues=https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/issues
9-
sonar.python.coverage.reportPaths=coverage.xml
9+
sonar.python.coverage.reportPaths=reports/coverage.xml
1010
sonar.python.version=3.11, 3.12, 3.13
1111
sonar.coverage.exclusions=noxfile.py, tests/**, examples/**, docs/**
1212
sonar.exclusions=examples/**, docs/**

src/oe_python_template_example/api.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
HELLO_WORLD_EXAMPLE = "Hello, world!"
2222
UVICORN_HOST = os.environ.get("UVICORN_HOST", "127.0.0.1")
2323
UVICORN_PORT = os.environ.get("UVICORN_PORT", "8000")
24+
CONTACT_NAME = "Helmut Hoffer von Ankershoffen"
25+
CONTACT_EMAIL = "helmuthva@gmail.com"
26+
CONTACT_URL = "https://github.com/helmut-hoffer-von-ankershoffen"
27+
TERMS_OF_SERVICE_URL = "https://oe-python-template-example.readthedocs.io/en/latest/"
2428

2529

2630
def get_service() -> Generator[Service, None, None]:
@@ -41,11 +45,11 @@ def get_service() -> Generator[Service, None, None]:
4145
root_path="/api",
4246
title="OE Python Template Example",
4347
contact={
44-
"name": "Helmut Hoffer von Ankershoffen",
45-
"email": "helmuthva@gmail.com",
46-
"url": "https://github.com/helmut-hoffer-von-ankershoffen",
48+
"name": CONTACT_NAME,
49+
"email": CONTACT_EMAIL,
50+
"url": CONTACT_URL,
4751
},
48-
terms_of_service="https://oe-python-template-example.readthedocs.io/en/latest/",
52+
terms_of_service=TERMS_OF_SERVICE_URL,
4953
openapi_tags=[
5054
{
5155
"name": "v1",
@@ -70,22 +74,22 @@ def get_service() -> Generator[Service, None, None]:
7074
version="1.0.0",
7175
title="OE Python Template Example",
7276
contact={
73-
"name": "Helmut Hoffer von Ankershoffen",
74-
"email": "helmuthva@gmail.com",
75-
"url": "https://github.com/helmut-hoffer-von-ankershoffen",
77+
"name": CONTACT_NAME,
78+
"email": CONTACT_EMAIL,
79+
"url": CONTACT_URL,
7680
},
77-
terms_of_service="https://oe-python-template-example.readthedocs.io/en/latest/",
81+
terms_of_service=TERMS_OF_SERVICE_URL,
7882
)
7983

8084
api_v2 = FastAPI(
8185
version="2.0.0",
8286
title="OE Python Template Example",
8387
contact={
84-
"name": "Helmut Hoffer von Ankershoffen",
85-
"email": "helmuthva@gmail.com",
86-
"url": "https://github.com/helmut-hoffer-von-ankershoffen",
88+
"name": CONTACT_NAME,
89+
"email": CONTACT_EMAIL,
90+
"url": CONTACT_URL,
8791
},
88-
terms_of_service="https://oe-python-template-example.readthedocs.io/en/latest/",
92+
terms_of_service=TERMS_OF_SERVICE_URL,
8993
)
9094

9195

tests/api_test.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
HEALTHZ_PATH_V1 = "/api/v1/healthz"
2020
HEALTHZ_PATH_V2 = "/api/v2/healthz"
2121

22+
HELLO_WORLD = "Hello, world!"
23+
24+
SERVICE_UP = "UP"
25+
SERVICE_DOWN = "DOWN"
26+
SERVICE_IS_UNHEALTHY = "Service is unhealthy"
27+
2228

2329
@pytest.fixture
2430
def client() -> TestClient:
@@ -37,11 +43,11 @@ def test_hello_world_endpoint(client: TestClient) -> None:
3743
"""Test that the hello-world endpoint returns the expected message."""
3844
response = client.get(HELLO_WORLD_PATH_V1)
3945
assert response.status_code == 200
40-
assert response.json()["message"].startswith("Hello, world!")
46+
assert response.json()["message"].startswith(HELLO_WORLD)
4147

4248
response = client.get(HELLO_WORLD_PATH_V2)
4349
assert response.status_code == 200
44-
assert response.json()["message"].startswith("Hello, world!")
50+
assert response.json()["message"].startswith(HELLO_WORLD)
4551

4652

4753
def test_echo_endpoint_valid_input(client: TestClient) -> None:
@@ -79,22 +85,22 @@ def test_health_endpoint(client: TestClient) -> None:
7985
"""Test that the health endpoint returns UP status."""
8086
response = client.get(HEALTH_PATH_V1)
8187
assert response.status_code == 200
82-
assert response.json()["status"] == "UP"
88+
assert response.json()["status"] == SERVICE_UP
8389
assert response.json()["reason"] is None
8490

8591
response = client.get(HEALTH_PATH_V2)
8692
assert response.status_code == 200
87-
assert response.json()["status"] == "UP"
93+
assert response.json()["status"] == SERVICE_UP
8894
assert response.json()["reason"] is None
8995

9096
response = client.get(HEALTHZ_PATH_V1)
9197
assert response.status_code == 200
92-
assert response.json()["status"] == "UP"
98+
assert response.json()["status"] == SERVICE_UP
9399
assert response.json()["reason"] is None
94100

95101
response = client.get(HEALTHZ_PATH_V2)
96102
assert response.status_code == 200
97-
assert response.json()["status"] == "UP"
103+
assert response.json()["status"] == SERVICE_UP
98104
assert response.json()["reason"] is None
99105

100106

@@ -107,20 +113,20 @@ def test_health_endpoint_down(mock_service, client: TestClient) -> None:
107113

108114
response = client.get(HEALTH_PATH_V1)
109115
assert response.status_code == 500
110-
assert response.json()["status"] == "DOWN"
111-
assert response.json()["reason"] == "Service is unhealthy"
116+
assert response.json()["status"] == SERVICE_DOWN
117+
assert response.json()["reason"] == SERVICE_IS_UNHEALTHY
112118

113119
response = client.get(HEALTH_PATH_V2)
114120
assert response.status_code == 500
115-
assert response.json()["status"] == "DOWN"
116-
assert response.json()["reason"] == "Service is unhealthy"
121+
assert response.json()["status"] == SERVICE_DOWN
122+
assert response.json()["reason"] == SERVICE_IS_UNHEALTHY
117123

118124
response = client.get(HEALTHZ_PATH_V1)
119125
assert response.status_code == 500
120-
assert response.json()["status"] == "DOWN"
121-
assert response.json()["reason"] == "Service is unhealthy"
126+
assert response.json()["status"] == SERVICE_DOWN
127+
assert response.json()["reason"] == SERVICE_IS_UNHEALTHY
122128

123129
response = client.get(HEALTHZ_PATH_V2)
124130
assert response.status_code == 500
125-
assert response.json()["status"] == "DOWN"
126-
assert response.json()["reason"] == "Service is unhealthy"
131+
assert response.json()["status"] == SERVICE_DOWN
132+
assert response.json()["reason"] == SERVICE_IS_UNHEALTHY

0 commit comments

Comments
 (0)