Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed a dangling import which is causing the install to fail in v0.3.5 and v0.3.6 #60

Merged
merged 1 commit into from
Apr 1, 2024

Conversation

Abdullah0297445
Copy link
Contributor

Encountering the following error while installing django-pydantic-field v0.3.5 and v0.3.6

Traceback

[stderr] apps.populate(settings.INSTALLED_APPS)
[stderr] File "/usr/local/lib/python3.11/site-packages/django/apps/registry.py", line 116, in populate
[stderr] app_config.import_models()
[stderr] File "/usr/local/lib/python3.11/site-packages/django/apps/config.py", line 269, in import_models
[stderr] self.models_module = import_module(models_module_name)
[stderr] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[stderr] File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
[stderr] return _bootstrap._gcd_import(name[level:], package, level)
[stderr] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[stderr] File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
[stderr] File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
[stderr] File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
[stderr] File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
[stderr] File "<frozen importlib._bootstrap_external>", line 940, in exec_module
[stderr] File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
[stderr] File "/web/user_profiles/models.py", line 11, in <module>
[stderr] from django_pydantic_field import SchemaField
[stderr] File "/usr/local/lib/python3.11/site-packages/django_pydantic_field/__init__.py", line 1, in <module>
[stderr] from .fields import SchemaField as SchemaField
[stderr] File "/usr/local/lib/python3.11/site-packages/django_pydantic_field/fields.py", line 1, in <module>
[stderr] from .compat.imports import compat_dir, compat_getattr
[stderr] File "/usr/local/lib/python3.11/site-packages/django_pydantic_field/compat/__init__.py", line 1, in <module>
[stderr] from .django import GenericContainer as GenericContainer
[stderr] File "/usr/local/lib/python3.11/site-packages/django_pydantic_field/compat/django.py", line 38, in <module>
[stderr] from pydantic_core import PydanticUndefined
[stderr]ModuleNotFoundError: No module named 'pydantic_core'

The issue was an unhandled import. The removal of this import won't break anything because this import is already in a try catch block. Here:

from pydantic_core import PydanticUndefined
and here:
from pydantic.fields import Undefined as PydanticUndefined # type: ignore[attr-defined, no-redef]

@surenkov
Copy link
Owner

surenkov commented Apr 1, 2024

Abdullah, thank you for bringing this! I'll publish your patch asap.

Not sure how this could bypass the tests, will dig deeper into this.

@surenkov surenkov merged commit 2e590d8 into surenkov:master Apr 1, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants