About Pyrfecter
Pyrfecter, a portmanteau of "Python" and "perfecter", is two things:
- An easy-to-use tool that's simple enough for a brand new Pythonista but powerful enough for a seasoned vet
- An excuse to play with Pyodide, which uses WebAssembly to run Python directly in your browser
It's a little side-project of John Franey, so, uh, hi!
How it works
Pyodide and WebAssembly do the heavy lifting of running Python in the browser. Pyrfecter stitches together different Python code linters, formatters, and converters and runs your code them in an order that makes sense:
- Perform code modifications (formatting, converting)
- Lint & analyze the modified code
For a more technical description, Pyrfecter is a Python package that provides a pyrfect_code
function to modify and analyze your code:
from js import code
from pyrfecter import pyrfect_code
pyrfect_code(code)
The from js import code
is some Pyodide magic that passes your code from the textarea
element into Python so it can pass through Pyrfecter's Python code.
The pyrfect_code()
function runs the linting, formatting, and fixing utilities on the code entered into the editor included in most pages on the site. Huh. But not this one. Should I add it? Maybe I should add it.