Generate a webpage as a GUI for a Python script, and serve from anywhere.
Project description
Python Web I/O
Generate a webpage as a GUI for a Python script, and serve from anywhere.
Documentation
Check out the wiki.
Quickstart
Install python-web-io
locally using:
pip install python-web-io
Or via poetry
using:
poetry add python_web_io
If evaluating / testing python-web-io
, install dependencies for the example apps using:
poetry add python_web_io --with examples
After installing the project, some environment setup is required:
Required setup
Create an app.py
file containing your script, and an .envrc
file to store project secrets. (Note: remember to add .envrc
to your .gitignore
)
Look for example apps in ./python_web_io/examples
.
.
├── .envrc
├── config.toml
└── app.py
Add the following environment variables to your .envrc
. (Note: remember to activate the .envrc
in your terminal using direnv allow
)
# server env vars
export PYTHON_WEB_IO_SECRET=""
export PYTHON_WEB_IO_CONFIG=".pythonwebio/config.toml" # defaults to .pythonwebio/config.toml if not set
Generate a random key for PYTHON_WEB_IO_SECRET
using this python command line snippet:
python -c 'import secrets; print(secrets.token_hex())'
If testing wikipedia_assistant.py
, an OpenAI API key will also need to be set.
export OPENAI_API_KEY=""
Running the webapp
We recommend running python_web_io
using uvicorn
:
poetry run uvicorn python_web_io.main:app
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for python_web_io-0.1.16-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc7afa44957a27764359285fee5d81481d0b21b51beaad1b830535763f3a9c3e |
|
MD5 | fcf7b4206be07e286ff5dd30bbce46ad |
|
BLAKE2b-256 | dc4449f699e80aecfe7170aac0491fe8f69966cfdde5055973827ac54c295c41 |