DocumentationSingle HTML file

Export Python Apps as a Single HTML File

PyCafe makes it easy to distribute Python‑powered applications by exporting them as a single self‑contained HTML file.

This standalone file:

  • includes your code, UI, and datasets (up to 400 MB)
  • Runs entirely in the browser
  • Requires no server, no installation, and no deployment

You can share the exported file via email, chat, cloud storage, or any other channel, and your colleagues or clients can open it instantly in Edge, Chrome and Firefox.

export-html

There are two ways to export your project as a single HTML file:


1. Export from the PyCafe GUI

  1. Open your project in PyCafe.
  2. Click Share.
  3. Select tab Export.
  4. Click Download as HTML.

PyCafe will produce a single .html file ready to download and distribute.

export-html

Note:
• On the free hosted service https://py.cafe, the maximum project size is 10 MB. Use the command line method below for larger projects.

• On self‑hosted instances, exports can be up to 400 MB.


2. Export from the Command Line

You can also export a directory containing app.py, requirements.txt, and any data files into a standalone HTML file.


2.1 Using a Self-Hosted PyCafe Server

First, set the following environment variables:

export PYCAFE_API_KEY=hlU[...]Blkg
export PYCAFE_CLIENT_URL=https://your-pycafe-domain.com

The client token can be obtained from the admin page at https://your-pycafe-domain.com/api-keys.

Then run:

uvx pycafe-server export-html \
  --name myapp \
  --source-dir \
  --path/to/myapp \
  --pyodide 0.27.2 \
  --type vziro

This will generate myapp.html in the current directory.

Using pip instead of uvx:

pip install pycafe-server
pycafe-server export-html \
  --name myapp \
  --source-dir \
  --path/to/myapp \
  --pyodide 0.27.2 \
  --type vziro

2.2 Using the Public PyCafe Instance (https://py.cafe)

When using the public PyCafe service, you do not need an API key or server URL.
Instead, add the —public flag:

uvx pycafe-server export-html \
  -- public \
  --name myapp \
  --source-dir \
  --path/to/myapp \
  --pyodide 0.27.2 \
  --type vziro

Note:
Even through the public PyCafe instance, command‑line exports support projects up to 400 MB.


Summary

Export MethodMax SizeRequirements
GUI (https://py.cafe)10 MBBrowser only
GUI (self‑hosted)400 MBSelf‑hosted server
CLI (public or self‑hosted)400 MBpycafe-server tool

This makes PyCafe a flexible option for distributing Python‑powered web applications—no backend, no deployment, and no installation needed.

;;