fix after pydantic update, pin dependencies
This commit is contained in:
@ -1,3 +1,9 @@
|
||||
# 0.9.5
|
||||
|
||||
## Fixes
|
||||
* Fix creation of `pydantic` FieldInfo after update of `pydantic` to version >=1.8
|
||||
* Pin required dependency versions to avoid such situations in the future
|
||||
|
||||
# 0.9.4
|
||||
|
||||
## Fixes
|
||||
|
||||
@ -68,7 +68,7 @@ class UndefinedType: # pragma no cover
|
||||
|
||||
Undefined = UndefinedType()
|
||||
|
||||
__version__ = "0.9.4"
|
||||
__version__ = "0.9.5"
|
||||
__all__ = [
|
||||
"Integer",
|
||||
"BigInteger",
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import inspect
|
||||
from typing import Any, List, Optional, TYPE_CHECKING, Type, Union
|
||||
|
||||
import sqlalchemy
|
||||
@ -89,9 +90,10 @@ class BaseField(FieldInfo):
|
||||
:rtype: bool
|
||||
"""
|
||||
return (
|
||||
field_name not in ["default", "default_factory", "alias"]
|
||||
field_name not in ["default", "default_factory", "alias", "allow_mutation"]
|
||||
and not field_name.startswith("__")
|
||||
and hasattr(cls, field_name)
|
||||
and not callable(getattr(cls, field_name))
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
||||
@ -97,7 +97,7 @@ def populate_pydantic_default_values(attrs: Dict) -> Tuple[Dict, Dict]:
|
||||
BaseField class.
|
||||
|
||||
Trigger conversion of ormar field into pydantic FieldInfo, which has all needed
|
||||
paramaters saved.
|
||||
parameters saved.
|
||||
|
||||
Overwrites the annotations of ormar fields to corresponding types declared on
|
||||
ormar fields (constructed dynamically for relations).
|
||||
|
||||
8
setup.py
8
setup.py
@ -45,15 +45,19 @@ setup(
|
||||
description="A simple async ORM with fastapi in mind and pydantic validation.",
|
||||
long_description=get_long_description(),
|
||||
long_description_content_type="text/markdown",
|
||||
keywords=['orm', 'sqlalchemy', 'fastapi', 'pydantic', 'databases', 'async', 'alembic'],
|
||||
keywords=['orm', 'sqlalchemy', 'fastapi', 'pydantic', 'databases', 'async',
|
||||
'alembic'],
|
||||
author="Radosław Drążkiewicz",
|
||||
author_email="collerek@gmail.com",
|
||||
packages=get_packages(PACKAGE),
|
||||
package_data={PACKAGE: ["py.typed"]},
|
||||
include_package_data=True,
|
||||
zip_safe=False,
|
||||
python_requires=">=3.6",
|
||||
data_files=[("", ["LICENSE.md"])],
|
||||
install_requires=["databases", "pydantic>=1.5", "sqlalchemy", "typing_extensions"],
|
||||
install_requires=["databases>=0.3.2,<=0.4.1", "pydantic>=1.6.1,<=1.8",
|
||||
"sqlalchemy>=1.3.18,<=1.3.23",
|
||||
"typing_extensions>=3.7,<=3.7.4.3"],
|
||||
extras_require={
|
||||
"postgresql": ["asyncpg", "psycopg2"],
|
||||
"mysql": ["aiomysql", "pymysql"],
|
||||
|
||||
@ -22,7 +22,7 @@ uuid1 = uuid.uuid4()
|
||||
uuid2 = uuid.uuid4()
|
||||
|
||||
|
||||
class TestEnum(Enum):
|
||||
class EnumTest(Enum):
|
||||
val1 = "Val1"
|
||||
val2 = "Val2"
|
||||
|
||||
@ -56,7 +56,7 @@ class Organisation(ormar.Model):
|
||||
)
|
||||
random_json: pydantic.Json = ormar.JSON(choices=["aa", '{"aa":"bb"}'])
|
||||
random_uuid: uuid.UUID = ormar.UUID(choices=[uuid1, uuid2])
|
||||
enum_string: str = ormar.String(max_length=100, choices=list(TestEnum))
|
||||
enum_string: str = ormar.String(max_length=100, choices=list(EnumTest))
|
||||
|
||||
|
||||
@app.on_event("startup")
|
||||
@ -110,7 +110,7 @@ def test_all_endpoints():
|
||||
"random_decimal": 12.4,
|
||||
"random_json": '{"aa":"bb"}',
|
||||
"random_uuid": str(uuid1),
|
||||
"enum_string": TestEnum.val1.value,
|
||||
"enum_string": EnumTest.val1.value,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user