Sunday, October 25, 2026 4,350 lists 78,100 records on file
List your app or device

  1. Home
  2. Code Transpilers
  3. Brython

Brython

What it 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, and the browser.html module exposes HTML tags as Python classes. Its examples include changing page elements, handling events, graphics, animations, Ajax requests, and local file selection. Brython supports keywords and functions from the corresponding Python version, subject to browser and JavaScript limits; its browser.aio module supports async and await. It can be loaded from jsDelivr or cdnjs without installation, installed locally with pip or a release archive, or deployed by uploading an application directory to a server. Compatible CPython packages can be added with brython-cli add_package, and Brython packages can bundle modules for hosting. Browser restrictions limit HTTP requests to the same domain or sites allowing cross-origin requests. The documented Python file interface cannot write files, and reading is limited to files accessible through Ajax. Packages that rely on C extensions, including NumPy, Matplotlib, and Pandas, are not supported. Brython is free and open source, and its FAQ says it supports modern browsers, including smartphone browsers.

For and against

For

  • Free and open source.
  • Can be loaded from jsDelivr or cdnjs without installation.
  • Supports asynchronous programming with async and await.
  • Provides Python access to browser DOM objects.

Against

  • Browser limits restrict network requests.
  • The documented file interface cannot write files.
  • CPython packages relying on C extensions are unsupported.

The verdict

Brython brings Python into browser-based web applications, with DOM access and multiple installation or deployment paths. Its browser security and file-access limits, along with the lack of C-extension package support, are important constraints to weigh.

Who it suits

It suits developers who want to use Python to build interactive browser applications. It may be a fit when browser-based limits on network requests, file access, and C-extension packages are acceptable.

On the record

Async programming
The CPython asyncio module is not usable in Brython; the documentation provides the Brython-specific browser.aio module instead.brython.info · read 8 Oct 2026
Browser features
Its examples cover creating and modifying page elements, events, graphics, animations, Ajax requests, and local file selection.brython.info · read 8 Oct 2026
Browser file limits
The browser environment prevents file writing, and file reading is limited to files accessible through Ajax requests.brython.info · read 8 Oct 2026
Browser support
The FAQ says Brython supports all modern browsers, including browsers on smartphones.brython.info · read 8 Oct 2026
Deployment
A Brython application can be deployed by uploading its directory to a server or packaged for distribution through PyPI.brython.info · read 8 Oct 2026
Distribution
Brython packages bundle importable modules in .brython.js files that can be hosted on any server.brython.info · read 8 Oct 2026
DOM interface
Brython provides browser-facing modules for working with the DOM, including document and window.brython.info · read 8 Oct 2026
DOM support
Brython provides access to browser pages through the DOM using the browser module's document and window objects.brython.info · read 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.brython.info · read 8 Oct 2026
HTML elements
The browser.html module exposes HTML4, HTML5, and some HTML5.1 tags as Python classes.brython.info · read 8 Oct 2026
Installation
Brython can be used from jsDelivr or cdnjs without installation, or installed locally with pip or a GitHub release archive.brython.info · read 8 Oct 2026
Install options
Brython can be loaded from jsDelivr or cdnjs without installation, or installed locally with pip or a downloadable release.brython.info · read 8 Oct 2026
Integrations
A CPython package installed with pip can be added to a Brython application with brython-cli add_package.brython.info · read 8 Oct 2026
JavaScript interoperability
Brython provides ways for Python code to use JavaScript objects and libraries.brython.info · read 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.brython.info · read 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.brython.info · read 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.brython.info · read 8 Oct 2026
Purpose
Brython implements Python 3 in the browser and lets developers run Python code in HTML pages.brython.info · read 8 Oct 2026

The review

Brython brings Python 3 programming into HTML pages for interactive browser applications. It suits Python developers who want DOM-oriented interfaces without switching their application code entirely to JavaScript. The trade-off is a browser runtime with tighter package, network, and file-system boundaries than desktop Python.

Overview

Brython implements Python 3 in the browser and exposes browser pages through the browser module, notably its document and window objects. That makes Python syntax usable for page logic, element creation and modification, event handling, graphics, animation, Ajax requests, and local file selection. Its browser.html module represents HTML4, HTML5, and some HTML5.1 elements as Python classes, while JavaScript interoperability lets Python code work with JavaScript objects and libraries.

This is a practical fit for interactive front ends, educational demonstrations, and Python-led prototypes that can live within browser security rules. It is not a replacement for full CPython when the application depends on unrestricted networking, writing files, or scientific packages built with native extensions.

Key features

Python-driven browser interfaces

Brython supports the keywords and functions of the corresponding Python version, subject to JavaScript and browser limitations. The DOM interface gives Python direct control over page structure and browser objects, so developers can express UI behavior in familiar Python rather than translating every interaction into JavaScript.

Asynchronous and JavaScript workflows

The Brython-specific browser.aio module supports async and await. JavaScript interoperability broadens what a Brython application can call, useful when a browser library or object has no direct Python equivalent.

Packages and distribution

A CPython package installed with pip can be added with brython-cli add_package. Brython packages bundle importable modules in .brython.js files that can be hosted on any server. Applications can be deployed by uploading their directory or packaged for distribution through PyPI. Brython includes part of the CPython standard library and supports compatible Python packages, but C-written files are excluded.

Pricing

Brython is free and open source. There are no paid plans, seat charges, quotas, or trial terms to weigh. That makes it suitable for individual developers, classrooms, and teams that need a no-license-cost browser runtime; budgeting instead centers on development and hosting work.

Platforms

Brython supports web, Android, iOS, and self-hosted deployments. It runs in modern browsers, including smartphone browsers. You can load it from jsDelivr or cdnjs without installation, or install it locally with pip or a downloadable GitHub release archive. A deployed application can be served from any server.

Who it's for

Choose Brython when your team knows Python and needs browser DOM access, asynchronous interactions, and a straightforward static deployment path. It is especially appropriate for browser applications whose dependencies are pure Python or JavaScript-compatible.

Look elsewhere when you require NumPy, Matplotlib, Pandas, or other CPython packages that depend on C extensions. Browser rules also prevent writing through the documented Python file interface; reading is limited to files reachable through Ajax. HTTP requests are restricted to the application’s own domain and sites permitting cross-origin requests, so packages such as requests and urllib.request cannot make arbitrary URL calls.

Pros and cons

Pros

  • Python syntax in the browser: lets Python developers build DOM behavior without making JavaScript the primary language.
  • Broad browser-facing toolkit: covers elements, events, graphics, animation, Ajax, local file selection, and async code.
  • Flexible delivery: CDN loading, pip or archive installation, server upload, and PyPI packaging suit both quick experiments and self-hosted applications.
  • JavaScript interoperability: provides an escape hatch when browser libraries or objects are outside Brython’s own modules.

Cons

  • Native-package ceiling: C-extension dependencies such as NumPy, Matplotlib, and Pandas do not run.
  • Constrained files and networking: browser security blocks file writing, limits reads, and restricts cross-origin HTTP requests.
  • Browser dependence: Python behavior remains subject to JavaScript and browser limitations rather than unrestricted CPython behavior.

Alternatives

For a broader comparison, see Code Transpilers.

  • J2ObjC is a free, open-source option for converting Java to Objective-C on macOS, Linux, and iOS.
  • SWC is a free Rust-based developer toolchain with web, API, desktop, mobile, and Windows coverage.
  • JSweet is a free open-source Java-to-JavaScript transpiler when Java is your source language.
  • js_of_ocaml is a free web and API-oriented choice for OCaml applications, with no paid plans or stated usage limits.
  • Skulpt is a free web-only alternative for running Python in browser contexts.
  • Transcrypt is a free Apache 2.0 open-source Python-to-JavaScript option with self-hosted and desktop platform coverage.
  • TypeScript Playground is a free browser-based workspace focused on a single text document.
  • Babel is a free, community-funded transpiler with API, desktop, web, and Windows support.

Verdict

Brython is a strong choice for Python-first teams building interactive browser pages that can stay within pure-Python dependencies and browser security rules. Its free open-source model, DOM access, async support, and flexible deployment are compelling. Choose another tool if native scientific packages, unrestricted HTTP, or normal file-system access are central to the application.

Alternatives to Brython

Every alternative, ranked