templates and pyscript wrappers for various bootstrap properties
Go to file
Jonas Weinz 75efac61b9 updated readmy 2023-06-11 18:49:04 +02:00
dist update examples 2023-06-11 18:43:29 +02:00
examples update examples 2023-06-11 18:43:29 +02:00
img add some documentation 2023-06-04 19:18:57 +02:00
pyscript_bootstrap_templates change default package path to github 2023-06-04 20:23:11 +02:00
.gitignore Initial commit 2022-07-24 11:13:19 +02:00
LICENSE Initial commit 2022-07-24 11:13:19 +02:00
MANIFEST.IN initial pwa support 2022-10-16 10:23:01 +02:00
README.md updated readmy 2023-06-11 18:49:04 +02:00
build.sh many small improvements 2023-06-04 18:51:06 +02:00
setup.py forgot to add setup.py 2022-10-16 17:04:00 +02:00

README.md

pyscript-bootstrap-templates

This package provides tools to write single page Dashboard apps with python that run entirely client-side in the Browser. To do this, it uses pyscript and builds python wrapper classes for various bootstrap elements.

image-20230604191240295

installation

pip install git+https://github.com/antielektron/pyscript_bootstrap_templates.git

usage

create a project

to create a new project, run

pyscript_bootstrap_app create <project_name> <title> --packages PACKAGES [PACKAGES ...]
  • this will create a new folder containing a PWA app skeleton to start with. The main entry point should be in main.py

  • this will also create all necessary files such that this app can operate as an standalone PWA application.

  • the packages parameter is optional, you can specify on which PyPi packages your code depends

update a project

Since it's a pwa, browsers will cache all content of the app for offline usage. To bump the version of the PWA and trigger a redownload after the project has changed, simply run

pyscript_bootstrap_app update <project_name> <title>

serving a project for development

you can use python's builtin webserver to serve the files locally for testing. Just run

python -m http.server 1111

inside your project folder and navigate to http://localhost:1111 in your browser

advanced usage

There are a few more options you can pass to pyscript_bootstrap_app (e.g. the pyscript version that is used). Here is the full list:

usage: pyscript_bootstrap_app [-h] [--packages PACKAGES [PACKAGES ...]] [--paths PATHS [PATHS ...]] [--pyscript-css-url PYSCRIPT_CSS_URL] [--pyscript-js-url PYSCRIPT_JS_URL]
                              [--pyscript-py-url PYSCRIPT_PY_URL] [--bootstrap-css-url BOOTSTRAP_CSS_URL] [--bootstrap-js-url BOOTSTRAP_JS_URL]
                              [--pyscript-bootstrap-templates-wheel-url PYSCRIPT_BOOTSTRAP_TEMPLATES_WHEEL_URL] [--pwa-bg-color PWA_BG_COLOR] [--pwa-theme-color PWA_THEME_COLOR]
                              {create,update} root_folder title

create a new pyscript project

positional arguments:
  {create,update}
  root_folder           the root folder of the new project
  title                 the title of the new project

options:
  -h, --help            show this help message and exit
  --packages PACKAGES [PACKAGES ...]
                        the packages to include in the new project
  --paths PATHS [PATHS ...]
                        additional local python files to include in the new project
  --pyscript-css-url PYSCRIPT_CSS_URL
                        the url of the pyscript css file
  --pyscript-js-url PYSCRIPT_JS_URL
                        the url of the pyscript js file
  --pyscript-py-url PYSCRIPT_PY_URL
                        the url of the pyscript py file
  --bootstrap-css-url BOOTSTRAP_CSS_URL
                        the url of the bootstrap css file
  --bootstrap-js-url BOOTSTRAP_JS_URL
                        the url of the bootstrap js file
  --pyscript-bootstrap-templates-wheel-url PYSCRIPT_BOOTSTRAP_TEMPLATES_WHEEL_URL
                        the url of the pyscript bootstrap templates wheel file
  --pwa-bg-color PWA_BG_COLOR
                        background color for pwa configuration
  --pwa-theme-color PWA_THEME_COLOR
                        theme color for pwa configuration