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
Release files for qseweb 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| qseweb-1.0.5.tar.gz | 48.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| qseweb-1.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 88.1 kB
Release files / qseweb-1.0.5.tar.gz
| Download URL | qseweb-1.0.5.tar.gz |
|---|---|
| Size | 48.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3402b9d51e2d1ff57a1b7bdd5bb5958ff70dd7b1dee3e63c712450ed983fb336
|
|
BLAKE2b-256 checksum How to use checksums |
0fad62765f6bd9aa54b27e7426a03ce08fb4174150c52c4018b3a90e07ba99cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / qseweb-1.0.5-py3-none-any.whl
| Download URL | qseweb-1.0.5-py3-none-any.whl |
|---|---|
| Size | 39.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b937e997f5ef1dd0566c3a09bd2f75dffa97bfeddcbde697f4bb868296bd139f
|
|
BLAKE2b-256 checksum How to use checksums |
8392121eeb9f82708228a4f658c1a78d63c49412e242a38e9c206588efbbba8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|