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.5.tar.gz (7.3 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.5-py3-none-any.whl (566.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for streamlit_analytics_cards-0.0.5.tar.gz
Algorithm Hash digest
SHA256 793fbcf925e69eb52d05c5e9ccb65a780e3d92a7578a32e79dc98dd1a8275211
MD5 6c6a615935cf3ef6d23a287764f4d324
BLAKE2b-256 c09294d5d146b8d3ed7a54f46e7e0b5f078311f378d353f8c5d6bf8be4093f58

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streamlit_analytics_cards-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 11abc2a31c2decf750bb6d76b88e9a1bf7ad731411529e92480fc3e35175b635
MD5 b91eef7e9fa0d1f50da1d5b6bb522ed4
BLAKE2b-256 a31af359fb15c68f7d5b23203958c0fea4c429bd65ca1418ce66455affe670a7

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