Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/python-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Python Tests

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
- name: Install test dependencies
run: uv sync --group test
- name: Test with pytest - ${{ matrix.python-version }}
run: uv run pytest -s --cov=. --cov-branch --cov-report=xml -v
# Please uncomment this if your organization uses Codecov test coverage!
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be reomved or do you plan to un comment that in the near future?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We enable it for repositories bit-by-bit so keeping it commented here makes sense for now.

# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v5
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/update-uv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: update-uv

on:
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v7

- run: |
echo "\`\`\`" > uv_output.md
uv lock --upgrade 2>&1 | tee -a uv_output.md
echo "\`\`\`" >> uv_output.md

- name: Create pull request
uses: peter-evans/create-pull-request@v7
with:
committer: hacktobeer <ramsesdebeer@gmail.com>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could that be ```
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That gives issues with the Google CLA github agreement thing.

token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update uv lockfile
title: Update uv lockfile
body-path: uv_output.md
branch: update-uv
base: main
labels: install
delete-branch: true
add-paths: uv.lock
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
25 changes: 13 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# Add your dependencies here
&& rm -rf /var/lib/apt/lists/*

# Configure poetry
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache

# Configure debugging
ARG OPENRELIK_PYDEBUG
ENV OPENRELIK_PYDEBUG=${OPENRELIK_PYDEBUG:-0}
Expand All @@ -30,16 +24,23 @@ WORKDIR /openrelik
RUN apt-get update && apt-get install -y libimage-exiftool-perl && \
rm -rf /var/lib/apt/lists/*

# Copy poetry toml and install dependencies
COPY ./pyproject.toml ./poetry.lock ./
RUN poetry install --no-interaction --no-ansi
# Install the latest uv binaries
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

# Copy poetry toml and uv.lock
COPY uv.lock pyproject.toml ./

# Install the project's dependencies using the lockfile and settings
RUN uv sync --locked --no-install-project --no-dev

# Copy files needed to build
COPY . ./

# Install the worker and set environment to use the correct python interpreter.
RUN poetry install && rm -rf $POETRY_CACHE_DIR
ENV VIRTUAL_ENV=/app/.venv PATH="/openrelik/.venv/bin:$PATH"
# Installing separately from its dependencies allows optimal layer caching
RUN uv sync --locked --no-dev

# Set PATH to use the virtual environment
ENV PATH="/openrelik/.venv/bin:$PATH"

# Default command if not run from docker-compose (and command being overidden)
CMD ["celery", "--app=src.tasks", "worker", "--task-events", "--concurrency=1", "--loglevel=INFO"]
750 changes: 0 additions & 750 deletions poetry.lock

This file was deleted.

36 changes: 21 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
[tool.poetry]
[project]
name = "openrelik-worker-exif"
version = "0.1.0"
description = "This worker should extract exif information from files"
authors = ["Alexander Jaeger <mail@alexanderjaeger.de>"]
authors = [{ name = "Alexander Jaeger", email = "mail@alexanderjaeger.de" }]
requires-python = ">=3.10,<4"
readme = "README.md"
package-mode = false

[tool.poetry.dependencies]
python = "^3.10"
celery = { extras = ["redis"], version = "^5.4.0" }
openrelik-worker-common = "^0.10.0"
dependencies = [
"celery[redis]>=5.4.0,<6",
"openrelik-worker-common>=0.10.0,<1.0.0",
]

[tool.poetry.group.test.dependencies]
pytest = "*"
pytest-cov = "^5.0.0"
pytest-mock = "^3.14.0"
Pillow = "^10.0.0" # For image creation
piexif = "^1.1.3" # For EXIF manipulation
[dependency-groups]
test = [
"pytest",
"pytest-cov>=5.0.0,<6",
"pytest-mock>=3.14.0,<4",
"Pillow>=10.0.0,<11",
"piexif>=1.1.3,<2",
]

[tool.uv]
package = false
default-groups = ["test"]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["uv_build>=0.9.0,<0.10.0"]
build-backend = "uv_build"
Loading