Skip to content

Commit 98dfb52

Browse files
committed
refactor: Migrate from poetry to astral uv
Signed-off-by: Helio Chissini de Castro <heliocastro@gmail.com>
1 parent d2cf19f commit 98dfb52

File tree

6 files changed

+2147
-233
lines changed

6 files changed

+2147
-233
lines changed

.github/workflows/build_and_publish.yaml

+30-32
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/linters.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Python Linters
2+
3+
on: [workflow_dispatch, pull_request]
4+
5+
jobs:
6+
mypy:
7+
name: MyPy Python linter
8+
runs-on: ubuntu-24.04
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: actions/setup-python@v5
12+
with:
13+
python-version: "3.10"
14+
- name: Install mypy
15+
run: pip install mypy
16+
- name: Run mypy
17+
uses: sasanquaneuf/mypy-github-action@releases/v1.3
18+
with:
19+
checkName: "mypy" # NOTE: this needs to be the same as the job name
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
23+
ruff:
24+
needs: mypy
25+
name: Ruff Python Linter
26+
runs-on: ubuntu-24.04
27+
steps:
28+
- uses: actions/checkout@v4
29+
- name: Ruff Check
30+
uses: astral-sh/ruff-action@v3
31+
with:
32+
args: "check --config pyproject.toml"
33+
- name: Ruff Format
34+
uses: astral-sh/ruff-action@v3
35+
with:
36+
args: "format --check --config pyproject.toml"

.pre-commit-config.yaml

+8-8
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)