Skip to main content

Simple Webcomponents with flask

Project description

ForTheBadge uses-badges ForTheBadge uses-badges ForTheBadge uses-badges

Version: Alpha License: MIT Pypi version ReadTheDocs Travis (.org)

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 !

Edit with Gitpod

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask-socketio-lit-html-0.1.0rc4.tar.gz (5.9 kB view details)

Uploaded Source

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

Hashes for flask-socketio-lit-html-0.1.0rc4.tar.gz
Algorithm Hash digest
SHA256 e820b927380e697854fcb6653565cfad4883190d4a8fdc5774f13f5686e3853e
MD5 29889fae6d307f97dbb3e8f5f35b5834
BLAKE2b-256 0f130cc63a099829615b7447ec294834279e025f35178b32dcc0371f6626c17c

See more details on using hashes here.

File details

Details for the file flask_socketio_lit_html-0.1.0rc4-py3-none-any.whl.

File metadata

File hashes

Hashes for flask_socketio_lit_html-0.1.0rc4-py3-none-any.whl
Algorithm Hash digest
SHA256 d2cddec8bdc332fa5ca956cfc1f80db769ac5f4dff0d047abd22d8bf207785fc
MD5 8c4885fd5b4640dea6885c993fe12506
BLAKE2b-256 4ae48f29bb6a1b49076a53f6d42fed8e43dffe9633674164ba2f94db027dbd4f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page