Build web apps using just Python
Project description
PyCob
Create web apps using just Python
Install PyCob
pip install pycob
Use PyCob
import pycob as cob
import pandas as pd
# Create a PyCob app
app = cob.App('Sample App')
# Define the page
def test_page(server_request: cob.Request) -> cob.Page:
name = server_request.get_query_parameter('name')
page = cob.Page('Sample Page')
if name != "":
page.add_header("Hello, " + name)
else:
page.add_header('Sample Header')
page.add_text('Sample Text')
page.add_alert('Sample Alert', "Sample Badge")
card = page.add_card()
card.add_header("Sample Card", size=3)
form = card.add_form(action="/")
form.add_formtext('Name', 'name', 'Enter your name')
form.add_formsubmit('Submit')
data = {
"data_int": [420, 380, 390],
"data_float": [50.2, 39.6, 100.3],
"large_numbers": [123123.123, 12312512.123, 113453252334.123],
}
df = pd.DataFrame(data)
page.add_pandastable(df)
return page
# Give the page a route
app.add_page('/', "Home", test_page)
# Run the server
app.run()
Quickstart
Learn More
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
pycob-0.1.18.tar.gz
(34.3 kB
view details)
Built Distribution
pycob-0.1.18-py3-none-any.whl
(35.7 kB
view details)
File details
Details for the file pycob-0.1.18.tar.gz
.
File metadata
- Download URL: pycob-0.1.18.tar.gz
- Upload date:
- Size: 34.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
12cc98acaa5b9139f936152af041c46e9bee84950a75f25843230b47c8189fe8
|
|
MD5 |
2336314fd6c8953ac21361c4922ae2cf
|
|
BLAKE2b-256 |
4815133e4305e6f84ec7a69a2bef3556bcfeb1818d06d9a43a0f86a6ababc753
|
File details
Details for the file pycob-0.1.18-py3-none-any.whl
.
File metadata
- Download URL: pycob-0.1.18-py3-none-any.whl
- Upload date:
- Size: 35.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
020ee6e90c242f8b456585abd694ac3daad47e4e1d8f4e6fc9a110173d95d2f0
|
|
MD5 |
2eb34b36d2b234c384a03f270cc758c8
|
|
BLAKE2b-256 |
104c021c376b2c71ba8e1f16f9785bdf6d74f596f0be9baa4a8f45912e7c2116
|