diff --git a/README.md b/README.md index 84ae40a..74a3b74 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ Then add the extension to your project: # settings.py COMPONENTS = { "extensions": [ - "djc_ext_pydantic.PydanticExtension", + "djc_pydantic.PydanticExtension", ], } ``` @@ -109,7 +109,7 @@ or by reference: ```python # settings.py -from djc_ext_pydantic import PydanticExtension +from djc_pydantic import PydanticExtension COMPONENTS = { "extensions": [ diff --git a/pyproject.toml b/pyproject.toml index 2f741a4..5c2a0f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,8 +44,8 @@ Homepage = "https://github.com/django-components/djc-ext-pydantic/" [tool.setuptools.packages.find] where = ["src"] -include = ["djc_ext_pydantic*"] -exclude = ["djc_ext_pydantic.tests*"] +include = ["djc_pydantic*"] +exclude = ["djc_pydantic.tests*"] namespaces = false [tool.black] @@ -71,7 +71,7 @@ profile = "black" line_length = 119 multi_line_output = 3 include_trailing_comma = "True" -known_first_party = "djc_ext_pydantic" +known_first_party = "djc_pydantic" [tool.flake8] ignore = ['E302', 'W503'] @@ -93,7 +93,7 @@ exclude = [ ] [[tool.mypy.overrides]] -module = "djc_ext_pydantic.*" +module = "djc_pydantic.*" disallow_untyped_defs = true diff --git a/src/djc_ext_pydantic/__init__.py b/src/djc_ext_pydantic/__init__.py deleted file mode 100644 index fc17c2a..0000000 --- a/src/djc_ext_pydantic/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -from djc_ext_pydantic.monkeypatch import monkeypatch_pydantic_core_schema -from djc_ext_pydantic.extension import PydanticExtension - - -monkeypatch_pydantic_core_schema() - -__all__ = [ - "PydanticExtension", -] diff --git a/src/djc_pydantic/__init__.py b/src/djc_pydantic/__init__.py new file mode 100644 index 0000000..f7a6c6b --- /dev/null +++ b/src/djc_pydantic/__init__.py @@ -0,0 +1,9 @@ +from djc_pydantic.monkeypatch import monkeypatch_pydantic_core_schema +from djc_pydantic.extension import PydanticExtension + + +monkeypatch_pydantic_core_schema() + +__all__ = [ + "PydanticExtension", +] diff --git a/src/djc_ext_pydantic/extension.py b/src/djc_pydantic/extension.py similarity index 97% rename from src/djc_ext_pydantic/extension.py rename to src/djc_pydantic/extension.py index ce03be5..5bee3cb 100644 --- a/src/djc_ext_pydantic/extension.py +++ b/src/djc_pydantic/extension.py @@ -4,7 +4,7 @@ OnComponentDataContext, ) -from djc_ext_pydantic.validation import get_component_typing, validate_type +from djc_pydantic.validation import get_component_typing, validate_type class PydanticExtension(ComponentExtension): diff --git a/src/djc_ext_pydantic/monkeypatch.py b/src/djc_pydantic/monkeypatch.py similarity index 100% rename from src/djc_ext_pydantic/monkeypatch.py rename to src/djc_pydantic/monkeypatch.py diff --git a/src/djc_pydantic/py.typed b/src/djc_pydantic/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/src/djc_ext_pydantic/validation.py b/src/djc_pydantic/validation.py similarity index 100% rename from src/djc_ext_pydantic/validation.py rename to src/djc_pydantic/validation.py diff --git a/tests/test_validation.py b/tests/test_validation.py index 2176a03..cde1b58 100644 --- a/tests/test_validation.py +++ b/tests/test_validation.py @@ -6,7 +6,7 @@ # from pydantic import ValidationError # TODO: Set more specific error message from typing_extensions import TypedDict -from djc_ext_pydantic.extension import PydanticExtension +from djc_pydantic.extension import PydanticExtension from tests.testutils import setup_test_config setup_test_config() diff --git a/tox.ini b/tox.ini index 4f901c2..8a7941a 100644 --- a/tox.ini +++ b/tox.ini @@ -40,7 +40,7 @@ commands = flake8 . [testenv:isort] deps = isort -commands = isort --check-only --diff src/djc_ext_pydantic +commands = isort --check-only --diff src/djc_pydantic [testenv:coverage] deps = @@ -49,7 +49,7 @@ deps = pytest-asyncio syrupy # snapshot testing commands = - pytest --cov=djc_ext_pydantic --cov-fail-under=87 --cov-branch + pytest --cov=djc_pydantic --cov-fail-under=87 --cov-branch [testenv:mypy] deps = @@ -58,4 +58,4 @@ commands = mypy . [testenv:black] deps = black -commands = black --check src/djc_ext_pydantic +commands = black --check src/djc_pydantic