Skip to content
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
34 changes: 16 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@ jobs:
with:
python-version: "3.12"

- name: Install PDM
uses: pdm-project/setup-pdm@v3
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.12"

- name: Install dependencies
run: |
pdm sync --group dev
pdm list
uv sync
uv pip list

- name: Run Ruff check
run: pdm run ruff check
run: uv run ruff check

- name: Run Black check
run: pdm run black --check .
run: uv run black --check .

- name: Run tests (excluding OpenAI API test)
run: |
INFERENCE_API_TOKEN=dummy_token pdm run pytest -k "not test_receipt_analysis_with_chat"
INFERENCE_API_TOKEN=dummy_token uv run pytest -k "not test_receipt_analysis_with_chat"
env:
INFERENCE_API_TOKEN: dummy_token

Expand All @@ -60,29 +60,27 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install PDM
uses: pdm-project/setup-pdm@v3
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}

- name: Cache PDM dependencies
- name: Cache uv dependencies
uses: actions/cache@v3
with:
path: |
.pdm.toml
.venv
key: ${{ runner.os }}-pdm-${{ hashFiles('**/pdm.lock') }}
path: .venv
key: ${{ runner.os }}-uv-${{ hashFiles('**/uv.lock') }}
restore-keys: |
${{ runner.os }}-pdm-
${{ runner.os }}-uv-

- name: Install dependencies
run: |
pdm sync --group dev
pdm list
uv sync
uv pip list

- name: Run tests with coverage
run: |
INFERENCE_API_TOKEN=dummy_token pdm run pytest --cov=src --cov-report=xml --cov-report=term-missing
INFERENCE_API_TOKEN=dummy_token uv run pytest --cov=src --cov-report=xml --cov-report=term-missing
env:
INFERENCE_API_TOKEN: dummy_token

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/lint-format-write.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@ jobs:
with:
python-version: "3.12"

- name: Install PDM
uses: pdm-project/setup-pdm@v3
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.12"

- name: Install dependencies
run: |
pdm sync --group dev
pdm list
uv sync
uv pip list

- name: Configure Git
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"

- name: Run Ruff check and fix
run: pdm run ruff check --fix
run: uv run ruff check --fix

- name: Run Black formatting
run: pdm run black .
run: uv run black .

- name: Check for changes
id: check_changes
Expand Down
11 changes: 2 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,8 @@ ipython_config.py
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm-project.org/#use-with-ide
.pdm.toml
.pdm-python
.pdm-build/
# uv
.uv/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
Expand Down
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ RUN npx @tailwindcss/cli -i ./src/ui/static/input.css -o ./src/ui/static/output.

FROM python:$PYTHON_BASE AS builder

RUN pip install -U pdm
ENV PDM_CHECK_UPDATE=false
COPY pyproject.toml pdm.lock /bill/
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
Copy link

Choose a reason for hiding this comment

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

Unpinned uv image tag reduces Docker build reproducibility

Low Severity

Using ghcr.io/astral-sh/uv:latest copies an unpinned version of uv into the build. A new uv release could change dependency resolution behavior or introduce breaking changes, causing unexpected build failures or different dependency installations across builds. The uv Docker guide recommends pinning to a specific version tag.

Fix in Cursor Fix in Web

COPY pyproject.toml uv.lock /bill/

WORKDIR /bill
RUN pdm install --check --prod --no-editable
RUN uv sync --no-dev --no-editable
Copy link

Choose a reason for hiding this comment

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

Dockerfile missing --frozen flag for reproducible builds

Medium Severity

The uv sync command in the Dockerfile lacks a --frozen or --locked flag, replacing the safety check that PDM's --check flag provided. Without it, if uv.lock and pyproject.toml are out of sync, uv sync will silently re-resolve dependencies during the Docker build instead of failing, leading to non-reproducible production builds. The uv documentation recommends --frozen for Dockerfiles.

Fix in Cursor Fix in Web


FROM python:$PYTHON_BASE

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ It was developed as a personal learning project.
Adjust accordingly.

```shell
pdm sync
uv sync
nvm use # nvm use 22.13
npm install
```
Expand Down
Loading
Loading