Skip to main content

Build web apps using just Python

Project description

PyCob

PyCob Logo on Hexagon

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

Quickstart Template Repo

Learn More

PyCob

Project details


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.7.tar.gz (29.4 kB view hashes)

Uploaded Source

Built Distribution

pycob-0.1.7-py3-none-any.whl (30.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page