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

Hotfix - call model_post_init explicitly until pydantic 2.0 #4858

Merged

Conversation

lc0rp
Copy link
Contributor

@lc0rp lc0rp commented Jul 1, 2023

As per pydantic/pydantic#1729 (comment), the implementation of model_post_init() is postponed until Pydantic v2. As a result, the initialization of PluginConfig is being skipped.

This fix calls plugin.model_post_init() explicitly.

The recency of the Pydantic v2 release means that some of the other extensions we use do not support it yet. Specifically, extensions such as spacy and openapi-python-client are currently limited to Pydantic versions that are less than 2.0. There may be other extensions that have the same limitation as well.

@netlify
Copy link

netlify bot commented Jul 1, 2023

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit db32f66
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/64a48fb227a04200083357fc

@github-actions github-actions bot added the size/s label Jul 1, 2023
@codecov
Copy link

codecov bot commented Jul 1, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.05 🎉

Comparison is base (5070cc3) 70.62% compared to head (db32f66) 70.67%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4858      +/-   ##
==========================================
+ Coverage   70.62%   70.67%   +0.05%     
==========================================
  Files          69       69              
  Lines        3387     3390       +3     
  Branches      554      554              
==========================================
+ Hits         2392     2396       +4     
+ Misses        811      809       -2     
- Partials      184      185       +1     
Impacted Files Coverage Δ
autogpt/config/config.py 74.66% <100.00%> (+1.19%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@lc0rp lc0rp changed the title Hotfix - Init plugin config explictly until pydantic 2.0 Hotfix - call model_post_init explicitly until pydantic 2.0 Jul 1, 2023
@lc0rp lc0rp added this to the v0.4.4 Release milestone Jul 4, 2023
Pwuts
Pwuts previously approved these changes Jul 4, 2023
@Pwuts Pwuts dismissed their stale review July 4, 2023 11:43

changed my mind

autogpt/main.py Outdated Show resolved Hide resolved
@Pwuts Pwuts self-assigned this Jul 4, 2023
Copy link
Member

@Pwuts Pwuts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested by @NeonN3mesis; thanks!

@Pwuts Pwuts merged commit 7e45b6a into Significant-Gravitas:master Jul 4, 2023
dayofthedave pushed a commit to dayofthedave/Auto-GPT that referenced this pull request Jul 17, 2023
…antic 2.0 (Significant-Gravitas#4858)

As per
pydantic/pydantic#1729 (comment),
the implementation of `model_post_init()` is postponed until Pydantic
v2. As a result, the initialization of PluginConfig is being skipped.

This fix calls `plugin.model_post_init()` explicitly.

The recency of the Pydantic v2 release means that some of the other
extensions we use do not support it yet. Specifically, extensions such
as spacy and openapi-python-client are currently limited to Pydantic
versions that are less than 2.0. There may be other extensions that have
the same limitation as well.

---------

Co-authored-by: Reinier van der Leer <[email protected]>
@lc0rp lc0rp deleted the init-plugin-manager-explictly branch July 23, 2023 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants