Skip to content

Commit 5a1fdc6

Browse files
heliocastrotsteenbe
authored andcommitted
refactor: Migrate from poetry to astral uv
Signed-off-by: Helio Chissini de Castro <[email protected]>
1 parent d2cf19f commit 5a1fdc6

File tree

7 files changed

+2145
-2295
lines changed

7 files changed

+2145
-2295
lines changed

.github/workflows/build_and_publish.yaml

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -26,46 +26,44 @@ on:
2626
workflow_dispatch:
2727
push:
2828
tags:
29-
- 'v*'
29+
- "v*"
3030
paths-ignore:
31-
- '**.md'
31+
- "**.md"
3232
pull_request:
3333
paths-ignore:
34-
- '**.md'
34+
- "**.md"
3535

3636
jobs:
37-
build_deploy:
38-
name: Build and Deploy Python OrtHW
39-
runs-on: ubuntu-latest
37+
build_deploy:
38+
name: Build and Deploy Python OrtHW
39+
runs-on: ubuntu-24.04
4040

41-
steps:
42-
- uses: actions/checkout@v4
41+
steps:
42+
- uses: actions/checkout@v4
4343

44-
- name: Install poetry
45-
run: pipx install poetry
46-
- uses: actions/setup-python@v5
47-
with:
48-
python-version: '3.10'
49-
cache: 'poetry'
44+
- uses: astral-sh/setup-uv@v5
45+
with:
46+
enable-cache: true
5047

51-
- name: Setup poetry project
52-
run: |
53-
poetry install -q
54-
poetry build
48+
- uses: actions/setup-python@v5
49+
with:
50+
python-version-file: "pyproject.toml"
5551

56-
- name: Check 📦 package
57-
run: |
58-
poetry run twine check dist/*
52+
- name: Build 📦 package
53+
run: |
54+
uv build
55+
shell: bash
5956

60-
- name: Upload artifacts
61-
uses: actions/upload-artifact@v4
62-
with:
63-
name: build-artifacts
64-
path: dist/*
57+
- name: Upload artifacts
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: build-artifacts
61+
path: dist/*
6562

66-
- name: Publish 📦 package
67-
if: github.event_name == 'push'
68-
env:
69-
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USER }}
70-
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
71-
run: poetry run twine upload -r testpypi dist/*
63+
- name: Publish Test 📦 package
64+
if: github.event_name == 'push'
65+
env:
66+
UV_PUBLISH_USERNAME: ${{ secrets.TEST_PYPI_USER }}
67+
UV_PUBLISH_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
68+
run: |
69+
uv publish --index testpypi dist/*

.github/workflows/commit_checks.yaml

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,47 @@ on:
2121
workflow_dispatch:
2222
pull_request:
2323
paths-ignore:
24-
- '**.md'
24+
- "**.md"
2525
push:
2626
branches: [main]
2727

2828
jobs:
29-
build:
30-
name: Validate Commit
31-
runs-on: ubuntu-latest
32-
29+
commitlint:
30+
name: Commit Lint
31+
runs-on: ubuntu-24.04
3332
steps:
3433
- uses: actions/checkout@v4
3534
- uses: webiny/[email protected]
36-
#- uses: apache/skywalking-eyes/header@main
37-
38-
- name: Install poetry
39-
run: pipx install poetry
4035

36+
mypy:
37+
needs: commitlint
38+
name: MyPy Python linter
39+
runs-on: ubuntu-24.04
40+
steps:
41+
- uses: actions/checkout@v4
4142
- uses: actions/setup-python@v5
4243
with:
43-
python-version: '3.10'
44-
cache: 'poetry'
45-
- run:
46-
poetry install -q
47-
- name: MyPy static check
48-
run: |
49-
poetry run mypy --config-file pyproject.toml .
50-
- name: Ruff Linting
51-
run: |
52-
poetry install
53-
poetry run ruff check --config pyproject.toml .
44+
python-version: "3.10"
45+
- name: Install mypy
46+
run: pip install mypy
47+
- name: Run mypy
48+
uses: sasanquaneuf/mypy-github-action@releases/v1.3
49+
with:
50+
checkName: "mypy" # NOTE: this needs to be the same as the job name
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
54+
ruff:
55+
needs: commitlint
56+
name: Ruff Python Linter
57+
runs-on: ubuntu-24.04
58+
steps:
59+
- uses: actions/checkout@v4
60+
- name: Ruff Check
61+
uses: astral-sh/ruff-action@v3
62+
with:
63+
args: "check --config pyproject.toml"
64+
- name: Ruff Format
65+
uses: astral-sh/ruff-action@v3
66+
with:
67+
args: "format --check --config pyproject.toml"

.pre-commit-config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.6.0
3+
rev: v5.0.0
44
hooks:
55
- id: trailing-whitespace
66
- id: end-of-file-fixer
@@ -9,7 +9,7 @@ repos:
99
- id: check-added-large-files
1010

1111
- repo: https://github.com/pre-commit/mirrors-mypy
12-
rev: v1.10.1
12+
rev: v1.14.1
1313
hooks:
1414
- id: mypy
1515
additional_dependencies:
@@ -19,21 +19,21 @@ repos:
1919
- types-requests
2020
args: [--config, pyproject.toml]
2121

22-
- repo: https://github.com/charliermarsh/ruff-pre-commit
23-
rev: "v0.4.10"
22+
- repo: https://github.com/astral-sh/ruff-pre-commit
23+
rev: "v0.9.1"
2424
hooks:
2525
- id: ruff
2626
args: [ --fix ]
2727
- id: ruff-format
2828

2929
- repo: https://github.com/compilerla/conventional-pre-commit
30-
rev: "v3.2.0"
30+
rev: "v4.0.0"
3131
hooks:
3232
- id: conventional-pre-commit
3333
stages: [commit-msg]
3434
args: []
3535

36-
- repo: https://github.com/python-poetry/poetry
37-
rev: "1.8.0"
36+
- repo: https://github.com/astral-sh/uv-pre-commit
37+
rev: "0.5.18"
3838
hooks:
39-
- id: poetry-check
39+
- id: uv-lock

0 commit comments

Comments
 (0)