Skip to main content

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, a config.toml setting the script filepath and entrypoint, and an .envrc file to store project secrets. (Note: remember to add .envrc to your .gitignore). Look for example apps in /examples.

.
├── .envrc
├── config.toml
└── app.py

Create the following simple config.toml:

[script]
filepath = "app.py"
entrypoint = "main"	# if your app has no entrypoint, remove this parameter.

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

Metadata

Release files for python-web-io 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-web-io 0.2.3
File Size Uploaded
python_web_io-0.2.3.tar.gz 11.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-web-io 0.2.3
File Interpreter ABI Platform
python_web_io-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 23.8 kB

Release files / python_web_io-0.2.3.tar.gz

Download URL python_web_io-0.2.3.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
927a591220c7d9af6a1c4af49f8412b53c8231102de5c2ba5c53abbd8f59ada1
BLAKE2b-256 checksum
How to use checksums
f877a75b29c8d50a207afa09bf803395d3caad306f2222ccc03021ac9e3be4c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.9.2 Linux/5.15.90.1-microsoft-standard-WSL2

Release files / python_web_io-0.2.3-py3-none-any.whl

Download URL python_web_io-0.2.3-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e3a2be46096aac9e011d137d57e64fdd96d353e579dcb40593bd2bcaf379646
BLAKE2b-256 checksum
How to use checksums
c43a464d31c20849953cdae9f4b39d0ff2486ebdbf3ab315334f9f0937e00cd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.9.2 Linux/5.15.90.1-microsoft-standard-WSL2

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page