Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

403 Commits

PYTML - Python in Your Browser

WikidataNUmber of times Pytml usedWebsiteGitHub starsLicenseGitHub issuesGitHub last commitSWH

Run Python in your browser with zero configuration – no server, just a script tag.

Pytml is a lightweight (~15KB) JavaScript library that acts as a bridge between Python and HTML via WebAssembly. Drop a single script tag into any static page, write your logic inside <py> tags, and it runs natively in the browser.


Quick Start

Add one line to your HTML:

<scriptsrc="https://pytml.vercel.app/pytml.js"></script>

Usage

Option 1: Inline Python (Recommended for mobile/local)

<!DOCTYPE html><html><head><scriptsrc="https://pytml.vercel.app/pytml.js"></script></head><body><py>
print("Hello, world!")
name = input("Your name? ")
print(f"Hi {name}!")
</py></body></html>

Option 2: External Python File (HTTP/HTTPS only)

<!DOCTYPE html><html><head><scriptsrc="https://pytml.vercel.app/pytml.js"></script></head><body><scripttype="text/python" src="script.py"></script></body></html>
name=input("Enter your name: ")
age=input("Enter your age: ")
print(f"Hello {name}, you are {age} years old!")

Important for Local Users (file:// protocol)

If you're running HTML locally from your device (mobile or desktop):

Use inline tags — This is the only method that works with file:// protocol

Features

Zero config – just add one script tag

Real I/O – print() and input() work live in the browser

Full error tracebacks – debug like a local REPL

Package support – NumPy, Pandas, Matplotlib via micropip

Privacy-first – no code ever leaves your browser

15KB wrapper – Pyodide loads lazily, page isn't blocked

Links

Official Website

License

Pytml is open-source under the Apache 2.0 License.

Support

If you find Pytml useful, consider giving it a star on GitHub!

About

Pytml is a easy and lazy way to connect py files to html.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages