generated from daniil-berg/boilerplate-py
Compare commits
No commits in common. "3f0e3db427bd2ebdafeb960d2b5f996cd9cb5b5f" and "0e443f08b9ca6336e2cf3712dfa220a50d0f6c73" have entirely different histories.
3f0e3db427
...
0e443f08b9
25
.github/workflows/ci.yaml
vendored
25
.github/workflows/ci.yaml
vendored
@ -2,15 +2,17 @@ name: CI
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: master
|
branches:
|
||||||
tags: 'v*.*.*'
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test-and-check:
|
||||||
name: Test
|
name: Tests and checks
|
||||||
uses: daniil-berg/reusable-workflows/.github/workflows/python-test.yaml@v0.2.1
|
uses: daniil-berg/reusable-workflows/.github/workflows/python-test.yaml@v0.0.1
|
||||||
with:
|
with:
|
||||||
versions: '["3.9", "3.10", "3.11"]'
|
versions: '["3.9", "3.10", "3.11"]'
|
||||||
|
cache: pip
|
||||||
|
cache-dependency-path: pyproject.toml
|
||||||
unittest-command: 'scripts/test.sh'
|
unittest-command: 'scripts/test.sh'
|
||||||
coverage-command: 'scripts/cov.sh'
|
coverage-command: 'scripts/cov.sh'
|
||||||
unittest-requirements: "-e '.[dev]'"
|
unittest-requirements: "-e '.[dev]'"
|
||||||
@ -19,16 +21,3 @@ jobs:
|
|||||||
typecheck-all-versions: true
|
typecheck-all-versions: true
|
||||||
lint-command: 'scripts/lint.sh'
|
lint-command: 'scripts/lint.sh'
|
||||||
lint-requirements: '-Ur requirements/dev.txt'
|
lint-requirements: '-Ur requirements/dev.txt'
|
||||||
|
|
||||||
release:
|
|
||||||
name: Release
|
|
||||||
if: ${{ github.ref_type == 'tag' }}
|
|
||||||
needs: test
|
|
||||||
uses: daniil-berg/reusable-workflows/.github/workflows/python-release.yaml@v0.2.1
|
|
||||||
with:
|
|
||||||
git-ref: ${{ github.ref_name }}
|
|
||||||
secrets:
|
|
||||||
release-token: ${{ secrets.TOKEN_GITHUB_CREATE_RELEASE }}
|
|
||||||
publish-token: ${{ secrets.TOKEN_PYPI_PROJECT }}
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
@ -37,15 +37,18 @@ dynamic = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
|
full = [
|
||||||
|
|
||||||
|
]
|
||||||
dev = [
|
dev = [
|
||||||
"black==23.3.0",
|
"black",
|
||||||
"build==0.10.0",
|
"build",
|
||||||
"coverage[toml]==7.2.3",
|
"coverage[toml]",
|
||||||
"isort==5.12.0",
|
"isort",
|
||||||
"mkdocs-material==9.1.6",
|
"mkdocs-material",
|
||||||
"mkdocstrings[python]==0.21.2",
|
"mkdocstrings[python]",
|
||||||
"mypy==1.2.0",
|
"mypy",
|
||||||
"ruff==0.0.262",
|
"ruff",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
|
@ -1 +1 @@
|
|||||||
marshmallow>=3.12.0
|
marshmallow
|
@ -1,9 +1,9 @@
|
|||||||
-r common.txt
|
-r common.txt
|
||||||
black==23.3.0
|
black
|
||||||
build==0.10.0
|
build
|
||||||
coverage[toml]==7.2.3
|
coverage[toml]
|
||||||
isort==5.12.0
|
isort
|
||||||
mkdocs-material==9.1.6
|
mkdocs-material
|
||||||
mkdocstrings[python]==0.21.2
|
mkdocstrings[python]
|
||||||
mypy==1.2.0
|
mypy
|
||||||
ruff==0.0.262
|
ruff
|
||||||
|
@ -16,11 +16,6 @@ from .decorators import post_load
|
|||||||
|
|
||||||
Model = TypeVar("Model")
|
Model = TypeVar("Model")
|
||||||
|
|
||||||
MANY_SCHEMA_UNSAFE = (
|
|
||||||
"Changing `many` schema-wide breaks type safety. "
|
|
||||||
"Use the the `many` parameter of specific methods (like `load`) instead."
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class GenericSchema(GenericInsightMixin1[Model], Schema):
|
class GenericSchema(GenericInsightMixin1[Model], Schema):
|
||||||
"""
|
"""
|
||||||
@ -105,7 +100,6 @@ class GenericSchema(GenericInsightMixin1[Model], Schema):
|
|||||||
[`load`][marshmallow_generic.GenericSchema.load]/
|
[`load`][marshmallow_generic.GenericSchema.load]/
|
||||||
[`loads`][marshmallow_generic.GenericSchema.loads].
|
[`loads`][marshmallow_generic.GenericSchema.loads].
|
||||||
"""
|
"""
|
||||||
self._pre_init = True
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
only=only,
|
only=only,
|
||||||
exclude=exclude,
|
exclude=exclude,
|
||||||
@ -116,7 +110,6 @@ class GenericSchema(GenericInsightMixin1[Model], Schema):
|
|||||||
partial=partial,
|
partial=partial,
|
||||||
unknown=unknown,
|
unknown=unknown,
|
||||||
)
|
)
|
||||||
self._pre_init = False
|
|
||||||
|
|
||||||
def __setattr__(self, name: str, value: Any) -> None:
|
def __setattr__(self, name: str, value: Any) -> None:
|
||||||
"""
|
"""
|
||||||
@ -126,7 +119,10 @@ class GenericSchema(GenericInsightMixin1[Model], Schema):
|
|||||||
[`object.__setattr__`](https://docs.python.org/3/reference/datamodel.html#object.__setattr__).
|
[`object.__setattr__`](https://docs.python.org/3/reference/datamodel.html#object.__setattr__).
|
||||||
"""
|
"""
|
||||||
if name == "many" and value is not False:
|
if name == "many" and value is not False:
|
||||||
warn(MANY_SCHEMA_UNSAFE, stacklevel=4 if self._pre_init else 2)
|
warn(
|
||||||
|
"Changing `many` schema-wide breaks type safety. Use the the "
|
||||||
|
"`many` parameter of specific methods (like `load`) instead."
|
||||||
|
)
|
||||||
super().__setattr__(name, value)
|
super().__setattr__(name, value)
|
||||||
|
|
||||||
@post_load
|
@post_load
|
||||||
|
Loading…
x
Reference in New Issue
Block a user