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!