koxudaxi / poetry-pycharm-plugin

A PyCharm plugin for poetry

Home Page:https://koxudaxi.github.io/poetry-pycharm-plugin/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for pydantic-like models?

collerek opened this issue · comments

Hi, I'm using your plugin for quite some time and it's awesome - thanks for your work! :)

I'm developing ormar - a mini async orm with fastapi in mind, that uses pydantic for validation (https://github.com/collerek/ormar)

I'm subclassing the pydanic.BaseModel as my ormar.Model and hacking around with pydantic internals to make it work.
(You can ignore Meta class below, the field definition is like in pydantic but I use my custom fields classes as type hints - id and name in example).

image
It does kind of work, but in example above it shows Base clases of my fields, and I would like to display user=User(id: Integer, name: String), or even better -> user=User(id:int, name:str)

I'm already playing with __annotations__, pydantic fields shape, type_ and a lot of internals, so I would like to adjust my models/ fields to play well with your plugin.

But for that I need information from where do you grab the information to display in code completion, hints etc.

I'm also exposing QuerySet operations like User.objects.create(**kwargs) or User.objects.update(**kwargs) that as kwargs should accept only pydantic/ormar fields -> can you somehow register a custom function to be picked up by your plugin, or make it work in other way (so display hints like in __init__()).

I tried looking into your code but saw a huge number of jetbeans dependencies and I don't even know kotlin :D

So would be really grateful for info how I can adjust my project to be more in line with your plugin, as I find it super useful.

Thanks in advance and sorry for the long text.

Sorry wrong repo! 🤦