Extension:Piwo

The Piwo extension allows executing of Python scripts on MediaWiki (Python In, Wikitext Out). Since it uses the shell framework, it can and should be sandboxed.

Usage
This extension defines a custom namespace, "Gram", that stores Python scripts. Editing the Gram namespace requires the  right. To invoke a script, use the following parser function:

In the Python script, the parameters can be accessed through  (no import is needed); an extra function,   is provided as an equivalent to PHP's  ;   is equivalent to $IP;   is the name of the script, without "Gram:".

mw.py
Any and all of the Python standard library can be imported, as of January 2018. The accessiblity depends on the user you run your Mediawiki with.