-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
1,821 additions
and
690 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"site_package_search_strategy": "all", | ||
"source_directories": [ | ||
"." | ||
], | ||
"strict": true, | ||
"python_version": "3.12" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env python | ||
"""Pytest wrapper which instruments it with Beartype's type annotation checks. | ||
Why is this needed? | ||
------------------ | ||
Because if you run pytest with the pytest-beartype plugin with command: | ||
`pytest --beartype-packages='src,tests,automation,config'` | ||
it will emit the following type warning: | ||
``` | ||
BeartypePytestWarning: Previously imported packages "..." not checkable by beartype. | ||
``` | ||
This is because the Beartype plugin is not able to instrument the packages | ||
that are already imported somehow by pytest. | ||
Refs: | ||
- https://github.com/beartype/beartype/issues/322 | ||
- https://github.com/beartype/pytest-beartype/issues/3 | ||
So this wrapper script provides the workaround for this issue. | ||
""" | ||
|
||
import pytest | ||
from beartype import BeartypeConf | ||
from beartype.claw import beartype_package | ||
|
||
type_check_instrumented_packages: list[str] = ["superschema", "tests"] | ||
|
||
for package in type_check_instrumented_packages: | ||
beartype_package(package_name=package, conf=BeartypeConf()) | ||
|
||
|
||
# Run all tests in the current directory | ||
pytest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env python | ||
"""Pytest wrapper which instruments it with Typeguard's type annotation checks. | ||
Why is this needed? | ||
------------------ | ||
Because if you run pytest with the pytest-typeguard plugin with command: | ||
`pytest typeguard-packages=src,tests,automation,config` | ||
it will emit the following type warning: | ||
``` | ||
InstrumentationWarning: | ||
typeguard cannot check these packages because they are already imported: config, ... | ||
```` | ||
This is because the Typeguard plugin is not able to instrument the packages | ||
that are already imported somehow by pytest. | ||
So this wrapper script provides the workaround for this issue. | ||
""" | ||
|
||
import pytest | ||
from typeguard import install_import_hook | ||
|
||
type_check_instrumented_packages: list[str] = ["superschema", "tests"] | ||
|
||
install_import_hook(packages=type_check_instrumented_packages) | ||
|
||
# Run all tests in the current directory | ||
pytest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
"""Super schema packages.""" | ||
|
||
from superschema.schema import SuperSchema | ||
from superschema.types import Infer, InferExcept, MetaFields, ModelFields | ||
|
||
__all__ = ["Infer", "InferExcept", "ModelFields", "MetaFields"] | ||
__all__ = ["Infer", "InferExcept", "ModelFields", "MetaFields", "SuperSchema"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.