01 Install — Desktop
Python v2 has no dependencies and no install step. If you have Python 3.10+ and Git, you're done. Works on macOS, Linux, Windows (native or WSL), and a fridge with a shell.
python3 --version # need 3.10 or newer
git --version
git clone https://github.com/gefrus112/pythonv2
cd pythonv2
python3 -m pyv2 --version
# Python v2 0.2.0
python3 -m pyv2 examples/hello.pyv2
# Hello, World!
# 2 + 2 = 4
python3 -m unittest discover -s tests -t .
# ... OK
Command line
| Command | What it does |
|---|---|
python3 -m pyv2 script.pyv2 | Run a program |
python3 -m pyv2 -c 'print(42)' | Run a one-liner |
python3 -m pyv2 | Start the REPL (... continues blocks) |
python3 -m pyv2 --version | Print the version |
python3 -m pyv2 --help | Show usage |
Windows notes
- If
python3is not found, trypy -m pyv2 script.pyv2. - WSL is the smoothest path: install Ubuntu from the Microsoft Store, then follow the three steps above.
02 VS Code
The repository ships ready-made VS Code config in .vscode/
and a language extension in editors/vscode/ for
syntax highlighting of .pyv2 files.
Quick start (run & debug your code)
- Open the
pythonv2folder in VS Code (File → Open Folder…). - Open any
.pyv2file, e.g.examples/fib.pyv2. - Press Ctrl+Shift+B
(macOS: Cmd+Shift+B) — the default build task
runs
python3 -m pyv2on the current file. - Output appears in the Terminal panel. That's it.
The included .vscode/tasks.json defines two tasks:
Run Python v2 file (default build) and
Python v2 REPL. The included
.vscode/settings.json associates *.pyv2 with
the pyv2 language.
Syntax highlighting (the bundled extension)
- Copy the extension folder into your VS Code extensions directory:
# macOS / Linux cp -r editors/vscode ~/.vscode/extensions/pyv2-0.1.0 # Windows (PowerShell) Copy-Item -Recurse editors/vscode "$env:USERPROFILE\.vscode\extensions\pyv2-0.1.0" - Restart VS Code (or run Developer: Reload Window).
- Open any
.pyv2file — keywords, strings, f-strings, numbers and comments are now colored.
Prefer the marketplace workflow? Pack it once with the
vsce tool and install the VSIX:
cd editors/vscode
npx @vscode/vsce package # builds pyv2-0.1.0.vsix
code --install-extension pyv2-0.1.0.vsix
Alternative: Code Runner
If you use the popular Code Runner extension, add this to
your user settings.json and press
Ctrl+Alt+N to run:
{
"code-runner.executorMap": {
"python": "python3 -m pyv2"
},
"code-runner.fileDirectoryAsCwd": true
}
03 Dev Containers & GitHub Codespaces
Opening the repo in a dev container (VS Code or
Codespaces) gives you a ready environment in seconds — Python preinstalled,
tasks wired, tests passing. The config lives in
.devcontainer/devcontainer.json (that's the ".dev" part).
VS Code Dev Containers
- Install Docker and the
Dev Containers extension
(
ms-vscode-remote.remote-containers). - Open the repo folder, then run Dev Containers: Reopen in Container from the Command Palette (Ctrl+Shift+P).
- First boot pulls the Python image; after that everything is instant.
- Run
python3 -m pyv2 examples/hello.pyv2— or just hit Ctrl+Shift+B.
GitHub Codespaces
- On GitHub, open the repo → Code → Codespaces → Create codespace on main.
- VS Code opens in your browser with the dev container already built.
- Everything from the desktop guide works identically inside it.
The container runs python3 -m unittest discover -s tests -t .
at build time, so you always start from a green suite.
04 Any Other Code Editor
Python v2 is just text plus a CLI. Any editor that can run a shell command can run it. The universal recipe:
- Coloring — associate
*.pyv2with Python syntax. It's close enough (and free). - Running — bind a build/run command to
python3 -m pyv2 "$file"with the working directory set to your project. - Formatting — 4 spaces, one statement per line, blocks
end with
end. Your formatter can't break it. That's the point.
Sublime Text
Tools → Build System → New Build System…
{
"cmd": ["python3", "-m", "pyv2", "$file"],
"selector": "source.python",
"working_dir": "$file_path"
}
Vim / Neovim
" in init.vim / .vimrc
autocmd BufNewFile,BufRead *.pyv2 set filetype=python
autocmd FileType python nnoremap <F5> :w<CR>:!
\python3 -m pyv2 %<CR>
JetBrains (PyCharm, IntelliJ)
- Settings → Editor → File Types → add
*.pyv2to the Python type. - Settings → Tools → External Tools → add a tool with
program
python3, arguments-m pyv2 $FileName$, working directory$FileDir$. - Bind it to a shortcut under Settings → Keymap.
Notepad++
Run → Run… (F5) with:
cmd /c python3 -m pyv2 "$(FULL_CURRENT_PATH)"
05 Language Quick Reference
The full spec (grammar, semantics, error kinds) lives in docs/LANGUAGE.md. Here is the day-to-day core.
Values
| Type | Example | Notes |
|---|---|---|
| number | 1, 2.5, 1e-3 | Whole numbers print without .0 |
| string | "hi", f"hi {x}" | Indexed s[0], tons of methods |
| bool | true, false | |
| nil | nil | Absence of a value |
| list | [1, 2, 3] | Mutable; negative indices work |
| map | {name: "Ada"} | Bare keys, dot access, get(k, default) |
| fn | fn add(a, b): … end | First-class, real closures |
| range | range(10) | Lazy, from the range builtin |
Operators
| Kind | Operators |
|---|---|
| Arithmetic | + - * / // % ** |
| Comparison | == != < <= > >= |
| Logic | and, or, not |
| Membership | x in list, k in map, s in string |
| Ternary | ok ? "yes" : "no" |
| Assignment | = += -= *= /= %= |
Statements
| Statement | Example |
|---|---|
| function | fn add(a, b): return a + b end |
| branch | if x: … elif y: … else: … end |
| while | while running: step() end |
| for | for item in [1, 2, 3]: print(item) end |
| range loop | for i in range(1, 10, 2): print(i) end |
| jump | return, break, continue |
Builtins
| Function | Description |
|---|---|
print(...) | Print values, space-separated |
len(x) | Length of string / list / map / range |
range(stop) · range(a, b, step) | Integer range |
str int float bool repr | Conversions |
abs floor ceil round sqrt pow | Math |
min · max | Over arguments or one list |
type(x) | "number", "string", "list", "map", … |
push pop insert remove | List mutation |
keys values has get | Map access |
sort sort_by join | Helpers |
assert(cond, msg?) | Raises AssertionError when falsy |
chr ord clock input | Misc (input is CLI-only) |
06 Try It Right Here
No install needed to experiment — this is the real interpreter, running in your browser. Edit and hit Run.