Skip to main content

swole

Streamlit, but better.

⚠️ For now this is an Alpha version, only a proof-of-concept. Only minimal features are implemented

test status release doc status

Description • Install • Usage • Examples • FAQ • Contribute
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
  • 💎 Transparent (streamlit is opaque)
  • Doge power !

Install

Simply run :

pip install swole

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 !

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
  • Not transparent
  • 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 do you say swole is "transparent" but streamlit is "opaque" ?

On a swole page, try to "view the page source" (right-click).
Now, do the same on a streamlit page, and compare. 😇

Why this name ?

It all comes from a meme :

Contribute

Fork the repository, clone it locally, install it 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 !


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"

Ensure tests are passing :

pip install pytest

python -m pytest -W ignore::DeprecationWarning

Submit your PR !

Metadata

Release files for swole 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for swole 0.0.4
File Size Uploaded Provenance
swole-0.0.4.tar.gz 13.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for swole 0.0.4
File Interpreter ABI Platform
swole-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 28.6 kB

Release files / swole-0.0.4.tar.gz

Download URL swole-0.0.4.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
997aa8030c05b1d3e05213e9f85bb3fde3696aee1a1c592a9e05c9b317a8a4e0
BLAKE2b-256 checksum
How to use checksums
88f1be699180aa3b0752e0b2e1993c10fc893b7ed4682609aaad1236523197cc
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / swole-0.0.4-py3-none-any.whl

Download URL swole-0.0.4-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5eaa69d510de5def7b0ad6e5a4c80c131f5ee4dd437b42baa385a0bbe693bfca
BLAKE2b-256 checksum
How to use checksums
d1b37f764778ce11d3651d5d58f574cfb11f1f305d2e25cf57924f260ac8a4ac
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for swole 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page