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

fix imports #603

Merged
merged 2 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ dependencies = [
"jsonpatch>=1.33",
"openai>=0.27.8",
"pydantic[dotenv]>=1.10.7",
"pydantic-settings>=2.0.0",
"rich>=12",
"tiktoken>=0.4.0",
"typer>=0.9.0",
Expand Down Expand Up @@ -49,6 +48,7 @@ tests = [
"pytest-rerunfailures>=10,<13",
"pytest-sugar~=0.9",
"pytest~=7.3.1",
"pydantic-settings>=2.0.0",
]
framework = [
"aiosqlite>=0.19.0",
Expand Down
8 changes: 6 additions & 2 deletions src/marvin/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@

if PYDANTIC_V2:
from pydantic.v1 import validate_arguments # noqa # type: ignore
from pydantic_settings import BaseSettings # noqa # type: ignore
from pydantic_settings import SettingsConfigDict # noqa # type: ignore

try:
from pydantic_settings import BaseSettings # noqa # type: ignore
from pydantic_settings import SettingsConfigDict # noqa # type: ignore
except Exception as e:
print('Please install "pydantic-settings" to marvin with Pydantic v2.', e)
from pydantic import field_validator # noqa # type: ignore

else:
Expand Down