Brython
Brython implements Python 3 for interactive web applications embedded in HTML pages.
What Brython is
Brython implements Python 3 for interactive web applications embedded in HTML pages. Python code can work with browser pages through the DOM using document and window objects, while browser.html exposes HTML4, HTML5, and some HTML5.1 elements as Python classes. Examples cover changing page elements, handling events, graphics, animations, Ajax requests, and local file selection. The browser.aio module supports asynchronous programming with async and await, and Brython provides ways to use JavaScript objects and libraries. It can be loaded from jsDelivr or cdnjs without installation, installed with pip or a release archive, or deployed by uploading an application directory. Compatible packages can be added with brython-cli add_package, and modules can be bundled in .brython.js files. Browser security restricts network requests and file access: writing through the documented Python interface is unavailable, while reading is limited to Ajax-accessible files. Packages requiring C extensions, including NumPy, Matplotlib, and Pandas, do not work.
Good
- Uses Python 3 syntax in HTML pages
- Provides direct DOM access
- Supports events, graphics, animations, and Ajax
- Includes async and await support
- Can load without installation from CDNs
Watch out
- Browser restrictions limit HTTP requests
- Documented file interface cannot write files
- C-extension packages do not work
- Reading files requires Ajax-accessible locations
Who it suits
It suits developers who want Python syntax for browser-based interfaces and interactive HTML applications. It is less suitable when projects require unrestricted file access, arbitrary requests, or C-extension packages.
Verdict
Brython brings Python-based DOM programming and asynchronous features to modern browsers. Its browser security and package constraints define where it can replace JavaScript-based approaches.
The facts
Each one read from Brython's own pages, with the date it was checked.
What it does
- Async programming
- The CPython asyncio module is not usable in Brython; the documentation provides the Brython-specific browser.aio module instead.checked 8 Oct 2026
- Deployment
- A Brython application can be deployed by uploading its directory to a server or packaged for distribution through PyPI.checked 8 Oct 2026
- Distribution
- Brython packages bundle importable modules in .brython.js files that can be hosted on any server.checked 8 Oct 2026
- DOM interface
- Brython provides browser-facing modules for working with the DOM, including document and window.checked 8 Oct 2026
- DOM support
- Brython provides access to browser pages through the DOM using the browser module's document and window objects.checked 8 Oct 2026
- File access limits
- Browser file access is constrained: writing is impossible through the documented Python file interface, and reading is limited to files reachable by Ajax requests.checked 8 Oct 2026
- HTML elements
- The browser.html module exposes HTML4, HTML5, and some HTML5.1 tags as Python classes.checked 8 Oct 2026
- Installation
- Brython can be used from jsDelivr or cdnjs without installation, or installed locally with pip or a GitHub release archive.checked 8 Oct 2026
- Install options
- Brython can be loaded from jsDelivr or cdnjs without installation, or installed locally with pip or a downloadable release.checked 8 Oct 2026
- Integrations
- A CPython package installed with pip can be added to a Brython application with brython-cli add_package.checked 8 Oct 2026
- JavaScript interoperability
- Brython provides ways for Python code to use JavaScript objects and libraries.checked 8 Oct 2026
- Network limitations
- Browser code can make Ajax requests to its own domain and to sites that support cross-origin requests; the FAQ gives requests as an incompatible example.checked 8 Oct 2026
- Package limitations
- The FAQ says Brython cannot use CPython packages that rely on C extensions, naming NumPy, Matplotlib, and Pandas as examples.checked 8 Oct 2026
- Package limits
- Brython runs Python programs, not programs written in C, so numpy and data science packages that rely on it will not work.checked 8 Oct 2026
- Purpose
- Brython implements Python 3 in the browser and lets developers run Python code in HTML pages.checked 8 Oct 2026
- Python syntax
- Brython supports the keywords and functions of the corresponding Python version, subject to browser and JavaScript limitations.checked 8 Oct 2026
- Security and compliance
- The official pages reviewed provide no stated security certification or compliance claim.checked 8 Oct 2026
- Security constraints
- Browser restrictions limit HTTP requests; packages such as requests and urllib.request cannot send arbitrary requests to any URL.checked 8 Oct 2026
- Supported library
- Brython includes part of the CPython standard library and can install compatible Python packages, but packages containing C-written files are excluded.checked 8 Oct 2026
Where it runs
- Browser features
- Its examples cover creating and modifying page elements, events, graphics, animations, Ajax requests, and local file selection.checked 8 Oct 2026
- Browser file limits
- The browser environment prevents file writing, and file reading is limited to files accessible through Ajax requests.checked 8 Oct 2026
- Browser support
- The FAQ says Brython supports all modern browsers, including browsers on smartphones.checked 8 Oct 2026
Alternatives to Brython
- 1
JSweet
Free planOpen sourceAndroidiOSWebAPI7.7Free plan - 2

SWC
Free planAndroidWebAPILinux7.1Free plan - 3
Transcrypt
Free planWebLinuxmacOSSelf-hosted6.7Free plan - 4
TypeScript Playground
Free planWeb6.6Free plan - 5
Google Web Toolkit
Free planWebExtensionLinuxmacOS6.5Free plan - 6
Haxelib
Free planAPILinuxmacOSWindows6.5Free plan
