Using PyCharm for channel development?

I've been noodling around with Channel development a bit, and I'm trying to figure out if there's a way to meaningfully use an IDE like PyCharm. Being new to Python and the PMS API, having code completion, etc would be very helpful.

 

I don't have any expectation that I'll be able to run/debug the channel code in PyCharm (would be nice if there were some way to attach a debugger, but I digress), but it would be nice if I could at least set the IDE up such that it sees the things that the channel code will see in its environment/sandbox. For instance, when executing in the sandbox/environment that PMS sets up for the plug in, you can refer to ObjectContainer without qualification; there is seemingly an implicit "from Framework.api.objectkit import *" happening before the channel code is run. My near-term goal is to make it so that PyCharm can see all the modules that would be implicitly imported for the channel's sandbox, primarily so things like code-completion will work right.

 

So far, I've created a virtual environment in PyCharm, and added all three versions of the Framework.bundle's python modules to that virtual environment. Once that was set up, I was able to (explicitly) add imports to my code like "from Framework.api.objectkit import *" and that would allow PyCharm to see the definition of ObjectContainer. Unfortunately, having that import in the code breaks the *actual* execution of the channel.

 

I've looked a little bit into the sandboxing code and I see that there's this publish_api method which appears to be responsible for making all the various framework classes available in the actual execution sandbox, but the setup of the environment/sandbox looks non-trivial, and without being able to step through it in a debugger, I'm having a hard time developing a full understanding of it.

 

Is anyone else out there managing to do Plex Channel plug-in development in an IDE with code completion? How are they going about it? While I'm here, I guess I might as well ask: does anyone know if it's possible to somehow attach a debugger to a plugin's host process? 

 

Thanks!

@jourh: I am interested in exactly the same thing. I did some Plug-in development with the V1 API and am now trying to get into the new V2.x syntax and as you said - code completion and object introspection of the Plex framework would be great.

Where did you find the "Framework.bundle's python modules" and how did you add/defined them to your IDE.

In general I would like to solicit feedback from the pro-developers what kind IDE and other tools they use to make plug-in development easier.

Thanks and Cheers,

alex

bump

Unfortunately, the plugin framework doesn’t lend itself to IDE implementation. That may changed in the future but in the mean time things like code auto-completion aren’t really available. I use a free code editor called “Komodo Edit” but really anything works. Have a listen to the Plex Podcast about channels and you can hear discussions about this and other topics between Sander, Ian, and me, hosted by Tobias.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.