WEP is a lightweight server-side template engine and micro-framework that lets you embed native Python directly inside HTML using
.wep
files and<wep>
tags. Inspired by PHP, WEP enables rapid prototyping and AI-powered dynamic web content — without the complexity of separate frontend/backend stacks or REST APIs.
- ✅ Write Python directly inside HTML using
<wep>...</wep>
blocks - ✅ Output content using the simple
echo()
function - ✅ Built with Flask under the hood
- ✅ Minimal setup — no frontend frameworks or build tools needed
- ✅ Ideal for quick demos, server-rendered sites, teaching, and prototyping AI apps
- ✅ Supports special variables like
_GET
,_POST
,GLOBAL
, andSESSION
inside<wep>
blocks for handling requests and session data
- Python 3.7+
git
pip
(Python package manager)uv
(modern Python package manager — install withpip install uv
)
-
Clone this repository:
git clone https://github.com/prodev717/web-embedded-python.git
-
Navigate to the project folder:
cd web-embedded-python
-
Install
uv
if you don’t already have it:pip install uv
-
Install dependencies:
uv add flask
-
Run the server:
uv run main.py
-
Visit your app:
http://localhost:8000
web-embedded-python/
├── public/
│ ├── index.wep # Homepage with embedded Python
│ ├── demo.wep # Optional additional demo
│ └── style.css # Any static assets (CSS, JS, images)
└── main.py # Flask-based server
.wep
files are HTML with embedded Python blocks inside <wep>...</wep>
tags:
<!DOCTYPE html>
<html>
<head><title>WEP Example</title></head>
<body>
<h1>Hello from WEP</h1>
<wep>
echo("<p>This is Python inside HTML!</p>")
import sys
echo(f"<pre>Python version: {sys.version}</pre>")
for i in range(3):
echo(f"<p>Loop: {i}</p>")
</wep>
</body>
</html>
- Python code inside
<wep>
must be zero-indented (start from column 0). - Nested
<wep>
tags are not supported. - Use the global
echo()
function to write content to the HTML output. - Use standard Python imports as needed.
.wep
files are best for lightweight server-side logic, not heavy lifting.
Need extra packages (e.g., requests
, openai
, pandas
)?
Just run:
uv add package_name
Found a bug or have an idea? Feel free to open an issue or submit a pull request. Contributions welcome!
Licensed under the MIT License.
WEP is inspired by PHP's simplicity, adapted for the Python ecosystem. It’s perfect for Python devs who want to prototype fast — without learning a new frontend stack.