pydantic-pycharm-plugin icon indicating copy to clipboard operation
pydantic-pycharm-plugin copied to clipboard

Prompt to install with using pydantic

Open samuelcolvin opened this issue 6 years ago • 9 comments

I think pycharm sometimes prompts me to install packages based on what I'm using.

Is it possible to get pycharm to prompt users to install this plugin whenever they import or install pydantic?

samuelcolvin avatar Aug 15 '19 14:08 samuelcolvin

I don't know how to work the function. I will research it.

koxudaxi avatar Aug 15 '19 14:08 koxudaxi

@pauleveritt, shamelessly tagging you for help.

Pycharm is sometimes keen on prompting people to install things (I had to email you about a package called pydantic-stubs which was not official, but pycharm was prompting everyone to use it whenever they imported pydantic - I know that was a python package not a pycharm plugin, but still).

Is there anyway we can tell pycharm users that this plugin might be useful when they're using pydantic?

I built a jinja template highlight package for vscode (the enemy :gun:, :pray:) and I'm pretty sure 99.9% of installs come because users get prompted to install a plugin when they open a .jinja or .jinja2 file. Hence why I'm advocating a prompt to spread the work about this great plugin.

samuelcolvin avatar Aug 15 '19 15:08 samuelcolvin

Thanks for tagging. I saw the ticket but I'm in a PyCharm 2019.3 planning meeting and haven't replied yet. (Can't wait for dataclass support in the plugin.)

Yes, there are ways to trigger such things. We have them all over the place. I'll see if I can get the team to comment on this ticket on (a) where is the hook and (b) what is a good example in the IntelliJ repo.

pauleveritt avatar Aug 15 '19 15:08 pauleveritt

great, thanks.

samuelcolvin avatar Aug 15 '19 15:08 samuelcolvin

thank you for your help

koxudaxi avatar Aug 15 '19 15:08 koxudaxi

@samuelcolvin I should have asked...on your vscode plugin example, either the platform or another plugin would have to detect that situation and do the suggesting. Are you saying vscode maintains a registry of some kind suggesting one plugin versus another?

pauleveritt avatar Aug 20 '19 21:08 pauleveritt

Not exactly.

My plugin is providing highlighting for jinja code (and html jinja templates), the plugin has a list of file extensions it should work with, eg .jinja, .jinja2. When you open a file with an extension vscode doesn't natively support, it looks for plugins that do support than extensions and suggests them. I think pycharm does something similar in this situation.

samuelcolvin avatar Aug 21 '19 11:08 samuelcolvin

@samuelcolvin That makes sense at a file extension level. This though is a package import. Does VS Code allow extensions to register support when an opened file imports something?

pauleveritt avatar Aug 26 '19 15:08 pauleveritt

@samuelcolvin To answer the question though, this page explains how to register for a filename. Note that PyCharm reserves some extensions (e.g. jinja2) for its own support, meaning we won't prompt a suggestion if we already support it.

pauleveritt avatar Aug 26 '19 15:08 pauleveritt