question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plugin's features for Pydantic dynamic models

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
koxudaxicommented, Aug 8, 2020

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

OK, I try to implement the feature 🚀

1reaction
bukosabinocommented, Aug 24, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found