API Environments Version:
Plugins in Sublime Text are Python files located in the root of apackage. The following document describes the Python environment theplugins are run in.
Overview🔗
Sublime Text runs plugins in a separate process from the main editor UI. Thisprocess runs an executable namedplugin_host.
Running plugins in a separate process ensures the entire editor will not crashdue to a poorly written plugin. If a plugin does cause theplugin_hostto crash, a user may still save their work before re-starting Sublime Text.
All plugins are run in a singleplugin_host process, and share a singlePython environment. Each plugin is loaded as a sub-module of a module namedafter the package. For example, a plugin in thefileMyPackage/my_plugin.py will be loaded as the Python moduleMyPackage.my_plugin.
Theplugin_host process contains an embedded version of the Pythonprogramming language, and exposes anAPI to plugins.Theplugin_host executable always uses its own embedded version ofPython, even if the end-user has Python installed on their machine.
Python Version🔗
By default all plugins are run using Python 3.3.6, except inside theUser package which always uses the latest python.Sublime Text‘s buildof Python 3.3.6 includes a handful of patches backported from Python 3.4 to fixissues with unicode paths and crashes with thectypes module on 64bitversions of Windows.
Starting in build 4050, plugins may also be run using Python 3.8. Python 3.8features many improvements to the language, better performance andcontinued support and bug fixes from the Python Software Foundtion.
4050Selecting the Python Version🔗
To provide for backward compatibility, Sublime Text 4050 will continue to runall plugins using Python 3.3.
Any package that wishes to use Python 3.8 must create a filenamed.python-version in the root of the packages. This file shouldcontain either the text3.3 or3.8 to select the version of Python touse.If a file named.python-version is not present, or it containsany value other than3.8, then Python 3.3 will be used.
All plugins in a package will use the same version of Python.Any package witha.python-version file containing3.8 loaded in older builds ofSublime Text will try to run the plugins using Python 3.3.
Modules🔗
The Python environment withinplugin_host contains all of the modules inThe Python Standard Library, exceptfor:
audioop
crypt (Not on Linux)
curses
cProfile (Not on Linux)<4050
fpectl40503.3
readline
lzma40503.3
msilib
nis
ossaudiodev
resource40503.3
spwd
syslog
test
tkinter
turtle
wave