Skip to content

Commit cd74c23

Browse files
authored
refactor: switch to uv with lockfile, decouple PyPI and optimize Docker builds (#914)
Documentation * doc: update README.md * doc: update installation docs * doc: update CHANGELOG.md Build & Dependencies * build: replace pip with uv pip * build: add uv.lock * chore: cap major versions for production dependencies * fix: CVE-2025-69223 Docker * feat: adapt Dockerfile for uv-based installation * feat: optimize Docker build using uv caching * feat: simplify Dockerfile * refactor: small Dockerfile improvements * fix: remove LOGPREP_VERSION build argument CI / CD * feat: adapt CI/CD workflow files * feat: update actions/checkout to v6
1 parent d5326cd commit cd74c23

21 files changed

+3936
-134
lines changed

.github/copilot-instructions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class Component:
2222
@define(kw_only=True)
2323
class Config(BaseClass.Config):
2424
# Configuration parameters with validators
25-
26-
@define(kw_only=True)
25+
26+
@define(kw_only=True)
2727
class Metrics(BaseClass.Metrics):
2828
# Prometheus metrics with CounterMetric/HistogramMetric
2929
```
@@ -52,13 +52,13 @@ Each processor has `processor.py` and `rule.py`:
5252

5353
### Setup
5454
```bash
55-
pip install -e .[dev] # Install with dev dependencies
55+
uv sync --frozen --extra dev # Install with dev dependencies
5656
pre-commit install # Enable hooks
5757
```
5858

5959
### Testing
6060
```bash
61-
pytest ./tests --cov=logprep --cov-report=xml -vvv
61+
uv run pytest ./tests --cov=logprep --cov-report=xml -vvv
6262
```
6363

6464
### Hybrid Python/Rust

.github/workflows/check-examples.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
python-version: ["3.11", "3.12", "3.13", "3.14"]
1111
steps:
1212
- name: Checkout code
13-
uses: actions/checkout@v4
13+
uses: actions/checkout@v6
1414
with:
1515
fetch-depth: 0
1616
- name: Set up Docker Compose

.github/workflows/ci.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,23 @@ jobs:
1717
matrix:
1818
python-version: ["3.11"]
1919
steps:
20-
- uses: actions/checkout@v4
21-
- name: Set up Python
22-
uses: actions/setup-python@v5
20+
- uses: actions/checkout@v6
21+
- name: Install uv and set the Python version
22+
uses: astral-sh/setup-uv@v7
2323
with:
24-
python-version: ${{ matrix.python-version }}
25-
cache: "pip"
26-
- name: Install dependencies
24+
enable-cache: true
25+
- name: Install pandoc
2726
run: |
28-
sudo apt-get update && sudo apt-get -y install pandoc
29-
pip install --upgrade pip wheel
30-
pip install .[doc]
31-
- name: build docs
27+
sudo apt-get update
28+
sudo apt-get -y install pandoc
29+
- name: Install uv and sync deps
30+
run: |
31+
uv sync --frozen --extra doc
32+
- name: Build docs
3233
run: |
3334
cd doc
34-
sphinx-apidoc -fT -o source/module_reference ../logprep
35-
make clean html
35+
uv run sphinx-apidoc -fT -o source/module_reference ../logprep
36+
uv run make clean html
3637
documentation-preview:
3738
runs-on: ubuntu-latest
3839
steps:

.github/workflows/code-quality.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,43 +13,38 @@ jobs:
1313
matrix:
1414
python-version: ["3.11"]
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v6
1717
with:
1818
fetch-depth: 0
1919
- uses: azure/setup-helm@v4.2.0
2020
with:
2121
version: "latest"
2222
id: install
23-
- name: Set up Python
24-
uses: actions/setup-python@v5
23+
- name: Install uv and set the Python version
24+
uses: astral-sh/setup-uv@v7
2525
with:
2626
python-version: ${{ matrix.python-version }}
27-
cache: "pip"
27+
enable-cache: true
2828
- name: Get changed python files
2929
id: changed-files
3030
uses: tj-actions/changed-files@v46
3131
with:
3232
files: |
3333
${{ inputs.path }}
3434
- name: Install dependencies
35-
run: |
36-
pip install --upgrade pip wheel
37-
pip install .[dev]
35+
run: uv sync --frozen --extra dev
3836
- name: check black formatting
39-
run: |
40-
black --check --diff --config ./pyproject.toml .
37+
run: uv run black --check --diff --config ./pyproject.toml .
4138
- name: lint helm charts
42-
run: |
43-
helm lint --strict ./charts/logprep
39+
run: helm lint --strict ./charts/logprep
4440
- name: lint changed and added files
4541
if: steps.changed-files.outputs.all_changed_files
46-
run: |
47-
pylint ${{ steps.changed-files.outputs.all_changed_files }}
42+
run: uv run pylint ${{ steps.changed-files.outputs.all_changed_files }}
4843
- name: mypy type checking
4944
if: steps.changed-files.outputs.all_changed_files
50-
run: mypy ${{ steps.changed-files.outputs.all_changed_files }}
45+
run: uv run mypy --follow-imports=skip ${{ steps.changed-files.outputs.all_changed_files }}
5146
- name: Run tests and collect coverage
52-
run: pytest tests/unit --cov=logprep --cov-report=xml
47+
run: uv run pytest tests/unit --cov=logprep --cov-report=xml
5348
- name: Upload coverage reports to Codecov with GitHub Action
5449
uses: codecov/codecov-action@v5
5550
with:

.github/workflows/container-build.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
matrix:
1919
python-version: ["3.11", "3.12", "3.13", "3.14"]
2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v6
2222
with:
2323
fetch-depth: 0
2424
- name: Set up SSH
@@ -75,7 +75,6 @@ jobs:
7575
context: .
7676
push: true
7777
build-args: |
78-
LOGPREP_VERSION=${{ inputs.build-version }}
7978
PYTHON_VERSION=${{ matrix.python-version }}
8079
tags: ${{ steps.image-tag.outputs.tags }}
8180
platforms: "linux/arm64,linux/amd64"

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: Checkout
19-
uses: actions/checkout@v3
19+
uses: actions/checkout@v6
2020
with:
2121
fetch-depth: 0
2222
ref: main

.github/workflows/publish-latest-dev-release-to-github.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
name: create and publish
1010
if: github.event.pull_request.merged == true
1111
steps:
12-
- uses: actions/checkout@v4
12+
- uses: actions/checkout@v6
1313
- name: Initialize Python
1414
uses: actions/setup-python@v1
1515
with:

.github/workflows/publish-release-to-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
name: Build Logprep
99
steps:
10-
- uses: actions/checkout@v4
10+
- uses: actions/checkout@v6
1111
- name: Initialize Python
1212
uses: actions/setup-python@v1
1313
with:

.github/workflows/push-mirror.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
name: Push mirror
2-
32
on:
43
push:
5-
branches: [ '**' ]
6-
4+
branches: ['**']
75
jobs:
86
push:
97
runs-on: ubuntu-latest
10-
118
steps:
12-
- uses: actions/checkout@v2
9+
- uses: actions/checkout@v6
1310
with:
1411
fetch-depth: 0
15-
1612
- name: mirror-repository
1713
uses: ppcad/mirror-action@v0.4.5
1814
with:

.github/workflows/testing.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
rust:
66
runs-on: ubuntu-24.04
77
steps:
8-
- uses: actions/checkout@v4
8+
- uses: actions/checkout@v6
99
- name: Perform tests for rust modules
1010
run: cargo test
1111
python:
@@ -16,23 +16,19 @@ jobs:
1616
python-version: ["3.11", "3.12", "3.13", "3.14"]
1717
test-type: ["unit", "acceptance"]
1818
steps:
19-
- uses: actions/checkout@v4
20-
- name: Set up Python
21-
uses: actions/setup-python@v5
19+
- uses: actions/checkout@v6
20+
- name: Install uv and set the Python version
21+
uses: astral-sh/setup-uv@v7
2222
with:
2323
python-version: ${{ matrix.python-version }}
24-
cache: "pip"
2524
- name: Install helm
2625
uses: azure/setup-helm@v4.2.0
2726
with:
2827
version: "latest"
2928
id: install
3029
- name: Install dependencies
31-
run: |
32-
pip install --upgrade pip wheel
33-
pip install .[dev]
30+
run: uv sync --frozen --extra dev
3431
- name: Perform ${{ matrix.test-type }} test
3532
env:
3633
PYTEST_ADDOPTS: "--color=yes"
37-
run: |
38-
pytest -vv tests/${{ matrix.test-type }}
34+
run: uv run pytest -vv tests/${{ matrix.test-type }}

0 commit comments

Comments
 (0)