hstream


Namehstream JSON
Version 0.0.20 PyPI version JSON
download
home_pagehttps://github.com/conradbez/hstream
SummaryCreate python webapps with ease
upload_time2023-05-22 12:15:29
maintainer
docs_urlNone
authorConrad Bezuidenhout
requires_python
licenseBSD
keywords streamlit htmx fastapi
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # HStream

Easiest interactive python web app using htmx and semantic html

# Usage

`pip install hstream`

```
# main.py

from hstream import hs

visitor_name = hs.text_input("What's your name?", default_value = "friend")

hs.markdown(f"Welcome {visitor_name}")
```

`python -m hstream main.py`

![hstream demo](./demo/hello_hstream.png)

or here's a fuller [example](./demo/example.py)

![hstream demo](./demo/example_demo.gif)


# Examples
- [Select demo](./demo/select.md)
- [Static files](./demo/static_files.md)
- [Theming](./demo/theming.md)
- [More](./demo)
# Motivation

Love Streamlit but:

- impossible to customise beyond PoC phase
- hard to reason about when extending and deploying
- non-standard approach doesn't play nicely with existing ecosystems

H-(html)-Stream is built with semantic html, FastApi and htmx to provide a fast and simple framework for rapid web app development that follows traditional frontend/server architecture (or at least follow it closer than Streamlit).

# Features

- [x] live server reload on file change (through univorn)
- [x] semantic html and basic html manipulation from within script
- [x] basic components - see below
- [x] swap stylesheet
- [x] complex html manipulation from within script (setting attributes)
- [x] plotly plot support
- [x] select component
- [x] multi select component
- [ ] auto ssl certs for easy deployment
- [ ] example component architecture
- [ ] reload browser on code change

# Bugs

- key handling is a little inconsistent and it's not clear to the user when they need to use keys - meaning if you run into reloading / rending issues provide all you components with unique `key` parameter

## Components

`hs.markdown`

`hs.text_input`

`hs.checkbox`

`hs.button`: renders and evaluates to true if the user click the button (still a little unsure exactly how this should be implemented as evaluating to true doesn't quite capture the ideal of pressing a button)

`hs.slider`: numeric slider input

`hs.plot`: output matplotlib figures to the user

`hs.image`: display an image

`hs.html`: allows more complex formatting, for example:

- a html form

```
from hstream import hs
with hs.html('form'):
    hs.text_input('Name')
    hs.checkbox('Would you like to be my friend?')
```

![hstream form demo](docs/form_example.png)

- a card provided by [mvp.css](https://andybrewer.github.io/mvp/)

```
from hstream import hs
with hs.html('section'):
    with hs.html('aside'):
        hs.markdown('We can make some beautiful pages very simply')
    with hs.html('aside'):
        hs.markdown('For example these responsive cards, which respond to screen sizes')
    with hs.html('aside'):
        hs.markdown('Thanks to: ')
        with hs.html('a', href='https://andybrewer.github.io/mvp/'):
            hs.markdown('mvp.css')
```

![hstream form demo](docs/card_example.png)

`hs.stylesheet_href = https://unpkg.com/@vladocar/basic.css@1.0.3/css/basic.css` to use a different classless css framework

`hs.app`: to directly access the FastAPI instance if you want to extend it like a normal webserver (i.e. add custom paths, static files ect.)

# Technologies

Big thanks to the following libraries in particular

- Streamlit
- htmx
- Yattag
- pico css
- MVP.css
- FastAPI
- uvicorn

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/conradbez/hstream",
    "name": "hstream",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "streamlit htmx fastapi",
    "author": "Conrad Bezuidenhout",
    "author_email": "conradbez1@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/81/64/c8e25a8628c6f0ce93d349885dfaf7a6d5cfff3783bbae1fb033af7f3720/hstream-0.0.20.tar.gz",
    "platform": null,
    "description": "# HStream\n\nEasiest interactive python web app using htmx and semantic html\n\n# Usage\n\n`pip install hstream`\n\n```\n# main.py\n\nfrom hstream import hs\n\nvisitor_name = hs.text_input(\"What's your name?\", default_value = \"friend\")\n\nhs.markdown(f\"Welcome {visitor_name}\")\n```\n\n`python -m hstream main.py`\n\n![hstream demo](./demo/hello_hstream.png)\n\nor here's a fuller [example](./demo/example.py)\n\n![hstream demo](./demo/example_demo.gif)\n\n\n# Examples\n- [Select demo](./demo/select.md)\n- [Static files](./demo/static_files.md)\n- [Theming](./demo/theming.md)\n- [More](./demo)\n# Motivation\n\nLove Streamlit but:\n\n- impossible to customise beyond PoC phase\n- hard to reason about when extending and deploying\n- non-standard approach doesn't play nicely with existing ecosystems\n\nH-(html)-Stream is built with semantic html, FastApi and htmx to provide a fast and simple framework for rapid web app development that follows traditional frontend/server architecture (or at least follow it closer than Streamlit).\n\n# Features\n\n- [x] live server reload on file change (through univorn)\n- [x] semantic html and basic html manipulation from within script\n- [x] basic components - see below\n- [x] swap stylesheet\n- [x] complex html manipulation from within script (setting attributes)\n- [x] plotly plot support\n- [x] select component\n- [x] multi select component\n- [ ] auto ssl certs for easy deployment\n- [ ] example component architecture\n- [ ] reload browser on code change\n\n# Bugs\n\n- key handling is a little inconsistent and it's not clear to the user when they need to use keys - meaning if you run into reloading / rending issues provide all you components with unique `key` parameter\n\n## Components\n\n`hs.markdown`\n\n`hs.text_input`\n\n`hs.checkbox`\n\n`hs.button`: renders and evaluates to true if the user click the button (still a little unsure exactly how this should be implemented as evaluating to true doesn't quite capture the ideal of pressing a button)\n\n`hs.slider`: numeric slider input\n\n`hs.plot`: output matplotlib figures to the user\n\n`hs.image`: display an image\n\n`hs.html`: allows more complex formatting, for example:\n\n- a html form\n\n```\nfrom hstream import hs\nwith hs.html('form'):\n    hs.text_input('Name')\n    hs.checkbox('Would you like to be my friend?')\n```\n\n![hstream form demo](docs/form_example.png)\n\n- a card provided by [mvp.css](https://andybrewer.github.io/mvp/)\n\n```\nfrom hstream import hs\nwith hs.html('section'):\n    with hs.html('aside'):\n        hs.markdown('We can make some beautiful pages very simply')\n    with hs.html('aside'):\n        hs.markdown('For example these responsive cards, which respond to screen sizes')\n    with hs.html('aside'):\n        hs.markdown('Thanks to: ')\n        with hs.html('a', href='https://andybrewer.github.io/mvp/'):\n            hs.markdown('mvp.css')\n```\n\n![hstream form demo](docs/card_example.png)\n\n`hs.stylesheet_href = https://unpkg.com/@vladocar/basic.css@1.0.3/css/basic.css` to use a different classless css framework\n\n`hs.app`: to directly access the FastAPI instance if you want to extend it like a normal webserver (i.e. add custom paths, static files ect.)\n\n# Technologies\n\nBig thanks to the following libraries in particular\n\n- Streamlit\n- htmx\n- Yattag\n- pico css\n- MVP.css\n- FastAPI\n- uvicorn\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Create python webapps with ease",
    "version": "0.0.20",
    "project_urls": {
        "Homepage": "https://github.com/conradbez/hstream"
    },
    "split_keywords": [
        "streamlit",
        "htmx",
        "fastapi"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f2383ef6e00bf1c628d4d74c568fb17aee5c6021977d3f0b22ef488cf65c9c2d",
                "md5": "9f9053cd5d30825f376666be81d6f3f0",
                "sha256": "00804c8625ac968152edc0f7ffc62b9e925d74a544760cec593a853a405679b3"
            },
            "downloads": -1,
            "filename": "hstream-0.0.20-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9f9053cd5d30825f376666be81d6f3f0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 15649,
            "upload_time": "2023-05-22T12:15:26",
            "upload_time_iso_8601": "2023-05-22T12:15:26.315486Z",
            "url": "https://files.pythonhosted.org/packages/f2/38/3ef6e00bf1c628d4d74c568fb17aee5c6021977d3f0b22ef488cf65c9c2d/hstream-0.0.20-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8164c8e25a8628c6f0ce93d349885dfaf7a6d5cfff3783bbae1fb033af7f3720",
                "md5": "8cbefbe4028848c109a3fb828a265c32",
                "sha256": "a080208df85af49334e3a5f847bb2815c282558f6e9fea90c003d8711992b7d7"
            },
            "downloads": -1,
            "filename": "hstream-0.0.20.tar.gz",
            "has_sig": false,
            "md5_digest": "8cbefbe4028848c109a3fb828a265c32",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 16006,
            "upload_time": "2023-05-22T12:15:29",
            "upload_time_iso_8601": "2023-05-22T12:15:29.851670Z",
            "url": "https://files.pythonhosted.org/packages/81/64/c8e25a8628c6f0ce93d349885dfaf7a6d5cfff3783bbae1fb033af7f3720/hstream-0.0.20.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-22 12:15:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "conradbez",
    "github_project": "hstream",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "hstream"
}
        
Elapsed time: 0.06766s