Skip to content

Commit 62f753d

Browse files
authored
Automatic uv version resolution (#46)
1 parent b8cda8e commit 62f753d

File tree

6 files changed

+25
-13
lines changed

6 files changed

+25
-13
lines changed

.github/workflows/pull_request.yaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@ jobs:
1414
if: github.actor != 'dependabot[bot]'
1515
runs-on: ubuntu-latest
1616
outputs:
17-
python-template-docker-tag: ${{ steps.python-template-docker-tag.outputs.python-template-docker-tag }}
17+
docker-tag: ${{ steps.docker-tag.outputs.docker-tag }}
1818
env:
19-
PYTHON_APP_ENVIRONMENT: Development
19+
PYTHON_APP_ENVIRONMENT: development
2020
steps:
2121
- name: Checkout repository
2222
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2323

2424
- name: Install uv
25-
uses: astral-sh/setup-uv@557e51de59eb14aaaba2ed9621916900a91d50c6 # v6.6.1
25+
uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0
2626
with:
27-
version: 0.9.0
27+
version-file: pyproject.toml
28+
resolution-strategy: lowest
2829

2930
- name: Install Python
3031
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
@@ -52,36 +53,36 @@ jobs:
5253
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
5354

5455
- name: Set docker tag
55-
id: python-template-docker-tag
56-
run: echo "python-template-docker-tag=myregistry/python-template:${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
56+
id: docker-tag
57+
run: echo "docker-tag=myregistry/python-template:${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
5758

5859
- name: Build and push
5960
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
6061
with:
6162
file: src/python_template/api/Dockerfile
62-
tags: ${{ steps.python-template-docker-tag.outputs.python-template-docker-tag }}
63+
tags: ${{ steps.docker-tag.outputs.docker-tag }}
6364
push: false
6465

6566
deploy-dev:
6667
needs: continuous-integration
6768
uses: ./.github/workflows/_deploy.yaml
6869
with:
6970
environment: dev
70-
docker_tag: ${{ needs.continuous-integration.outputs.python-template-docker-tag }}
71+
docker_tag: ${{ needs.continuous-integration.outputs.docker-tag }}
7172
secrets: inherit
7273

7374
deploy-stg:
7475
needs: [continuous-integration, deploy-dev]
7576
uses: ./.github/workflows/_deploy.yaml
7677
with:
7778
environment: stg
78-
docker_tag: ${{ needs.continuous-integration.outputs.python-template-docker-tag }}
79+
docker_tag: ${{ needs.continuous-integration.outputs.docker-tag }}
7980
secrets: inherit
8081

8182
deploy-pro:
8283
needs: [continuous-integration, deploy-stg]
8384
uses: ./.github/workflows/_deploy.yaml
8485
with:
8586
environment: pro
86-
docker_tag: ${{ needs.continuous-integration.outputs.python-template-docker-tag }}
87+
docker_tag: ${{ needs.continuous-integration.outputs.docker-tag }}
8788
secrets: inherit

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ dev = [
2424
]
2525

2626
[build-system]
27-
requires = ["uv_build>=0.9.0,<0.10.0"]
27+
requires = ["uv_build"]
2828
build-backend = "uv_build"
2929

30+
[tool.uv]
31+
required-version = ">=0.9.2,<0.10.0"
32+
3033
[tool.pyright]
3134
typeCheckingMode = "strict"
3235

src/python_template/api/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# 0.9.0-python3.13-bookworm-slim
2-
FROM astral/uv@sha256:3cb1f6710acffab0693c9efaaa32ab21ff10a4f8e38efaa5f2688abb49f35687 AS builder
1+
# 0.9.2-python3.13-bookworm-slim
2+
FROM astral/uv@sha256:7072fbb9cf84e6b76bee43905c27a1cf4afa48bfa49de3cb2b57f748ada6cc10 AS builder
33

44
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy UV_PYTHON_DOWNLOADS=0
55

tests/unit/domain/__init__.py

Whitespace-only changes.

tests/unit/domain/entities/__init__.py

Whitespace-only changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from decimal import Decimal
2+
3+
from python_template.domain.entities.product import Product
4+
5+
6+
class TestProduct:
7+
def test_publish_product(self) -> None:
8+
Product(name="Product name", price=Decimal("1.0"), is_discontinued=False)

0 commit comments

Comments
 (0)