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.8.tar.gz
(29.4 kB
view details)
Built Distribution
pycob-0.1.8-py3-none-any.whl
(30.8 kB
view details)
File details
Details for the file pycob-0.1.8.tar.gz
.
File metadata
- Download URL: pycob-0.1.8.tar.gz
- Upload date:
- Size: 29.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
c552ec51633c6641376d3babc96404cfdbea70f3e9143ded217fa8fb7ab1e020
|
|
MD5 |
dd66a8e949282714a1048716e74c6389
|
|
BLAKE2b-256 |
09861eabbcc3cd2a37ba691936d7c59b17a64a0c108da320c8bc11107577b869
|
File details
Details for the file pycob-0.1.8-py3-none-any.whl
.
File metadata
- Download URL: pycob-0.1.8-py3-none-any.whl
- Upload date:
- Size: 30.8 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 |
3e710d83edb1bef9c4cf363843404ddedcb524876a071ba2fb0d7b44780bf4fa
|
|
MD5 |
f02d14841d87f4ae2e4ac618f5c433b9
|
|
BLAKE2b-256 |
f1e99e70c7dcb6b8dbf9fe1fff98711e21d94dd66dbf85f1e4bfe6e5ee19b75d
|