Getting started
This page assumes you have used Python before. If you have, there is little to learn: SteelPython's interpreter is called spy, and it takes the same command line as python.
Finding spy
SteelPython comes with Divooka Compute. Its folder holds spy.exe (the interpreter), Misp.exe (the IDE) and SpyNotebook.exe (the notebook), together with the standard library in Lib\. To find Divooka Compute's folder, right-click it in your Steam library and choose Manage > Browse local files.
To run spy from any terminal, add the folder that holds spy.exe to your PATH: open Edit environment variables for your account from the Start menu, select Path, choose Edit, and add the folder. Open a new terminal afterwards. Corporate users with the standalone SDK can let its installer do this.
Check that it works:
> spy --version
Python 3.12.13 (SteelPython 0.1.0)
The interactive prompt
Run spy with no arguments:
> spy
Python 3.12.13 (main, ...) [SteelPython 0.1.0 on .NET 10.0, 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> sum(n * n for n in range(10))
285
>>> exit()
It behaves like CPython's prompt: _ holds the last result, help() works, Tab completes names, the up and down arrows walk through your history (kept in ~\.python_history, as with CPython), and exit() leaves. The line editor has the usual Emacs-style keys (Ctrl+A, Ctrl+E, Ctrl+K, Ctrl+R to search the history, and so on).
spy -m asyncio gives a prompt where await works at the top level, as python -m asyncio does.
Running code
spy script.py arg1 arg2 run a script; sys.argv is ['script.py', 'arg1', 'arg2']
spy -m package.module run a module as a script (spy -m pip, spy -m venv, spy -m http.server, ...)
spy -c "print('hello')" run a string of code
spy -i script.py run a script, then stay at the prompt with its variables
spy app.pyz run a zip application
CPython's options work as they do there: -u (unbuffered output), -O, -W, -X, -E, -I, -S, -B, -q, -v, and spy -h lists them. CPython's documentation describes them: Command line and environment.
So do the environment variables: PYTHONPATH, PYTHONUNBUFFERED, PYTHONUTF8, PYTHONSTARTUP, PYTHONDONTWRITEBYTECODE and the rest. SteelPython adds one: SPYPATH, which SteelPython reads in place of PYTHONPATH when it is set, so that a PYTHONPATH meant for a CPython on the same machine does not have to be shared.
Translating instructions written for CPython
Documentation and README files are written for CPython. Read them with these substitutions:
| They say | With SteelPython |
|---|---|
python script.py |
spy script.py |
python -m pip install ... |
spy -m pip install ... |
python -m venv .venv |
spy -m venv .venv |
py -3.12 |
spy |
#!/usr/bin/env python3 |
(Windows ignores this line; run the script with spy) |
Inside an activated virtual environment pip and the commands of installed packages work by name, as usual (Packages and environments).
Checking that code runs on SteelPython
import sys
print(sys.implementation.name) # 'steelpython'
print(sys.version) # '3.12.13 (main, ...) [SteelPython 0.1.0 on .NET 10.0, 64 bit (AMD64)]'
platform.python_implementation() returns 'CPython' on SteelPython, on purpose: packages that check it want to know whether CPython's C API and behaviour are available, and on SteelPython they are. When your own code needs to tell the two apart, test sys.implementation.name == "steelpython".
Next steps
- Install some packages: Packages and environments.
- Write and debug code in Misp, or explore data in Spy Notebook.
- Read Differences from CPython before porting a large program.