-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X
Description
Checks
- I added a descriptive title to this issue
- I have searched (google, github) for similar issues and couldn't find anything
- I have read and followed the docs and still think this is a bug
Bug
Numpy dtype support breaks between pydantic versions:
-version = "1.7.3"
+version = "1.8.1"
$ poetry show pydantic
name : pydantic
version : 1.8.1
description : Data validation and settings management using python 3.6 type hinting
dependencies
- python-dotenv >=0.10.4
- typing-extensions >=3.7.4.3
$ poetry show numpy
name : numpy
version : 1.20.1
description : NumPy is the fundamental package for array computing with Python.
Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":
$ python -c "import pydantic.utils; print(pydantic.utils.version_info())"
pydantic version: 1.8.1
pydantic compiled: True
install path: /opt/conda/envs/jupiter-gis/lib/python3.7/site-packages/pydantic
python version: 3.7.10 | packaged by conda-forge | (default, Feb 19 2021, 16:07:37) [GCC 9.3.0]
platform: Linux-4.15.0-136-generic-x86_64-with-debian-buster-sid
optional deps. installed: ['dotenv', 'typing-extensions']
import pydantic
import numpy as np
class Bin(BaseModel):
lower: float
upper: float
dtype: np.dtype = Field(default=np.dtype("uint8"))
class Config:
allow_mutation = False
# this is required for numpy.dtype
arbitrary_types_allowed = TrueWhile loading pytest root conftest.py there is an error on import like:
pydantic/fields.py:249: in pydantic.fields.Field
???
pydantic/fields.py:172: in pydantic.fields.FieldInfo._validate
???
E TypeError: Cannot interpret 'PydanticUndefined' as a data type
Metadata
Metadata
Assignees
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X