Skip to content

Commit 21edb3e

Browse files
author
Daniel Sanz
committed
chore: replace poetry by uv
1 parent 403f259 commit 21edb3e

File tree

11 files changed

+1246
-1459
lines changed

11 files changed

+1246
-1459
lines changed

.github/workflows/lint.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
lint:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616
- name: Set up Python 3.13
1717
uses: actions/setup-python@v4
1818
with:
@@ -21,12 +21,8 @@ jobs:
2121
run: |
2222
sudo apt update
2323
sudo snap install --edge --classic just
24-
- name: Install dependencies
25-
run: |
26-
python -m pip install --upgrade pip
27-
python -m pip install poetry
28-
poetry install
29-
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v5
3026
- name: Lint
3127
run: |
3228
just lint
@@ -36,10 +32,8 @@ jobs:
3632
name: "Lint commit message"
3733
steps:
3834
- name: Check out
39-
uses: actions/checkout@v3
40-
- name: Install commitizen
41-
run: |
42-
python -m pip install --upgrade pip
43-
python -m pip install commitizen
44-
- name: Check commit message
45-
run: cz check --rev-range HEAD
35+
uses: actions/checkout@v4
36+
- name: Install uv
37+
uses: astral-sh/setup-uv@v5
38+
- name: Install commitizen and check commit message
39+
run: uv run cz check --rev-range HEAD

.github/workflows/publish.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This workflow will publish our package on pypi
1+
# This workflow will publish our package on pypi, dockerhub, and create the release notes
22

33
name: Publish
44

@@ -11,23 +11,26 @@ permissions:
1111
contents: write
1212

1313
jobs:
14-
push_to_pypi:
14+
publish_to_pypi:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v3
18-
- name: Publish python package
19-
uses: JRubics/[email protected]
17+
- uses: actions/checkout@v4
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v5
2020
with:
21-
pypi_token: ${{ secrets.PYPI_TOKEN }}
22-
poetry_install_options: "--without dev"
21+
version: "0.6.3"
22+
- name: Publish to PyPi
23+
run: |
24+
uv build
25+
uv publish --index testpypi
2326
2427
push_to_docker_hub:
2528
needs: push_to_pypi
2629
name: Push Docker image to Docker Hub
2730
runs-on: ubuntu-latest
2831
steps:
2932
- name: Check out the repo
30-
uses: actions/checkout@v3
33+
uses: actions/checkout@v4
3134

3235
- name: Log in to Docker Hub
3336
uses: docker/login-action@v2

.github/workflows/security.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
container:
1515
image: ghcr.io/google/osv-scanner:v1.9.2
1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818
- name: Run OSV Scanner
1919
run: |
2020
/osv-scanner --skip-git --format table -r .
@@ -23,24 +23,21 @@ jobs:
2323
container:
2424
image: returntocorp/semgrep:latest
2525
steps:
26-
- uses: actions/checkout@v3
26+
- uses: actions/checkout@v4
2727
- name: Run Semgrep
2828
run: |
2929
semgrep scan --config auto
3030
twyn:
3131
runs-on: ubuntu-latest
3232
steps:
33-
- uses: actions/checkout@v3
33+
- uses: actions/checkout@v4
3434
- name: Set up Python
3535
uses: actions/setup-python@v4
3636
with:
3737
python-version: "3.13"
38-
- name: Install dependencies
39-
run: |
40-
python -m pip install --upgrade pip
41-
python -m pip install poetry
42-
poetry install --only main
38+
- name: Install uv
39+
uses: astral-sh/setup-uv@v5
4340
- name: Run Twyn against our dependencies
4441
run: |
45-
poetry run twyn --version
46-
poetry run twyn run -vv
42+
uv run twyn --version
43+
uv run twyn run -vv

.github/workflows/test-publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Test Publish
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
permissions:
10+
id-token: write
11+
contents: read
12+
13+
jobs:
14+
publish_to_pypi:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v5
20+
with:
21+
version: "0.6.3"
22+
- name: Publish to PyPi
23+
run: |
24+
uv build
25+
uv publish --index testpypi
26+
env:
27+
UV_PUBLISH_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }}

.github/workflows/test.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: [ubuntu-latest]
1919

2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2222
- name: Set up Python
2323
uses: actions/setup-python@v4
2424
with:
@@ -27,12 +27,8 @@ jobs:
2727
run: |
2828
sudo apt update
2929
sudo snap install --edge --classic just
30-
- name: Install dependencies
31-
run: |
32-
python -m pip install --upgrade pip
33-
python -m pip install poetry
34-
poetry install
35-
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@v5
3632
- name: Test with pytest
3733
run: |
3834
just test

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ For new feature proposals, please create first an issue to start a discussion ab
1010

1111
git clone [email protected]:<username>/twyn.git
1212
cd twyn/
13-
3. Make sure to have [poetry](https://python-poetry.org/) installed in your system, as well as [just](https://github.com/casey/just).
13+
3. Make sure to have [uv](https://docs.astral.sh/uv/getting-started/installation/) installed in your system, as well as [just](https://github.com/casey/just).
1414
4. Set up your working environment: create a virtual environment and install the project dependencies.
1515
The following command will do both:
1616

justfile

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
# VARIABLE DEFINITIONS
22
venv := ".venv"
3-
bin := venv + "/bin"
4-
python := bin + "/python"
5-
python_version := "python3.13"
3+
python_version :="3.13"
64
target_dirs := "src tests"
75

8-
9-
# SENTINELS
10-
venv-exists := path_exists(venv)
11-
126
# ALIASES
137
alias t := test
148

@@ -19,32 +13,28 @@ alias t := test
1913
help:
2014
just --list --unsorted
2115

22-
# Generate the virtual environment.
23-
venv:
24-
@if ! {{ venv-exists }}; \
25-
then \
26-
POETRY_VIRTUALENVS_IN_PROJECT=1 poetry env use {{ python_version }}; \
27-
poetry install; \
28-
fi
16+
# Cleans all artifacts generated while running this project, including the virtualenv.
17+
venv:
18+
@UV_PROJECT_ENVIRONMENT={{ venv }} UV_PYTHON={{ python_version }} uv sync
2919

3020
# Cleans all artifacts generated while running this project, including the virtualenv.
3121
clean:
3222
@rm -f .coverage*
3323
@rm -rf {{ venv }}
3424

3525
# Runs the tests with the specified arguments (any path or pytest argument).
36-
test *test-args='': venv
37-
poetry run pytest {{ test-args }} --no-cov
26+
test *test-args='':
27+
@UV_PROJECT_ENVIRONMENT={{ venv }} UV_PYTHON={{ python_version }} uv run pytest {{ test-args }} --no-cov
3828

3929
# Runs all tests including coverage report.
40-
test-all: venv
41-
poetry run pytest
30+
test-all:
31+
@UV_PROJECT_ENVIRONMENT={{ venv }} UV_PYTHON={{ python_version }} uv run pytest
4232

4333
# Format all code in the project.
44-
format: venv
45-
poetry run ruff check {{ target_dirs }} --fix
34+
format:
35+
@UV_PROJECT_ENVIRONMENT={{ venv }} UV_PYTHON={{ python_version }} uv run ruff check {{ target_dirs }} --fix
4636

4737
# Lint all code in the project.
48-
lint: venv
49-
poetry run ruff check {{ target_dirs }}
50-
poetry run mypy {{ target_dirs }}
38+
lint:
39+
@UV_PROJECT_ENVIRONMENT={{ venv }} UV_PYTHON={{ python_version }} uv run ruff check {{ target_dirs }}
40+
@UV_PROJECT_ENVIRONMENT={{ venv }} UV_PYTHON={{ python_version }} uv run mypy {{ target_dirs }}

0 commit comments

Comments
 (0)