Skip to content

Commit 28343d0

Browse files
committed
feat: ✨ Project setup updates
1 parent cdd0e06 commit 28343d0

File tree

16 files changed

+91
-89
lines changed

16 files changed

+91
-89
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ updates:
66
interval: "weekly"
77
assignees:
88
- "ddanier"
9-
- package-ecosystem: "pip"
9+
- package-ecosystem: "uv"
1010
directory: "/"
1111
schedule:
1212
interval: "weekly"

.github/workflows/lint.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs:
1212
- name: Set up Python
1313
uses: actions/setup-python@v6
1414
with:
15-
python-version: "3.x"
16-
- name: Install dependencies
17-
run: |
18-
python -m pip install --upgrade poetry
19-
poetry install -E fastapi
15+
python-version-file: ".python-version"
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v6
18+
- name: Install the dependencies
19+
run: uv sync --all-extras --dev
2020
- name: Lint with ruff & pyright
2121
run: |
22-
poetry run ruff check pydantic_async_validation tests
23-
poetry run pyright pydantic_async_validation
22+
uv run ruff check pydantic_async_validation tests
23+
uv run pyright pydantic_async_validation

.github/workflows/release.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,9 @@ jobs:
99
id-token: write
1010
steps:
1111
- uses: actions/checkout@v5
12-
- name: Set up Python
13-
uses: actions/setup-python@v6
14-
with:
15-
python-version: '3.x'
16-
- name: Install dependencies
17-
run: |
18-
python -m pip install --upgrade poetry
19-
poetry install
12+
- name: Install uv
13+
uses: astral-sh/setup-uv@v6
2014
- name: Build package
21-
run: poetry build
15+
run: uv build
2216
- name: Publish package
23-
uses: pypa/gh-action-pypi-publish@release/v1
24-
with:
25-
password: ${{ secrets.PYPI_API_TOKEN }}
17+
run: uv publish

.github/workflows/test.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,24 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
12+
python-version:
13+
- "3.10"
14+
- "3.11"
15+
- "3.12"
16+
- "3.13"
17+
1318
steps:
1419
- uses: actions/checkout@v5
15-
- name: Set up Python ${{ matrix.python-version }}
20+
- name: Set up Python
1621
uses: actions/setup-python@v6
1722
with:
1823
python-version: ${{ matrix.python-version }}
19-
- name: Install dependencies
20-
run: |
21-
python -m pip install --upgrade poetry
22-
poetry install -E fastapi
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v6
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
- name: Install the dependencies
29+
run: uv sync --all-extras --dev
2330
- name: Test with pytest
2431
run: |
25-
poetry run tox -e 'py'
32+
uv run tox -e 'py'

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/poetry.lock
1+
/uv.lock
22
/dist/*
33
/.coverage
44
/.tox

.pre-commit-config.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v5.0.0
3+
rev: v6.0.0
44
hooks:
55
- id: end-of-file-fixer
66
- id: check-added-large-files
77
- id: check-merge-conflict
88
- id: check-docstring-first
99
- id: debug-statements
1010
- repo: https://github.com/astral-sh/ruff-pre-commit
11-
rev: v0.12.2
11+
rev: v0.13.3
1212
hooks:
1313
- id: ruff
1414
args: [--fix, --exit-non-zero-on-fix]
15-
- repo: https://github.com/Lucas-C/pre-commit-hooks-safety
16-
rev: v1.4.2
17-
hooks:
18-
- id: python-safety-dependencies-check
1915
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
20-
rev: v9.22.0
16+
rev: v9.23.0
2117
hooks:
2218
- id: commitlint
2319
stages: [commit-msg]

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ yourself. This is due to the fact that `__init__()` will always be a sync method
88
methods from sync methods.
99

1010
**Note:** `pydantic-async-validation` is compatible with `pydantic` versions `2.x` only. It supports
11-
Python `3.8`, `3.9`, `3.10`, `3.11` and `3.12`. This is also ensured running all tests on all those versions
11+
Python `3.10`, `3.11`, `3.12` and `3.13`. This is also ensured running all tests on all those versions
1212
using `tox`.
1313

1414
## Example usage

justfile

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,26 @@ _install-pre-commit:
1919
#!powershell.exe
2020
Write-Host "Please ensure pre-commit hooks are installed using 'pre-commit install --install-hooks'"
2121

22-
install: (poetry "install" "-E" "fastapi") && _install-pre-commit
22+
install: (uv "sync" "--group" "dev") && _install-pre-commit
2323

24-
update: (poetry "install" "-E" "fastapi")
24+
update: (uv "sync" "--group" "dev")
2525

26-
poetry *args:
27-
poetry {{args}}
26+
uv *args:
27+
uv {{args}}
2828

29-
test *args: (poetry "run" "pytest" "--cov=pydantic_async_validation" "--cov-report" "term-missing:skip-covered" args)
29+
test *args: (uv "run" "pytest" "--cov=pydantic_async_validation" "--cov-report" "term-missing:skip-covered" args)
3030

31-
test-all: (poetry "run" "tox")
31+
test-all: (uv "run" "tox")
3232

33-
ruff *args: (poetry "run" "ruff" "check" "pydantic_async_validation" "tests" args)
33+
ruff *args: (uv "run" "ruff" "check" "pydantic_async_validation" "tests" args)
3434

35-
pyright *args: (poetry "run" "pyright" "pydantic_async_validation" args)
35+
pyright *args: (uv "run" "pyright" "pydantic_async_validation" args)
3636

3737
lint: ruff pyright
3838

39-
publish: (poetry "publish" "--build")
40-
41-
release version: (poetry "version" version)
39+
release version: (uv "version" version)
4240
git add pyproject.toml
43-
git commit -m "release: 🔖 v$(poetry version --short)" --no-verify
44-
git tag "v$(poetry version --short)"
41+
git commit -m "release: 🔖 v$(uv version --short)" --no-verify
42+
git tag "v$(uv version --short)"
4543
git push
4644
git push --tags

pydantic_async_validation/fastapi.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
from collections.abc import Generator
22
from contextlib import contextmanager
3-
from typing import Optional, Union
43

54
from fastapi.exceptions import RequestValidationError
65
from pydantic import ValidationError
76
from pydantic_core import ErrorDetails
87

98

109
def _prefix_request_errors(
11-
prefix: tuple[Union[int, str], ...],
10+
prefix: tuple[int | str, ...],
1211
errors: list[ErrorDetails],
1312
) -> list[ErrorDetails]:
1413
"""Add prefix to errors in preparation for request validation error conversion."""
@@ -26,7 +25,7 @@ def _prefix_request_errors(
2625

2726
@contextmanager
2827
def ensure_request_validation_errors(
29-
prefix: Optional[Union[tuple[Union[int, str], ...], str]] = None,
28+
prefix: tuple[int | str, ...] | str | None = None,
3029
) -> Generator[None, None, None]:
3130
"""
3231
Converter for `ValidationError` to `RequestValidationError`.

0 commit comments

Comments
 (0)