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.9.tar.gz
(30.4 kB
view details)
Built Distribution
pycob-0.1.9-py3-none-any.whl
(31.7 kB
view details)
File details
Details for the file pycob-0.1.9.tar.gz
.
File metadata
- Download URL: pycob-0.1.9.tar.gz
- Upload date:
- Size: 30.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 |
c510f562ca55e1ed9476c75631e176970185248e21cb48b93efd0d790d01f15c
|
|
MD5 |
3841731050711ecf268f42e274c0f7db
|
|
BLAKE2b-256 |
b663aaf29eaed23edc1e773532021c51cb922e75cb9460283365c4aa4ed9cd27
|
File details
Details for the file pycob-0.1.9-py3-none-any.whl
.
File metadata
- Download URL: pycob-0.1.9-py3-none-any.whl
- Upload date:
- Size: 31.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 |
83fda992926115b59dc5c90274d371cd54ccdac2b08d98b3c62cf30e1eaeb460
|
|
MD5 |
d0a2af9498dfb7ef4120e9ac647b2937
|
|
BLAKE2b-256 |
ca1facf5b1a3004e426d8c6438b682ecab3f8fec85d65b74c990f3a0ad48a5b5
|