The extension on the file has to be .sublime-build
or Sublime won’t know that it’s supposed to be a build file. It also has to be contained anywhere within a Package, generally your User
package would be where you would put it unless you’re a package author.
To find that location, Preferences: Browse Packages
in the command palette or from the menu; in the window that opens up, the folder named User
is the one you want. Anywhere inside of that folder is fine, should you want to keep things in some structure.
It will appear in the Tools > Build System
menu with the name you gave the file, so if the file is named MyCoolBuild.sublime-build
, it will appear as MyCoolBuild
in the menu.
Should you want to create your own build system for Python it’s thus important to give the file a name like My Python.sublime-build
or Custom Python.sublime-build
or similar because if you just name it Pythons.sublime-build
there will be two entries in the menu, the one that ships with Sublime and yours, and distinguishing them would be problematic.
The location of the install doesn’t really matter for your case here, the only important thing is that Sublime knows where to find it when the time comes (which is where things like the PATH
and so on come into play).
All else being equal, unlike previous versions of Sublime, in Sublime Text 4 so long as you have installed a “normal” version of Python (that is, not Anacona or Miniconda or similar) and you didn’t go out of your way in the Python installer to turn off default options, the Python.sublime-build
that ships with ST4 will work out of the box for anyone on Windows, Linux or MacOS that wants to execute Python 3 code unless you need very specific command line arguments, options, or other setup.
As such, depending on what you’re trying to do or when the book was written that you’re following, it’s entirely likely that it’s telling you to take a step that you don’t actually need to take and it’s just making things more complicated than it needs to be. A verification of that would be to create a file such as:
import sys
print(sys.version)
Save it on your Desktop as hello.py
, then use Tools > Build With...
, and select the build labeled Python
(not Python - Check Syntax
) and see if the code executes and prints the version of Python you expect.