Sublime Forum

Sublime internal python version and libraries

#1

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

0 Likes

#2

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?

0 Likes

#3

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 ?)

Doesn’t the multiprocessing module or package imports a _multiprocessing object file?

0 Likes

#4

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

0 Likes

#5

I also just found this 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

0 Likes

#6

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).

0 Likes