Skip to main content

Generate a webpage as a GUI for a Python script, and serve from anywhere.

Project description

Sticker of a cute yellow Python snake, representing the use of the Python programming language in this project. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_web_io-0.1.15.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

python_web_io-0.1.15-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file python_web_io-0.1.15.tar.gz.

File metadata

  • Download URL: python_web_io-0.1.15.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.9.2 Linux/5.15.90.1-microsoft-standard-WSL2

File hashes

Hashes for python_web_io-0.1.15.tar.gz
Algorithm Hash digest
SHA256 7dc3a776ded5b0ada1ba1dfe6f4d2babe9cc054c2ef70197ea5f2f90281ad613
MD5 b9f63fbb8b8177253a15950f64508ae2
BLAKE2b-256 e7eb66fdfa8f44102dfd245301598da2551f22395acf8d604f8a3732d2fdcd7e

See more details on using hashes here.

File details

Details for the file python_web_io-0.1.15-py3-none-any.whl.

File metadata

  • Download URL: python_web_io-0.1.15-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.9.2 Linux/5.15.90.1-microsoft-standard-WSL2

File hashes

Hashes for python_web_io-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 791ab57951b109c3ce5fa295e4288bb51e41509a98114b49116b5636b4ae6f53
MD5 e4fde088c6326450baada579bef2b660
BLAKE2b-256 54293d6a6451e18ab62035637978c3c501c759a8cf03e7c4004b20c3b2a918a4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page