Skip to content

Commit

Permalink
Merge pull request #115 from elventear/fix-pydantic
Browse files Browse the repository at this point in the history
fix: handle missing pydantic-core corner case
  • Loading branch information
DanCardin committed May 10, 2024
2 parents 98a933d + 5de6984 commit ee024c2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 0.19

### 0.19.1

- fix: Eagerly attempt pydantic BaseModel import to ensure its skipped if unavailable.

### 0.19.0

- feat: Add support for `msgspec` based class definitions.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cappa"
version = "0.19.0"
version = "0.19.1"
description = "Declarative CLI argument parser."

repository = "https://github.com/dancardin/cappa"
Expand Down
5 changes: 2 additions & 3 deletions src/cappa/class_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,12 @@ def from_cls(cls, obj: type) -> ClassTypes | None:

try:
import pydantic
from pydantic import BaseModel
except ImportError: # pragma: no cover
pass
else:
try:
is_base_model = isinstance(obj, type) and issubclass(
obj, pydantic.BaseModel
)
is_base_model = isinstance(obj, type) and issubclass(obj, BaseModel)
except TypeError: # pragma: no cover
is_base_model = False

Expand Down

0 comments on commit ee024c2

Please sign in to comment.