You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

erdantic

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

erdantic - pypi Package Compare versions

Comparing version
1.0.3
to
1.0.4
+2
-14
erdantic/core.py

@@ -9,12 +9,4 @@ from enum import Enum

import textwrap
from typing import Any, Dict, Generic, Mapping, Optional, Type, TypeVar, Union
from typing import Any, Dict, Generic, Mapping, Optional, Type, TypeVar, Union, get_args
if sys.version_info >= (3, 9):
from typing import Annotated, get_args, get_origin
else:
# Annotated added in Python 3.9. typing's get_args and get_origin behave weirdly with
# so need to use typing_extensions version
from typing_extensions import Annotated, get_args, get_origin
if sys.version_info >= (3, 11):

@@ -146,7 +138,3 @@ from typing import Self

"""
if get_origin(raw_type) is Annotated:
# Drop the Annotated extra metadata for the string representation
type_name = typenames(get_args(raw_type)[0], remove_modules=REMOVE_ALL_MODULES)
else:
type_name = typenames(raw_type, remove_modules=REMOVE_ALL_MODULES)
type_name = typenames(raw_type, remove_modules=REMOVE_ALL_MODULES)
field_info = cls(

@@ -153,0 +141,0 @@ model_full_name=model_full_name,

+4
-0
# erdantic Changelog
## v1.0.4 (2024-07-16)
- Fixed handling of `typing.Annotated` in cases where it's not the outermost generic type. ([Issue #122](https://github.com/drivendataorg/erdantic/issues/122), [PR #123](https://github.com/drivendataorg/erdantic/pull/123))
## v1.0.3 (2024-05-10)

@@ -4,0 +8,0 @@

Metadata-Version: 2.3
Name: erdantic
Version: 1.0.3
Version: 1.0.4
Summary: Entity relationship diagrams for Python data model classes like Pydantic.

@@ -31,3 +31,3 @@ Project-URL: Repository, https://github.com/drivendataorg/erdantic

Requires-Dist: sortedcontainers-pydantic
Requires-Dist: typenames
Requires-Dist: typenames>=1.3
Requires-Dist: typer

@@ -34,0 +34,0 @@ Requires-Dist: typing-extensions>4; python_version < '3.12'

@@ -7,3 +7,3 @@ [build-system]

name = "erdantic"
version = "1.0.3"
version = "1.0.4"
description = "Entity relationship diagrams for Python data model classes like Pydantic."

@@ -34,3 +34,3 @@ readme = "README.md"

"sortedcontainers-pydantic",
"typenames",
"typenames >= 1.3",
"typer",

@@ -37,0 +37,0 @@ "typing_extensions>4 ; python_version < '3.12'",

@@ -90,3 +90,17 @@ import builtins

tp = Annotated[str, object()]
field_info = FieldInfo.from_raw_type(
model_full_name=FullyQualifiedName.from_object(DummyModel), name="dummy", raw_type=tp
)
assert field_info.type_name == "str"
assert field_info.raw_type == tp
tp = Optional[Annotated[str, object()]]
field_info = FieldInfo.from_raw_type(
model_full_name=FullyQualifiedName.from_object(DummyModel), name="dummy", raw_type=tp
)
assert field_info.type_name == "Optional[str]"
assert field_info.raw_type == tp
def test_field_not_found_error():

@@ -93,0 +107,0 @@ """A FieldInfo for a model field that does not exist should error if trying to get the raw