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

Fixed imports to avoid pydantic if the version is >=2 #281

Merged

Conversation

evalott100
Copy link
Contributor

@evalott100 evalott100 commented Jul 5, 2023

Closes #280
Will now use dummy imports if the pydantic version is >= 2.0.0, not only if pydantic doesn't exist.

@evalott100 evalott100 self-assigned this Jul 5, 2023
@evalott100 evalott100 force-pushed the remove_import_pydantic_directly branch 2 times, most recently from 2ba5eab to c71443d Compare July 5, 2023 08:13
@evalott100 evalott100 requested a review from coretl July 5, 2023 08:13
@evalott100 evalott100 force-pushed the remove_import_pydantic_directly branch from c71443d to 3a6c8be Compare July 5, 2023 08:16
@DominicOram
Copy link

From the docs it looks like another option might be in v2 you can do from pydantic import v1 as pydantic, which might mean you can get it to work for both?

@evalott100 evalott100 force-pushed the remove_import_pydantic_directly branch 3 times, most recently from 89406a5 to a574d58 Compare July 5, 2023 10:24
@evalott100
Copy link
Contributor Author

From the docs it looks like another option might be in v2 you can do from pydantic import v1 as pydantic, which might mean you can get it to work for both?

I've used try except with v1 now, so the generation code will work with either.

@coretl
Copy link
Contributor

coretl commented Jul 5, 2023

From the docs it looks like another option might be in v2 you can do from pydantic import v1 as pydantic, which might mean you can get it to work for both?

I've used try except with v1 now, so the generation code will work with either.

But the upper cap is still in to stop pydantic < 2 being installed?

@evalott100 evalott100 force-pushed the remove_import_pydantic_directly branch from a574d58 to 04936d1 Compare July 5, 2023 12:21
@evalott100
Copy link
Contributor Author

From the docs it looks like another option might be in v2 you can do from pydantic import v1 as pydantic, which might mean you can get it to work for both?

I've used try except with v1 now, so the generation code will work with either.

But the upper cap is still in to stop pydantic < 2 being installed?

I think it's probably still good to pin pydantic<2 as a dev requirement since the generation code does require that version, the difference is that if event-model is installed as a requirement in an environment with pydantic 2 then the wrapper will use pydantic 1 instead.

@evalott100 evalott100 force-pushed the remove_import_pydantic_directly branch from 04936d1 to 2deace2 Compare July 5, 2023 12:30
@evalott100 evalott100 force-pushed the remove_import_pydantic_directly branch from 2deace2 to 9b8ed05 Compare July 5, 2023 14:01
@evalott100 evalott100 merged commit 2cbbf1e into bluesky:main Jul 5, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issues with pydantic v2
3 participants