Skip to main content

Streamlit, but better.

Project description

swole

Streamlit, but better.

test status

Description • Install • Usage • Contribute • FAQ
Documentation

Description

streamlit is a framework that let you build beautiful apps in only a few lines of code, with only pure python.

swole is doing the same job, with additional features :

  • âš¡ Highly performant with FastAPI as backend
  • 🦋 Easily customizable through the usage of skins
  • Doge power !

Install

Simply run :

pip install git+https://github.com/astariul/swole.git

This package is not yet published on PyPi because it's still a prototype

Usage

Create a few Widget for your page :

from swole.widgets import Input, Button, Markdown

i_a = Input()
i_b = Input()
m = Markdown("Result : ")

Add some callbacks through AJAX requests :

from swole import ajax

@ajax(i_a, i_b)
def addition(a, b):
    res = a + b
    m.set("Result : {}".format(res))

Button("Compute", onclick=addition)

Serve your app :

from swole import Application

if __name__ == "__main__":
    Application().serve()

Visit 127.0.0.1:8000 :


For more examples, check the examples folder !

Contribute

Clone the repository, install and create your own branch :

git clone https://github.com/astariul/swole.git
cd swole
pip install -e .
git checkout -b my_branch

Add your dogesome code !

Don't forget to update tests and documentation !


Ensure tests are passing :

pip install pytest

python -m pytest -W ignore::DeprecationWarning

Check if code is well-formated :

pip install flake8

flake8 . --count --max-complexity=10 --max-line-length=127 --statistics --per-file-ignores="__init__.py:F401"

Submit your PR !

FAQ

Why using swole ? Why not streamlit ?

Don't get me wrong, streamlit is an awesome framework. swole just try to fix a few problematic issues of streamlit :

  • It uses Flask, which is outdated and not performant when compared to FastAPI.
  • No customization possible
  • No control over user's interaction with the page
  • No Doge 😢

How swole's backend and frontend communicate ?

Unlike streamlit, which use a system of cache and reload the page everytime someone interact with it, swole uses AJAX requests to update the frontend.

Reloading the page every interaction is very inefficient, and irritating for the user's experience.

Using AJAX instead makes the whole process almost invisible for the user, and everything is more clear for the developper because we know what data is sent when.

Why this name ?

It all comes from a meme :

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

swole-0.0.1.tar.gz (12.1 kB view hashes)

Uploaded Source

Built Distribution

swole-0.0.1-py3-none-any.whl (12.9 kB view hashes)

Uploaded Python 3

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