Plugin's features for Pydantic dynamic models
See original GitHub issueHi @koxudaxi ,
Congratulations on your work on this plugin. I am using to inspect and autocomplete Pydantic models on Pycharm, and it works like a charm.
Is your feature request related to a problem? Please describe.
I want to use the plugin’s features when I create models dynamically. For example:
from pydantic import BaseModel, create_model
DynamicFoobarModel = create_model('DynamicFoobarModel', foo=(str, ...), bar=123)
class StaticFoobarModel(BaseModel):
foo: str
bar: int = 123
Describe the solution you’d like
In the above example, I get autocompletion for StaticFoobarModel
, but not for DynamicFoobarModel
. Is there any way to get the plugin’s features for DynamicFoobarModel
?
More info about Pydantic dynamic models creation: https://pydantic-docs.helpmanual.io/usage/models/#dynamic-model-creation
Best, Dario
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Settings management - pydantic
Create a clearly-defined, type-hinted application configuration class; Automatically read modifications to the configuration from environment variables ...
Read more >Models - pydantic
Models. The primary means of defining objects in pydantic is via models (models are simply classes which inherit from BaseModel ). You can...
Read more >Pydantic in a Nutshell - Python in Plain English
In addition, there is a pydantic Mypy plugin adding features like e.g. more ... runtime it's possible to use dynamic model creation via...
Read more >Pydantic - The Blue Book
Field order is important in models for the following reasons: ... As of v1.0 all fields with annotations (whether annotation-only or with a...
Read more >How can we use `default_factory` in a Pydantic field? - Medium
I found this feature useful recently. ... [1] https://pydantic-docs.helpmanual.io/usage/models/#field-with-dynamic- ... How to create a Flake 8 Plugin.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@bukosabino Thank you for the great suggestion. It looks good 👍
OK, I try to implement the feature 🚀
Hi @koxudaxi ,
Thank you for your help.
Sorry, I can not help you with this task, because of the code language is not Python 😦
Note: Jupyter Lab shows the autocompletion for the dynamic model.
Best, Dario