Skip to content

Commit ec78894

Browse files
Adopting prek over pre-commit, setup-uv's python-version (#1098)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
1 parent 3db7bf4 commit ec78894

4 files changed

Lines changed: 37 additions & 74 deletions

File tree

.github/workflows/tests.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ jobs:
2323
- uses: astral-sh/setup-uv@v6
2424
with:
2525
enable-cache: true
26-
- run: echo "UV_PROJECT_ENVIRONMENT=$(python -c "import sysconfig; print(sysconfig.get_config_var('prefix'))")" >> $GITHUB_ENV
27-
- run: uv python pin ${{ matrix.python-version }} # uv requires .python-version to match OS Python: https://github.com/astral-sh/uv/issues/11389
28-
- run: uv sync --python-preference only-system
29-
- run: git checkout .python-version # For clean git diff given `pre-commit run --show-diff-on-failure`
30-
- uses: pre-commit/action@v3.0.1
26+
python-version: ${{ matrix.python-version }}
27+
activate-environment: true # Activate for simple `uv sync` below
28+
- run: uv sync
29+
- uses: j178/prek-action@v1
3130
- uses: pre-commit-ci/lite-action@v1.1.0
3231
if: always()
3332
lint:
@@ -40,7 +39,9 @@ jobs:
4039
- uses: astral-sh/setup-uv@v6
4140
with:
4241
enable-cache: true
43-
- run: uv python pin ${{ matrix.python-version }}
42+
python-version: ${{ matrix.python-version }}
43+
- name: Unset UV_PYTHON for BAIPP # SEE: https://github.com/hynek/build-and-inspect-python-package/issues/180
44+
run: echo "UV_PYTHON=" >> "$GITHUB_ENV"
4445
- name: Check paper-qa-pymupdf build
4546
id: build-paper-qa-pymupdf
4647
if: matrix.python-version == '3.11'
@@ -70,7 +71,9 @@ jobs:
7071
- name: Clean up paper-qa build # Work around https://github.com/hynek/build-and-inspect-python-package/issues/174
7172
if: matrix.python-version == '3.11'
7273
run: rm -r ${{ steps.build-paper-qa.outputs.dist }}
73-
- run: uv sync --python-preference=only-managed
74+
- name: Reset UV_PYTHON after BAIPP # SEE: https://github.com/hynek/build-and-inspect-python-package/issues/180
75+
run: echo "UV_PYTHON=${{ matrix.python-version }}" >> "$GITHUB_ENV"
76+
- run: uv sync
7477
- run: uv run pylint src packages
7578
- uses: suzuki-shunsuke/github-action-renovate-config-validator@v1.1.1
7679
test:
@@ -83,8 +86,8 @@ jobs:
8386
- uses: astral-sh/setup-uv@v6
8487
with:
8588
enable-cache: true
86-
- run: uv python pin ${{ matrix.python-version }}
87-
- run: uv sync --python-preference=only-managed
89+
python-version: ${{ matrix.python-version }}
90+
- run: uv sync
8891
- run: uv run pytest -n auto
8992
env:
9093
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,6 @@ repos:
9393
hooks:
9494
- id: mypy
9595
name: mypy
96-
entry: mypy
96+
entry: uv run --frozen mypy # Use --frozen to avoid mutating local venv
9797
language: system
9898
types_or: [python, pyi]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ dev = [
6262
"litellm>=1.71", # Lower pin for aiohttp transport adoption
6363
"mypy>=1.8", # Pin for mutable-override
6464
"paper-qa[image,ldp,memory,pypdf-media,pymupdf,typing,zotero,local,qdrant]",
65-
"pre-commit>=3.4", # Pin to keep recent
65+
"prek",
6666
"pydantic~=2.11", # Pin for start of model_fields deprecation
6767
"pylint-pydantic",
6868
"pytest-asyncio",

uv.lock

Lines changed: 23 additions & 63 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)