Skip to content

Commit

Permalink
dev updates (#41)
Browse files Browse the repository at this point in the history
* dev updates

* github actions updates

* GA 3.12

* unused type ignore

* wip
  • Loading branch information
keithasaurus authored Mar 1, 2024
1 parent 6c9d48b commit 0703958
Show file tree
Hide file tree
Showing 7 changed files with 971 additions and 1,040 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.12.0-rc.3', '3.11', '3.10', '3.9', '3.8']
poetry-version: [1.3.2]
os: [ubuntu-20.04, macos-latest, windows-latest]
python-version: ['3.12', '3.11', '3.10', '3.9', '3.8']
poetry-version: [1.8]
os: [ubuntu-22.04, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand All @@ -27,7 +27,7 @@ jobs:
# exclude examples in CI because some 3.10 features are used
run: poetry run mypy . --exclude examples --exclude tests/test_310_plus.py --exclude tests/test_311_plus.py --exclude tests/test_39_plus.py
- name: mypy 3.11
if: matrix.python-version == 3.11 || matrix.python-version == '3.12.0-rc.3'
if: matrix.python-version == 3.11 || matrix.python-version == 3.12
run: poetry run mypy .
- name: mypy 3.10
if: matrix.python-version == 3.10
Expand All @@ -38,8 +38,8 @@ jobs:
- name: run 3.10 tests
if: matrix.python-version == 3.10
run: poetry run pytest --ignore tests/test_311_plus.py
- name: run 3.11/'3.12.0-rc.3' tests
if: matrix.python-version == 3.11 || matrix.python-version == '3.12.0-rc.3'
- name: run 3.11/3.12 tests
if: matrix.python-version == 3.11 || matrix.python-version == 3.12
run: poetry run pytest --ignore tests/test_311_plus.py
- name: run all examples
if: matrix.python-version == 3.10
Expand All @@ -48,12 +48,12 @@ jobs:
if: matrix.python-version == 3.9 || matrix.python-version == 3.8 || matrix.python-version == 'pypy3.9'
run: poetry run flake8 --exclude codegen,bench,examples,tests/test_310_plus.py,tests/test_311_plus.py --ignore E721,E741,W503,F405,F403,F401
- name: linting 3.10+
if: matrix.python-version == 3.10 || matrix.python-version == 3.11 || matrix.python-version == '3.12.0-rc.3'
if: matrix.python-version == 3.10 || matrix.python-version == 3.11 || matrix.python-version == 3.12
run: poetry run flake8 --exclude codegen --ignore E721,E741,W503,F405,F403,F401,DAR101,DAR201,DAR401
- name: darglint
run: poetry run darglint koda_validate
- name: doctests
if: matrix.python-version == 3.10 || matrix.python-version == 3.11 || matrix.python-version == '3.12.0-rc.3'
if: matrix.python-version == 3.10 || matrix.python-version == 3.11 || matrix.python-version == 3.12
run: cd docs && poetry run make doctest
- name: benchmarks
run: poetry run python -m bench.run
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from django.test import AsyncClient # type: ignore[attr-defined]
from django.test import AsyncClient


@pytest.mark.asyncio
Expand Down
4 changes: 3 additions & 1 deletion koda_validate/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ class TypeErr:
KeyErrs,
MapErr,
MissingKeyErr,
PredicateErrs,
# This seems like a type exception worth making..., but that might change in the
# future. This is backwards compatible with existing code
PredicateErrs[Any],
SetErrs,
TypeErr,
ValidationErrBase,
Expand Down
6 changes: 4 additions & 2 deletions koda_validate/signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,13 @@ def validate_signature(
if func is None:

def inner(func_inner: _DecoratedFunc) -> _DecoratedFunc:
return _wrap_fn_partial(func_inner)
# there may be a good way to replace this cast with ParamSpec in the future
return cast(_DecoratedFunc, _wrap_fn_partial(func_inner))

return inner
else:
return _wrap_fn_partial(func)
# there may be a good way to replace this cast with ParamSpec in the future
return cast(_DecoratedFunc, _wrap_fn_partial(func))


def _trunc_str(s: str, max_chars: int) -> str:
Expand Down
2 changes: 1 addition & 1 deletion koda_validate/union.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def typed(
]
if v
]
return UnionValidator(validator_1, *validators) # type: ignore
return UnionValidator(validator_1, *validators)

@staticmethod
def untyped(
Expand Down
Loading

0 comments on commit 0703958

Please sign in to comment.