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.13 and can be installed via pip:
pip install pyodide-pack
(optionally) For elimation of unused modules via runtime detection, run Node.js, needs to be installed together with Pyodide 0.28.0a3 and later:
npm install pyodide@">=0.28.0a3"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.