Home Download Buy Blog Forum Support

Sublime internal python version and libraries

Sublime internal python version and libraries

Postby tbourden on Wed Oct 10, 2012 9:06 am

Hello,

I've started writing a plugin for sublime on my mac and everything were working fine until I tried the progress of my plugin in my linux box. Running it failed with an exception of missing the multiprocessing module of python.

So my question boils down to: is there a good reason why multiprocessing is not part of the python version that sublime uses internally? More so, why is it present in the macOSX distribution and not on the linux one? What about Windows? What would be my alternatives for using a portable multiprocess library inside sublime?

Cheers,
Themis
tbourden
 
Posts: 4
Joined: Tue Oct 09, 2012 7:13 pm

Re: Sublime internal python version and libraries

Postby lunixbochs on Wed Oct 17, 2012 5:39 am

Looks like multiprocessing might be pure Python? So you could just include it...

Better question. Why do you need to do multiprocessing in a Sublime plugin?
lunixbochs
 
Posts: 91
Joined: Fri Oct 08, 2010 10:18 pm

Re: Sublime internal python version and libraries

Postby sublimator on Wed Oct 17, 2012 12:26 pm

On OSX Sublime dynamically links directly against the system version of Python which comes with the full arsenal.

It's linked different on linux/windows (*) and with differing subsets of the std lib included.

* (I think dynamically against bundled .o and .dll files ?)

lunixbochs wrote:Looks like multiprocessing might be pure Python?

Doesn't the multiprocessing module or package imports a _multiprocessing object file?
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: Sublime internal python version and libraries

Postby tbourden on Wed Oct 24, 2012 7:23 pm

That's sort of an issue for portability in general, isn't it?

I use multiprocessing to create a remote debugger that I can control as a different process to avoid blocking the main process (the one embedded in sublime text). Are you aware of any portable alternatives can I have for multiprocessing?

Cheers,
Themis
tbourden
 
Posts: 4
Joined: Tue Oct 09, 2012 7:13 pm

Re: Sublime internal python version and libraries

Postby tbourden on Wed Oct 24, 2012 7:30 pm

I also just found this http://docs.sublimetext.info/en/latest/ ... rd-library.
What is the reason for intentionally leaving out the multiprocessing module? Is there something "dangerous" about it and was decided to be left out?

Themis
tbourden
 
Posts: 4
Joined: Tue Oct 09, 2012 7:13 pm

Re: Sublime internal python version and libraries

Postby lunixbochs on Sun Dec 30, 2012 1:45 am

You can avoid blocking the UI by using threads. I try to keep most of the work of my plugins outside the UI thread, so you don't even see lag while typing. Try not to leak threads on reload when you're developing (check sublimelint's lint/persist.py for a misc example).

Use `sublime.set_timeout()` when to call functions that need to use the full Sublime apis (like interacting with a view/buffer/window).
lunixbochs
 
Posts: 91
Joined: Fri Oct 08, 2010 10:18 pm


Return to Plugin Development

Who is online

Users browsing this forum: Majestic-12 [Bot], Yahoo [Bot] and 4 guests