Skip to main content

Streamlit, but better.

Project description

swole

Streamlit, but better.

test status release doc status

DescriptionInstallUsageContributeFAQ
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.3.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swole-0.0.3-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file swole-0.0.3.tar.gz.

File metadata

  • Download URL: swole-0.0.3.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.0

File hashes

Hashes for swole-0.0.3.tar.gz
Algorithm Hash digest
SHA256 9aa7978047f58b5fd34ca8aa26bb5ded4ef2db5148fbd9ce35d15857d47b6ee3
MD5 07014bb9b9196cfe427d04bab9b95ede
BLAKE2b-256 ca2f9973549b9bd3389b162cb74360afe381a88a4f35da21140971321181cc36

See more details on using hashes here.

File details

Details for the file swole-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: swole-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.0

File hashes

Hashes for swole-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3dd969f48a9ae410c4ac636d850407a1b9902654b49306f8ee232d744a78e609
MD5 520bac412e0082952e42d853dfb2317a
BLAKE2b-256 cc15ec7177457b1cd2f020d49c7b447f45ec79c90f14f4a05688800cd8c03125

See more details on using hashes here.

Supported by

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