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.0rc4.tar.gz
.
File metadata
- Download URL: flask-socketio-lit-html-0.1.0rc4.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 | e820b927380e697854fcb6653565cfad4883190d4a8fdc5774f13f5686e3853e |
|
MD5 | 29889fae6d307f97dbb3e8f5f35b5834 |
|
BLAKE2b-256 | 0f130cc63a099829615b7447ec294834279e025f35178b32dcc0371f6626c17c |
File details
Details for the file flask_socketio_lit_html-0.1.0rc4-py3-none-any.whl
.
File metadata
- Download URL: flask_socketio_lit_html-0.1.0rc4-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 | d2cddec8bdc332fa5ca956cfc1f80db769ac5f4dff0d047abd22d8bf207785fc |
|
MD5 | 8c4885fd5b4640dea6885c993fe12506 |
|
BLAKE2b-256 | 4ae48f29bb6a1b49076a53f6d42fed8e43dffe9633674164ba2f94db027dbd4f |