Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/astariul/swole
Streamlit, but better.
https://github.com/astariul/swole
doge fast-api hacktoberfest open-source streamlit
Last synced: 4 months ago
JSON representation
Streamlit, but better.
- Host: GitHub
- URL: https://github.com/astariul/swole
- Owner: astariul
- Created: 2020-08-31T09:37:26.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-02-05T23:53:16.000Z (12 months ago)
- Last Synced: 2024-09-28T13:41:25.182Z (4 months ago)
- Topics: doge, fast-api, hacktoberfest, open-source, streamlit
- Language: Python
- Homepage:
- Size: 1.5 MB
- Stars: 15
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
swole
Streamlit, but better._⚠️ For now this is an Alpha version, only a **proof-of-concept**. Only minimal features are implemented_
Description •
Install •
Usage •
Examples •
FAQ •
Contribute
Documentation
Description
[`streamlit`](https://github.com/streamlit/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`](https://fastapi.tiangolo.com/) as backend
* **🦋 Easily customizable** through the usage of skins
* **💎 Transparent** (`streamlit` is opaque)
* ** Doge power !**Install
Simply run :
```console
pip install swole
```Usage
Create a few `Widget` for your page :
```python
from swole.widgets import Input, Button, Markdowni_a = Input()
i_b = Input()
m = Markdown("Result : ")
```---
Add some callbacks through AJAX requests :
```python
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 :
```python
from swole import Applicationif __name__ == "__main__":
Application().serve()
```---
Visit [`127.0.0.1:8000`](http://127.0.0.1:8000) :
---
_For more examples, check the [`examples`](https://github.com/astariul/swole/tree/master/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 developer 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 :
```console
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 :
```console
pip install flake8flake8 . --count --max-complexity=10 --max-line-length=127 --statistics --per-file-ignores="__init__.py:F401"
```---
Ensure tests are passing :
```console
pip install pytestpython -m pytest -W ignore::DeprecationWarning
```---
Submit your PR !