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.3.0.tar.gz (35.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.3.0-py3-none-any.whl (93.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: refast_grid-0.3.0.tar.gz
  • Upload date:
  • Size: 35.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.3.0.tar.gz
Algorithm Hash digest
SHA256 16e16a04cc0c8f77c9972684ddc10911bc10446993b903f7c22f1d9595a055a0
MD5 f4cd5a2a91a6cb717f346690024b9e99
BLAKE2b-256 c3ba2ed5dd8caac9bad85c6a53c0c4b145d86e50cfbc1a15e1fa7b150820f8f0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: refast_grid-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 93.8 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0b99a2e7c3fb4a7c29c7e1ac44f3f68996452f1c5506805ba59f4adf76b03bf
MD5 f907656282847f1956c7ba7196350f03
BLAKE2b-256 5ad33dca66cfce65c727b3344a2d7797394570e688b24a9702bf6adbdf5cfeb5

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