Metadata-Version: 2.3
Name: perspective-python
Version: 5.6.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Office/Business :: Financial
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Framework :: Jupyter
Classifier: Framework :: Jupyter :: JupyterLab
Classifier: Framework :: Jupyter :: JupyterLab :: 3
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt
Requires-Dist: anywidget>=0.9 ; extra == 'jupyter'
Requires-Dist: tornado>=5,<7 ; extra == 'tornado'
Requires-Dist: aiohttp>=2,<4 ; extra == 'aiohttp'
Requires-Dist: starlette<1 ; extra == 'starlette'
Provides-Extra: jupyter
Provides-Extra: tornado
Provides-Extra: aiohttp
Provides-Extra: starlette
Summary: Interactive data grid, pivot table and charts for large, real-time and streaming datasets, with a Jupyter widget and WebSocket server.
Keywords: datagrid,pivot,visualization,analytics,dashboard,jupyter,anywidget,streaming,real-time,arrow,pandas,polars,duckdb,webassembly
Home-page: https://perspective-dev.github.io
Author: Andrew Stein <steinlink@gmail.com>
Author-email: Andrew Stein <steinlink@gmail.com>
License: Apache-2.0
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://perspective-dev.github.io
Project-URL: Documentation, https://perspective-dev.github.io/guide/
Project-URL: Repository, https://github.com/perspective-dev/perspective
Project-URL: Issues, https://github.com/perspective-dev/perspective/issues
Project-URL: Changelog, https://github.com/perspective-dev/perspective/blob/master/CHANGELOG.md

# `perspective-python`

[![PyPI](https://img.shields.io/pypi/v/perspective-python.svg?style=for-the-badge)](https://pypi.org/project/perspective-python/)

Perspective is an open-source data grid, pivot table and charting component for 
large, real-time and streaming datasets.

`perspective-python` is the Python distribution of Perspective:

- A streaming query engine — `Table` and `View` — with incremental pivots,
  aggregates, filters, expressions and joins, reading and writing
  [Apache Arrow](https://arrow.apache.org/), CSV, JSON, `pandas`, `polars` and
  `pyarrow`. Tables can be memory-mapped from disk with `page_to_disk=True`
  to exceed available memory.
- `PerspectiveWidget`, an interactive data grid, pivot table and charting
  widget for JupyterLab, Jupyter Notebook, VS Code notebooks, Google Colab and
  marimo, built on [anywidget](https://anywidget.dev/).
- WebSocket handlers for Tornado, Starlette (FastAPI) and aiohttp, which serve
  real-time dashboards to `<perspective-viewer>` in the browser.
- Virtual servers which run the same UI directly against DuckDB, ClickHouse,
  PostgreSQL and Polars, with no data copy.

## Installation

```bash
pip install perspective-python
```

For notebooks, install the `jupyter` extra:

```bash
pip install "perspective-python[jupyter]"
```

## An interactive pivot table in Jupyter

```python
import pandas as pd
from perspective.widget import PerspectiveWidget

df = pd.read_csv("superstore.csv")
PerspectiveWidget(df, plugin="Y Bar", group_by=["Region"], columns=["Sales"])
```

## A streaming `Table`

```python
import perspective

server = perspective.Server()
client = server.new_local_client()
table = client.table({"symbol": "string", "price": "float"}, name="prices")
table.update([{"symbol": "AAPL", "price": 189.5}])
```

## A real-time dashboard server

```python
import tornado.ioloop
import tornado.web
from perspective.handlers.tornado import PerspectiveTornadoHandler

app = tornado.web.Application([
    (r"/websocket", PerspectiveTornadoHandler, {"perspective_server": server}),
])

app.listen(8888)
tornado.ioloop.IOLoop.current().start()
```

Any number of browser clients can then open the `prices` table over WebSocket
and receive every `update()` as it happens.

## Documentation

- [Project site and live examples](https://perspective-dev.github.io/)
- [User guide](https://perspective-dev.github.io/guide/)
- [Example gallery](https://perspective-dev.github.io/gallery/index.html)
- [GitHub](https://github.com/perspective-dev/perspective)
- [Python API reference](https://perspective-dev.github.io/python/index.html)
