Skip to content

Commit c573e76

Browse files
authored
feat: use uv instead of poetry (#130)
Signed-off-by: Adrien Mannocci <[email protected]>
1 parent 9490210 commit c573e76

17 files changed

+819
-1238
lines changed

.github/dependabot.yml

-11
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,6 @@
55

66
version: 2
77
updates:
8-
- package-ecosystem: "pip"
9-
directory: "/"
10-
schedule:
11-
interval: "weekly"
12-
day: "sunday"
13-
time: "22:00"
14-
groups:
15-
pip:
16-
patterns:
17-
- "*"
18-
198
# Maintain dependencies for GitHub Actions (/.github/workflows)
209
- package-ecosystem: "github-actions"
2110
directory: "/"

.github/workflows/ci.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
uses: ./.github/workflows/env-install
2929

3030
- name: Lint
31-
run: poetry run poe lint
31+
run: uv run poe lint
3232

3333
build:
3434
needs:
@@ -45,11 +45,9 @@ jobs:
4545

4646
- name: Install environment
4747
uses: ./.github/workflows/env-install
48-
with:
49-
only: 'main,build'
5048

5149
- name: Build
52-
run: poetry run poe build
50+
run: uv run poe build
5351

5452
test:
5553
needs:
@@ -67,4 +65,4 @@ jobs:
6765
terraform_wrapper: false
6866

6967
- name: Test
70-
run: poetry run poe test
68+
run: uv run poe test
+6-22
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
---
22
name: Environment installation
3-
description: Install python, poetry, and dependencies
4-
inputs:
5-
only:
6-
description: 'The only dependency groups to include'
7-
required: true
8-
default: 'main,dev,build'
3+
description: Install uv, and dependencies
94
runs:
105
using: "composite"
116
steps:
@@ -17,22 +12,11 @@ runs:
1712
if: matrix.os == 'ubuntu-latest'
1813
uses: docker/setup-buildx-action@v3
1914

20-
- uses: actions/setup-python@v5
21-
with:
22-
python-version-file: ".python-version"
23-
24-
- name: Install poetry
25-
run: |
26-
pip3 install --no-cache-dir --upgrade pip poetry
27-
shell: "bash"
28-
29-
- name: Install poetry plugins
30-
run: |
31-
poetry self add 'poethepoet[poetry_plugin]'
32-
shell: 'bash'
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v4
3317

3418
- name: Install dependencies
3519
run: |
36-
poetry install --no-interaction --sync --only "${{ inputs.only }}"
37-
poetry poe env:configure
38-
shell: 'bash'
20+
uv sync
21+
uv run poe env:configure
22+
shell: "bash"

.github/workflows/pre-release.yml

+1-6
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ name: Pre release
44
on:
55
workflow_dispatch:
66
inputs:
7-
ref:
8-
description: "Branch or tag ref to run the workflow on"
9-
required: true
10-
default: "main"
117
version:
128
description: "The version to release (e.g. 1.2.3). This workflow will automatically perform the required version bumps"
139
required: true
@@ -44,15 +40,14 @@ jobs:
4440

4541
- uses: actions/checkout@v4
4642
with:
47-
ref: ${{ inputs.ref }}
4843
token: ${{ steps.get-token.outputs.token }}
4944
fetch-depth: 0
5045

5146
- name: Install environment
5247
uses: ./.github/workflows/env-install
5348

5449
- name: Run pre-release step
55-
run: poetry run poe release:pre
50+
run: uv run poe release:pre
5651
env:
5752
RELEASE_VERSION: ${{ inputs.version }}
5853
GH_TOKEN: ${{ steps.get-token.outputs.token }}

.github/workflows/release.yml

+3-8
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ name: Release
44
on:
55
workflow_dispatch:
66
inputs:
7-
ref:
8-
description: "Branch or tag ref to run the workflow on"
9-
required: true
10-
default: "main"
117
version:
128
description: "The next iteration version. This workflow will automatically perform the required version bumps"
139
required: true
@@ -37,7 +33,7 @@ jobs:
3733
uses: ./.github/workflows/env-install
3834

3935
- name: Build
40-
run: poetry run poe build
36+
run: uv run poe build
4137

4238
- uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v1.4.4
4339
with:
@@ -67,7 +63,7 @@ jobs:
6763
- name: Release
6864
env:
6965
GH_TOKEN: ${{ github.token }}
70-
run: poetry run poe release
66+
run: uv run poe release
7167

7268
post-release:
7369
needs:
@@ -96,15 +92,14 @@ jobs:
9692

9793
- uses: actions/checkout@v4
9894
with:
99-
ref: ${{ inputs.ref }}
10095
token: ${{ steps.get-token.outputs.token }}
10196
fetch-depth: 0
10297

10398
- name: Install environment
10499
uses: ./.github/workflows/env-install
105100

106101
- name: Run post-release step
107-
run: poetry run poe release:post
102+
run: uv run poe release:post
108103
env:
109104
NEXT_VERSION: ${{ inputs.version }}
110105
GH_TOKEN: ${{ steps.get-token.outputs.token }}

.pre-commit-config.yaml

+6-27
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,21 @@
33
default_install_hook_types: [ pre-commit, commit-msg ]
44

55
repos:
6-
- repo: local
6+
- repo: https://github.com/astral-sh/ruff-pre-commit
7+
rev: v0.8.1
78
hooks:
8-
- id: pylint
9-
name: pylint
10-
entry: pylint
11-
language: system
12-
types: [ python ]
13-
args:
14-
- -rn # Only display messages
15-
- -sn # Don't display the score
16-
files: 'terranova'
17-
- repo: https://github.com/psf/black
18-
rev: 24.8.0
19-
hooks:
20-
- id: black
21-
language_version: python3.11
22-
- repo: https://github.com/pycqa/isort
23-
rev: 5.13.2
24-
hooks:
25-
- id: isort
26-
name: isort (python)
9+
- id: ruff
10+
args: [ --fix ]
11+
- id: ruff-format
2712
- repo: https://github.com/pre-commit/pre-commit-hooks
28-
rev: v4.6.0
13+
rev: v5.0.0
2914
hooks:
3015
- id: check-json
3116
name: check-json-schema
3217
- id: mixed-line-ending
3318
name: enforce-lf-newline
3419
args:
3520
- --fix=lf
36-
- repo: https://github.com/python-poetry/poetry
37-
rev: 1.8.0
38-
hooks:
39-
- id: poetry-check
40-
- id: poetry-lock
41-
- id: poetry-install
4221
- repo: https://github.com/jorisroovers/gitlint
4322
rev: v0.19.1
4423
hooks:

.pylintrc

-6
This file was deleted.

.python-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.11.9
1+
3.11.10

Containerfile

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Base image for build
2-
ARG base_image_version=3.10.12
3-
FROM python:${base_image_version}-slim-bullseye as builder
2+
FROM debian:bullseye-slim AS builder
43

54
# Switch workdir
65
WORKDIR /opt/terranova
@@ -13,13 +12,17 @@ RUN \
1312
apt-get update > /dev/null \
1413
&& apt-get install -y --no-install-recommends \
1514
binutils="*" \
15+
ca-certificates="*" \
16+
curl="*" \
1617
&& apt-get clean
1718

18-
# Install poetry
19+
# Install uv
20+
ENV UV_INSTALL_DIR="/opt/uv"
21+
ENV PATH="${UV_INSTALL_DIR}:${PATH}"
1922
RUN \
20-
pip3 install --no-cache-dir --upgrade pip poetry
23+
curl -LsSf https://astral.sh/uv/install.sh | sh
2124

2225
# Build
2326
RUN \
24-
poetry install \
25-
&& poetry run pyinstaller terranova.spec
27+
uv sync \
28+
&& uv run pyinstaller terranova.spec

README.md

+10-17
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525
## :package: Prerequisites
2626

2727
- [Python 3.11+](https://docs.python.org/3/) for development.
28-
- [Poetry](https://python-poetry.org/) for build system.
29-
- [Poe](https://poethepoet.natn.io/installation.html#install-poe-the-poet-as-a-poetry-plugin) for task runner.
30-
- [Up](https://github.com/MousaZeidBaker/poetry-plugin-up) for dependency updates.
28+
- [uv](https://docs.astral.sh/uv/) for build system.
3129
- [Podman](https://podman.io/docs) for container packaging.
3230
- [pre-commit](https://pre-commit.com/) for git management.
3331

@@ -56,23 +54,18 @@ The following steps will ensure your project is cloned properly.
5654
git clone https://github.com/elastic/terranova
5755
cd terranova
5856
```
59-
2. Use version defined in .python-version:
57+
2. Install dependencies and setup environment:
6058
```shell
61-
pyenv install
62-
```
63-
3. Install dependencies and setup environment:
64-
```shell
65-
poetry install
66-
poetry shell
67-
poetry poe env:configure
59+
uv sync
60+
uv run poe env:configure
6861
```
6962

7063
### Lint
7164

7265
- To lint you have to use the workflow.
7366

7467
```bash
75-
poetry poe lint
68+
uv run poe lint
7669
```
7770

7871
- It will lint the project code using `pylint`.
@@ -82,7 +75,7 @@ poetry poe lint
8275
- To format you have to use the workflow.
8376

8477
```bash
85-
poetry poe fmt
78+
uv run poe fmt
8679
```
8780

8881
- It will format the project code using `black` and `isort`.
@@ -103,16 +96,16 @@ brew install terranova
10396

10497
```bash
10598
# For MacOSX Apple Silicon
106-
gh release download 0.4.0 -p '*-darwin-arm64' -O /usr/local/bin/terranova --clobber --repo elastic/terranova
99+
gh release download 0.6.5 -p '*-darwin-arm64' -O /usr/local/bin/terranova --clobber --repo elastic/terranova
107100

108101
# For MacOSX Intel
109-
gh release download 0.4.0 -p '*-darwin-amd64' -O /usr/local/bin/terranova --clobber --repo elastic/terranova
102+
gh release download 0.6.5 -p '*-darwin-amd64' -O /usr/local/bin/terranova --clobber --repo elastic/terranova
110103

111104
# For Linux arm64
112-
gh release download 0.4.0 -p '*-linux-arm64' -O /usr/local/bin/terranova --clobber --repo elastic/terranova
105+
gh release download 0.6.5 -p '*-linux-arm64' -O /usr/local/bin/terranova --clobber --repo elastic/terranova
113106

114107
# For Linux amd64
115-
gh release download 0.4.0 -p '*-linux-amd64' -O /usr/local/bin/terranova --clobber --repo elastic/terranova
108+
gh release download 0.6.5 -p '*-linux-amd64' -O /usr/local/bin/terranova --clobber --repo elastic/terranova
116109

117110
# Make it executable
118111
chmod +x /usr/local/bin/terranova

0 commit comments

Comments
 (0)