Python package bundler and minifier for the web
Pyodide-pack aims to reduce the size and load time of Python applications running in the browser using different strategies:
- Minification of the source code via AST rewrite
- Transformation of the source code into a different format such as Python bytecode (.pyc files)
- Dead code elimination, by removing unused Python modules (detected at runtime)
Each of these approaches have different tradeoffs, and can be used separately or in combination.
Pyodide-pack requires Python 3.10+ and can be installed via pip:
pip install pyodide-pack
(optionally) For elimation of unused modules via runtime detection, run NodeJS needs to be installed together with Pyodide 0.24.0+:
npm install pyodide@">=0.24.0"
For Python wheel minification via AST rewrites, run,
pyodide minify <path_to_dir_with_py_files>
See the documentation at pyodide-pack.pyodide.org for more details.
Pyodide-pack uses the Mozilla Public License Version 2.0.