Skip to main content

A custom Streamlit component for analytics cards

Project description

streamlit-analytics-cards

A project to create custom Streamlit components using React and TypeScript for analytics and insights.

View a demo: 💾 View it on PyPI: 👾

Using the component

Prerequisites

Installation

pip install streamlit-analytics-cards
or
python3 -m pip install streamlit-analytics-cards

Implementation

from streamlit_analytics_cards import card as stac
# Render the component in your Streamlit app
stac(
            template="CardOne",
            title="Attrition Diversity",
            subtitle="Female Attrition",
            main_value="4.7%",
            secondary_value="52",
            delta="Y/Y 5.1%, -0.4%",
            chart_data=df["Number of Exits"].tolist(),
            x_axis_label=df.columns[0],
            color_scheme={"background": "#FFFFFF", "text": "#000000"},
            key="card_1",
        )

For developers

Prerequisites

Before you start, ensure you have the following installed on your system:


Installation

  1. Clone the repository:

    git clone https://github.com/natxc/streamlit-analytics-cards.git
    cd streamlit-analytics-cards
    
  2. Set up the Python environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    pip install -r requirements.txt
    
  3. Install frontend dependencies: Navigate to the frontend/ folder and install the required Node.js packages:

    cd frontend
    npm install
    

Development

Run the Frontend

Start the development server for the React app:

npm start

This will start a local development server at http://localhost:3000.


Run the Streamlit

In the root directory, start the Streamlit app:

streamlit run streamlit_app/app.py

Production Build

  1. Build the Frontend: Navigate to the frontend/ folder and run:

    npm run build
    

    This will create a production-ready build in the frontend/build directory.

  2. Run Streamlit in Production Mode: Ensure _RELEASE is set to True in the __init__.py file:

    _RELEASE = True
    

    Then start the Streamlit app:

    streamlit run streamlit_app/app.py
    

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

streamlit_analytics_cards-0.0.4.tar.gz (562.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamlit_analytics_cards-0.0.4-py3-none-any.whl (566.9 kB view details)

Uploaded Python 3

File details

Details for the file streamlit_analytics_cards-0.0.4.tar.gz.

File metadata

File hashes

Hashes for streamlit_analytics_cards-0.0.4.tar.gz
Algorithm Hash digest
SHA256 91ea2259e18945432b792cf51b1e746c0a7a67570d5a9c2de15a20db1f81047e
MD5 e71674f82c441a98d38b537ccc830364
BLAKE2b-256 c80537eba19f0800b84342d015b9158e34c273527d70072026e19a8be8d726fc

See more details on using hashes here.

File details

Details for the file streamlit_analytics_cards-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_analytics_cards-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e7d6f262a52a46057a78c51720ce21a67352c39f5e5aabfe69c8e317def344ac
MD5 23d6c63b1d5d0ddcf5312109b59a0c9e
BLAKE2b-256 7ed3d97ad6dee331568057620684ff3ec45b6bf13e8fc50c51b294c75e6d7146

See more details on using hashes here.

Supported by

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