- Python 57.2%
- HTML 42.8%
| src/infr | feat: auto input | |
| .gitattributes | chore: add project to git | |
| .gitignore | feat: debain based dockerfile | |
| .python-version | chore: init | |
| dockerfile | docs: how to demo dockerfile | |
| Project.sb3 | chore: add project to git | |
| pyproject.toml | feat: basic implementation | |
| README.md | docs: installation | |
| uv.lock | feat: basic implementation | |
infr
this is a python script that uses a headless browser and turbowarp scaffolding to run scratch projects.
It then redirects output from the scratch projects back to stdout. If a breakpoint is raised,
the exit code 1 is given. Otherwise the exit code 0 is given.
infr tries to be minimal and avoids doing anything other than just running an sb3 file.
installation
Ensure you have git and uv installed. then proceed. (note that these instructions have not been tested).
I can guarantee that this does not work on all systems. Like for archlinux, you will need to install
dependencies for playwright manually. An example of how to run infr in docker is provided as
the dockerfile. These compatability issues may be improved with the use of selenium or puppeteer over
playwright, and maybe even sticking to a pure JS stack. But for now, we are using python+playwright
because it works on the systems I need.
git clone codeberg.org/igs/infr --depth=1cd infruv run playwright install --with-deps chromiumuv tool install .
usage
infr is so minimal that it literally just takes in arguments from sys.argv in a pretty stupid way
the program will litearlly not work unless you use this syntax:
infr [.sb3 file] [opts] where .sb3 file is a path to an sb3 file, and opts is a JSON object:
All fields are optional:
{
"headless": true,
"username": "player",
"cloudHost": "wss://clouddata.turbowarp.org",
"projectId": "int or str; default is sha256 hash of the project",
"timeout": 1000,
"inputTimeBuffer": 0.1,
"prompt": "> ",
"inputs": [], // list of strings to autocomplete inputs, e.g. ["rtk", "yes", "no"]
"requireAutoInp": false // require all inputs to be from the inputs list; otherwise raise an error
}
I'm not really sure if i should use playwright or selenium. i've used both for projects like this. i'm actually going to use playwright because it appears to be easier to use on windows since i dont actually have chrome installed and i already know how to get it running on gh actions