Skip to main content

Spreadsheet component for refast

Project description

refast_grid

Spreadsheet component for refast

A Refast extension that provides the RefastGrid component.

Installation

pip install refast_grid

Usage

Option 1: Auto-Discovery (Recommended)

When you install the package, Refast will automatically discover and load the extension:

from fastapi import FastAPI
from refast import RefastApp, Context
from refast.components import Container, Button, Row
from refast_grid import RefastGrid

# Extension is auto-discovered, no need to manually register
ui = RefastApp(title="RefastGrid Demo")


@ui.page("/")
def home(ctx: Context):
    return Container(
        children=[
            RefastGrid(
                id="my-component",
                value="Hello, World!",
            ),
        ]
    )


app = FastAPI()
app.include_router(ui.router)

if __name__ == "__main__":
    import uvicorn
    uvicorn.run(app, host="0.0.0.0", port=8000)

Option 2: Manual Registration

If you want to disable auto-discovery and register extensions manually:

from refast import RefastApp
from refast_grid import RefastGrid, RefastGridExtension

ui = RefastApp(
    title="RefastGrid Demo",
    auto_discover_extensions=False,
    extensions=[RefastGridExtension()],
)

Component Props

Prop Type Default Description
value str "" The value to display
on_change Callback None Called when the value changes
id str None Component ID
class_name str "" CSS classes to apply

Development

Prerequisites

  • Python 3.11+
  • Node.js 18+
  • npm

Building the Frontend

cd frontend
npm install
npm run build

This builds the UMD bundle to src/refast_grid/static/.

Installing Locally

# Install with automatic frontend build (via hatch hook)
pip install -e .

# Or build frontend first, then install
cd frontend && npm install && npm run build && cd ..
pip install -e .

Running the Example

python usage.py

Then open http://localhost:8000 in your browser.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

refast_grid-0.2.0.tar.gz (28.4 kB view details)

Uploaded Source

Built Distribution

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

refast_grid-0.2.0-py3-none-any.whl (89.7 kB view details)

Uploaded Python 3

File details

Details for the file refast_grid-0.2.0.tar.gz.

File metadata

  • Download URL: refast_grid-0.2.0.tar.gz
  • Upload date:
  • Size: 28.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for refast_grid-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4ad3e3c92148f197cfe3031b3c49046662433df53f6d19d9c8c701631f8b9276
MD5 413afcb988f480acfc19735ffbdfa4a9
BLAKE2b-256 74e3fd74375919fc4b2005bb7e6df40c72dcbd08cef94dbc156075a141aefdb8

See more details on using hashes here.

File details

Details for the file refast_grid-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: refast_grid-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 89.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for refast_grid-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c77e93c0a56b5542d04e0c338aab1c7d5bc6a9aa00b13f5661695aebd29b52df
MD5 2a79f5e3f4ad5cf2a880505807567e63
BLAKE2b-256 e5357710cea087c81b7ddff4dc03fd1661dd89fd6a3ff9c3c5cc63efe17d0e6f

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