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.10.tar.gz
(30.6 kB
view details)
Built Distribution
pycob-0.1.10-py3-none-any.whl
(31.9 kB
view details)
File details
Details for the file pycob-0.1.10.tar.gz
.
File metadata
- Download URL: pycob-0.1.10.tar.gz
- Upload date:
- Size: 30.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
e9e1acb776d64a9c1897a68324e83aa910d74a83c603d41c29685dffd6d7ffdc
|
|
MD5 |
db1e0acb1b8d8e799eb292b94eebc2ed
|
|
BLAKE2b-256 |
ef57be51393c35d39205aa237ab0aa1e7c3c16edee2ce2bc3dfc9ebf5c662f7e
|
File details
Details for the file pycob-0.1.10-py3-none-any.whl
.
File metadata
- Download URL: pycob-0.1.10-py3-none-any.whl
- Upload date:
- Size: 31.9 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 |
95a3048027d958157329869cc2bcb0283a8e8c561943e82b33cf5ad278807129
|
|
MD5 |
b3351098579f0e31b211345638707c55
|
|
BLAKE2b-256 |
784547a12b274b976a9d7783d4e95bbad1de953b79bf0c4ba2b9aadad0d0ac47
|