Skip to content
Closed
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
14 changes: 9 additions & 5 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,26 @@ jobs:
python: ['3.13', '3.14', '3.15']
env:
UV_LOCKED: '1'
UV_CACHE_DIR: /home/runner/.cache/uv
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
python-version: ${{ matrix.python }}
enable-cache: true
cache-python: true
cache-suffix: python-${{ matrix.python }}
enable-cache: false
# One cache with a fallback, so a lockfile change keeps the venv and the locally built wheels (Python 3.15 builds several
# dependencies from source) instead of starting over.
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
.venv
.mypy_cache
key: python-${{ matrix.python }}-venv-${{ hashFiles('uv.lock') }}
/home/runner/.cache/uv
key: python-${{ matrix.python }}-deps-${{ hashFiles('uv.lock') }}
restore-keys: |
python-${{ matrix.python }}-venv-
python-${{ matrix.python }}-deps-
- name: Install Task
uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
with:
Expand All @@ -51,6 +53,8 @@ jobs:
run: task test
- name: Build
run: uv build
- name: Prune the uv cache
run: uv cache prune --ci

infra-scan:
name: Scan with KICS
Expand Down
21 changes: 14 additions & 7 deletions tests/package_contract/test_packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import shutil
import subprocess
import sys
from pathlib import Path
from zipfile import ZipFile

Expand All @@ -26,15 +27,21 @@ def test_wheel_contains_py_typed(tmp_path: Path) -> None:
with ZipFile(wheels[0]) as wheel:
assert "digintlab_langfuse/py.typed" in wheel.namelist()

constraints = tmp_path / "constraints.txt"
venv_dir = tmp_path / "venv"
setup_commands = (
# Pin the clean install to uv.lock so it reuses cached builds instead of resolving and compiling the newest releases.
[uv, "export", "--locked", "--no-dev", "--no-emit-project", "--no-hashes", "--no-header", "--output-file", str(constraints)],
[uv, "venv", "--python", sys.executable, str(venv_dir)],
[uv, "pip", "install", "--python", str(venv_dir), "--constraint", str(constraints), str(wheels[0])],
)
for command in setup_commands:
setup_result = subprocess.run(command, cwd=repo_root, text=True, capture_output=True, check=False) # noqa: S603
assert setup_result.returncode == 0, setup_result.stdout + setup_result.stderr

import_result = subprocess.run( # noqa: S603
[
uv,
"run",
"--isolated",
"--no-project",
"--with",
str(wheels[0]),
"python",
str(venv_dir / "bin" / "python"),
"-c",
(
"import digintlab_langfuse\n"
Expand Down
Loading