High-performance Flask-like web framework with C++ backend
Project description
QSEWeb
High-performance web framework with C++ backend. Call Python from JavaScript easily.
Install
pip install qseweb
Example
import qseweb
app = qseweb.QSEWeb()
@app.assign("Btn")
def button():
print("Button clicked")
return "success"
@app.serve("/")
def main():
return """
<html>
<body>
<h1>Click the button</h1>
<button onclick="button()">Click me</button>
<script>
async function button() {
const response = await qse.Btn();
alert(response);
}
</script>
</body>
</html>
"""
print("Starting server on http://localhost:5000")
app.run()
That's it! Run it and click the button.
How it works
- Use
@app.assign("name")to expose Python functions - Call them from JavaScript with
await qse.name() - Python function runs, returns result to JavaScript
API
Create app
app = qseweb.QSEWeb() # Default: 0.0.0.0:5000
app = qseweb.QSEWeb(port=8080) # Custom port
Make routes
@app.serve("/")
def home():
return "<h1>Hello</h1>"
@app.serve("/about")
def about():
return "<h1>About page</h1>"
Call Python from JavaScript
@app.assign("greet")
def greet(name):
return f"Hello {name}!"
const msg = await qse.greet("World"); // "Hello World!"
Get request data
@app.serve("/api")
def api(request):
user_id = request['query'].get('id') # Query params
method = request['method'] # GET, POST, etc
path = request['path'] # URL path
body = request.get('body', '') # Request body
return f"User: {user_id}"
Stop server
app.stop()
# Or from web:
@app.serve("/shutdown")
def shutdown():
import threading
threading.Thread(target=app.stop, daemon=True).start()
return "Stopping..."
Examples
python examples/basic.py # Hello world
python examples/javascript_bridge.py # JS ↔ Python
python examples/server_control.py # Start/stop
python examples/advanced.py # Full demo
Features
- ✅ Flask-like API
- ✅ Call Python from JavaScript (
qse.function()) - ✅ Multi-threaded C++ backend
- ✅ Fast routing
- ✅ Async with Ctrl+C support
- ✅ Pre-compiled (no build needed)
Requirements
- Python 3.7+
- Windows (pre-compiled .pyd included)
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
qseweb-1.0.5.tar.gz
(48.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
qseweb-1.0.5-py3-none-any.whl
(39.3 kB
view details)
File details
Details for the file qseweb-1.0.5.tar.gz.
File metadata
- Download URL: qseweb-1.0.5.tar.gz
- Upload date:
- Size: 48.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3402b9d51e2d1ff57a1b7bdd5bb5958ff70dd7b1dee3e63c712450ed983fb336
|
|
| MD5 |
0d4cf4e62bbc14ae30e680037e56eea6
|
|
| BLAKE2b-256 |
0fad62765f6bd9aa54b27e7426a03ce08fb4174150c52c4018b3a90e07ba99cf
|
File details
Details for the file qseweb-1.0.5-py3-none-any.whl.
File metadata
- Download URL: qseweb-1.0.5-py3-none-any.whl
- Upload date:
- Size: 39.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b937e997f5ef1dd0566c3a09bd2f75dffa97bfeddcbde697f4bb868296bd139f
|
|
| MD5 |
fb72560c692477b6dd23b61a8d357cae
|
|
| BLAKE2b-256 |
8392121eeb9f82708228a4f658c1a78d63c49412e242a38e9c206588efbbba8b
|