Package providing the Execubot project Python code (https://execubot.fr).
Project description
execubot-py
Package providing the Execubot project Python code (https://execubot.fr).
Yes, you can even play Execubot in your terminal! 🤖
CLI
execubot-cli play <FILE>... # play level in terminal (curses)
execubot-cli print <FILE>... # print level source with syntax highlighting
execubot-cli extractor <FILE>... # parse level file and show metadata
execubot-cli solver <FILE>... # solve level and show solution
execubot-cli generator <FILE>... # generate JSON metadata for web frontend
execubot-cli grid <FILE>... # show standardized grid
execubot-cli lang <FILE>... # show language dict
execubot-cli tags <FILE>... # show tags
execubot-cli difficulty <FILE>... # show difficulty score
<FILE> accepts file paths or bare level numbers (e.g. 1 → level1.pye).
The standalone script scripts/execubot-cli (PEP 723) is provided and can be run directly without installing the package:
scripts/execubot-cli play 106
Level file format (.pye)
grid = [['purple', 'green']] # header: Python assignments (grid is mandatory; row=0, col=0, lang='en', message, author are optional)
# mandatory blank line
right() # body: level code executed by the solver
Python API
from execubot_py import solve, extractor, stdgrid, dictlang, generate, tags, difficulty
solve("path/to/level.pye") # → [('Right', 0), ('Down', 2), ...]
extractor("path/to/level.pye") # → {'grid': ..., 'code': ..., 'row': 0, ...}
stdgrid(["w o", "y w"]) # → [['white', 'orange'], ['yellow', 'white']]
dictlang("fr") # → {'purple': 'violet', 'right': 'droite', ...}
generate("path/to/level.pye") # → '{"id": 1, "answer": [...], "grid": [...], ...}'
tags("if orange():\n right()") # → ['if']
difficulty("while orange():\n right()") # → 10
# solve, extractor and generate also accept raw file content instead of a path
content = "grid = [['white', 'orange']]\n\nright()"
solve(content) # → [('Right', 0)]
Architecture
The package is split into two layers:
solver.py — core engine
Execubotclass: takes(code, grid, row, col, lang)and runs the player's Python code viaexec()in a restricted namespace (only color-test functions and direction functions are exposed).extractor(): parses a.pyelevel file, splitting it at the first blank line — the header (above) isexec'd to extractgrid,row,col,lang, etc.; the body (below) becomescode.- Translations live in
Execubot.translations(a class-level dict built fromtranslation.py, or fromjson/solver.jsonunder Brython). Color/direction functions are injected under their translated names at solve time. Supported languages: 🇬🇧en, 🇫🇷fr, 🇪🇸es, 🇮🇹it, 🇳🇱nl, 🇻🇳vi.
generator.py — level metadata
Level(Execubot): extends the solver to produce JSON output (generator()) consumed by the web frontend. Computesdifficulty(keyword-weighted score) andtagsfrom the level's code.
Tests compare CLI/function output against golden files in tests/out/*.out. When adding or modifying a level, regenerate the fixtures with scripts/updater_tests.sh.
Brython variant: src/execubot_py/solver/solver.py is compiled to solver.brython.js for the browser frontend — not shipped in the package but available via CDN at https://www.jsdelivr.com/package/gh/fgallaire/execubot.
Credits
Copyright (C) 2025-2026, Florent Gallaire <fgallaire@gmail.com> & Célia Piquet <cepiquet@proton.me>.
Licensed under the GNU GPLv3 or later.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file execubot_py-2.5.tar.gz.
File metadata
- Download URL: execubot_py-2.5.tar.gz
- Upload date:
- Size: 44.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8736ea356f00c9e9ef57fd21c8fe0af158d3f93e3b7b52af4c5536fbc05b49a0
|
|
| MD5 |
5cedcf9d8b0e0784191511de1d992fa5
|
|
| BLAKE2b-256 |
691963e83d472194d5bda952d46562f4f158dee48c10ebd605e99ddf67fb54fb
|
File details
Details for the file execubot_py-2.5-py3-none-any.whl.
File metadata
- Download URL: execubot_py-2.5-py3-none-any.whl
- Upload date:
- Size: 54.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb573c899b5165e398708099db5d0d464f30d54b0a1de565edb5e02b83499b1e
|
|
| MD5 |
ff4de1ca124ce429fd72047b04ddbce7
|
|
| BLAKE2b-256 |
dedbd2308e5814f0e26040c0a49b77a161dbca1f03dd9f64140237eac6f78ae8
|