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

Plugin's features for Pydantic dynamic models #169

Closed
bukosabino opened this issue Aug 7, 2020 · 6 comments
Closed

Plugin's features for Pydantic dynamic models #169

bukosabino opened this issue Aug 7, 2020 · 6 comments
Assignees
Labels
enhancement New feature or request released

Comments

@bukosabino
Copy link

Hi @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

@koxudaxi
Copy link
Owner

koxudaxi commented Aug 8, 2020

@bukosabino
Thank you for the great suggestion.
It looks good 👍

OK, I try to implement the feature 🚀

@koxudaxi koxudaxi self-assigned this Aug 8, 2020
@koxudaxi koxudaxi added the enhancement New feature or request label Aug 8, 2020
@koxudaxi
Copy link
Owner

@bukosabino
I have started to implement this feature:rocket:
But, I need time to complete the work. 🤓

Screenshot_2020-08-18_05-35-34
Screenshot_2020-08-18_05-35-22

@koxudaxi
Copy link
Owner

koxudaxi commented Aug 21, 2020

@bukosabino
The version 0.1.11 has released which supports create_model() as experimental.

The version doesn't provide a part of the feature.
But, autocompletion and type inspection support your development.
If a lot of users want more feature then I will implement it.
However, It's very hard and needs a lot of time.

@bukosabino
Copy link
Author

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.

dynamic_autocompletation

Best,
Dario

@koxudaxi
Copy link
Owner

koxudaxi commented Aug 24, 2020

@bukosabino
Interesting!!
I will check the code of Jupyter 🤓

I have to implement different from BaseModel to support dynamic_model()
This problem comes from PyCharm.

@koxudaxi
Copy link
Owner

koxudaxi commented Sep 7, 2020

I close this issue Because I implemented the minimum features.

If a lot of users need more features, then I will re-open this one or create a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

No branches or pull requests

2 participants