Hey folks,
I like to have your opinion on a recent plugin idea of mine.
One thing that really loved to change about Sublime Text is the lack of support for third party python plugins.
One thing which makes python so great is its vast ecosystem of packages. Sublime would strongly benefit if there was less of a barrier to incorporate external dependencies into plugins. Plugins could feature a greater variety of functions and would be easier to develop.
Currently, you need to manually include a complete python into your plugin folder. This is, as we may all agree, very bad for maintaining and distributing plugins.
Besides a few popular python libraries are repackaged as Sublime plugins, such as requests. Yet, this approach is obviously impractical to scale.
A potential solution may be the following:
Harnishing the pip download
command to automatically provide dependencies to a plugin.
This may work as such:
- The
pip download
function would be implemented into a dedicated plugin. Let’s call it: sublime-pip - When you develop a new plugin for which you need additional python modules, you are going to include sublime-pip into your dependencies.json.
- You are also going to include a requirements.txt specifying the required libraries (and their versions).
- Upon install or update of your plugin, sublime-pip will download the dependencies into a subfolder within your plugin directory. (Like: /plugin_dir/libs/dependenc_1/)
- Now, your plugin can do a relative import of the modules.
This is the plugin idea. Could you give me some general feedback on it? Do you think it would be useful to you? Would it ease your plugin development? Any roadblocks you see in developing sublime-pip? Are there better ways to achieve the same goal?
Thanks.
-
Ben
-
Further readings:
StackOverflow thread on pip download
pip download docs