Simple Webcomponents with flask
Project description
Flask-Socket.IO-lit-html
Webcomponents with Flask and SocketIO
Proof of concept project to use Webcomponents in Python Flask
- Generate a restful API (inspired from Flask-Restful)
- Update html on data changes through socketio (Inspired from Angular properties reflection)
Usage philosophy
Create user webcomponent from sqlalchemy design:
class User(db.Model):
username = db.Column(db.String(80), nullable=False)
blueprint = User.register("/user", "user-item", "user.html")
app.register_blueprint(blueprint)
Display the second user of your database:
<script type="module" src="{{url_for('user-item.webcomponent')}}"></script>
<div> user 2: <user-item index=2 ></user-item></div>
This code represent the idea behind the module, it's not real code, look at app.py for a working example.
Contribute : Pull requests are welcome !
Updating autodoc
cd docs && sphinx-apidoc -o source/ ../flask_socketio_lit_html
Build and publish package
poetry build
Just increment the version in pyproject.toml to publish after tests are succesfully passed (see .travis.yml)
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
Built Distribution
File details
Details for the file flask-socketio-lit-html-0.1.0rc5.tar.gz
.
File metadata
- Download URL: flask-socketio-lit-html-0.1.0rc5.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.1 Linux/4.15.0-1028-gcp
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac876b13183c989ba8d86ee4d06c883d5553d5f1c447db5c1ad1b7d83d039ce0 |
|
MD5 | c053286b236ce2aa64170f91dd27b33a |
|
BLAKE2b-256 | 602725468c9a048a363e9749961d5073cda24401cfc1b4976a6c35a306401e3c |
File details
Details for the file flask_socketio_lit_html-0.1.0rc5-py3-none-any.whl
.
File metadata
- Download URL: flask_socketio_lit_html-0.1.0rc5-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.1 Linux/4.15.0-1028-gcp
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 250ad143655b190628fb7c14ad1511801671801ca32165c4b84286d0963b4ca4 |
|
MD5 | a7312de22fe58562d69b579fabebf89a |
|
BLAKE2b-256 | 91f50e6a87f3a0f20c8f5c948d421ae83f11f0e43f52a8766c79708f737fc25e |