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 a page
def sample_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
# Register page functions with the app
app.register_function(sample_page)
# Run the server
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.22.tar.gz
(39.5 kB
view details)
Built Distribution
pycob-0.1.22-py3-none-any.whl
(41.0 kB
view details)
File details
Details for the file pycob-0.1.22.tar.gz
.
File metadata
- Download URL: pycob-0.1.22.tar.gz
- Upload date:
- Size: 39.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
caaba4dfdd7a917939a235312bc9a3e218b1343ca89bfe65e16acec7106fb149
|
|
MD5 |
a118673490f0e873e119b07c60805361
|
|
BLAKE2b-256 |
662d7050c7b0171277a04caeff8bfe54156cc7ec1b5ba3c27d681c5e94617ba0
|
File details
Details for the file pycob-0.1.22-py3-none-any.whl
.
File metadata
- Download URL: pycob-0.1.22-py3-none-any.whl
- Upload date:
- Size: 41.0 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 |
459badffa9ac036aab20c2738ace47bd8b590c480fa3a012f30b0dd7861e2a99
|
|
MD5 |
0c2db3878d55ab38dec4fc693c5c5423
|
|
BLAKE2b-256 |
5cabbaba6bb0832e3cb7241876dd94fdd1f7f38256ea2679c64b1a37876091b9
|