Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ There are some important parameters you should know when using pygwalker:
+ `spec_path`: local file path for saving/loading chart config.
+ `spec`: chart config object, JSON string, config ID, or remote URL.
+ `computation`: choose where data queries run. Use `"browser"` for frontend-only computation, `"kernel"` for local DuckDB-backed Python computation, `"cloud"` for Kanaries cloud computation, or omit it for the default automatic behavior.
+ `kernel_computation`: legacy boolean for using DuckDB as computing engine. Prefer `computation="kernel"`.
+ `use_kernel_calc`: Deprecated, use `computation="kernel"` or `kernel_computation` instead.
+ `kernel_computation`: legacy boolean for using DuckDB as computing engine. Prefer `computation="kernel"` or `computation="browser"`; this legacy flag is scheduled for removal in PyGWalker 0.7.0.
+ `cloud_computation`: legacy boolean for Kanaries cloud computation. Prefer `computation="cloud"`; this legacy flag is scheduled for removal in PyGWalker 0.7.0.
+ `use_kernel_calc`: deprecated alias for kernel computation. Prefer `computation="kernel"` or `computation="browser"`; this legacy flag is scheduled for removal in PyGWalker 0.7.0.

```python
df = pd.read_csv('./bike_sharing_dc.csv')
Expand All @@ -171,7 +172,7 @@ walker = pyg.walk(
)
```

You can also create a reusable `Walker` object and choose where to render it:
For new code on the 0.6 line, prefer a reusable `Walker` object and choose where to render it:

```python
walker = pyg.Walker(df, spec_path="./chart_meta_0.json", computation="browser")
Expand Down Expand Up @@ -271,16 +272,16 @@ renderer.explorer()
|--------------------|-----------------------------------------------------------|-----------------|-----------------------------------------------------------------------------------------------------------------------------------|
| dataset | Union[DataFrame, pyarrow.Table, Connector, str, Walker] | - | DataFrame, pyarrow table, database connector, SQL/data source string, or reusable Walker object to explore. |
| gid | Union[int, str] | None | ID for the GraphicWalker container div, formatted as `gwalker-{gid}`. |
| env | Literal['JupyterAnywidget', 'Jupyter', 'JupyterWidget'] | 'JupyterAnywidget' | Notebook rendering environment. Use `JupyterAnywidget` or omit `env`; `Jupyter` and `JupyterWidget` are deprecated legacy transports kept for compatibility. |
| env | Literal['JupyterAnywidget', 'Jupyter', 'JupyterWidget'] | 'JupyterAnywidget' | Notebook rendering environment. Use `JupyterAnywidget` or omit `env`; `Jupyter` and `JupyterWidget` are deprecated aliases to the anywidget transport and are scheduled for removal in PyGWalker 0.7.0. |
| field_specs | Optional[List[FieldSpec]] | None | Field specifications. They will be inferred from `dataset` if not specified. |
| theme_key | Literal['vega', 'g2', 'streamlit'] | 'g2' | Theme type for Graphic Walker. |
| appearance | Literal['media', 'light', 'dark'] | 'media' | Theme appearance. `media` follows the operating system preference. |
| spec | str | "" | Chart configuration data. Can be a configuration ID, JSON string, local file path, or remote file URL. |
| spec_path | Optional[str] | None | Local chart configuration file path. Prefer this over passing a local file path through `spec`. |
| computation | Optional[Literal['auto', 'browser', 'kernel', 'cloud']] | None | Computation backend. Omit it for automatic behavior; use `browser`, `kernel`, or `cloud` to choose explicitly. |
| use_kernel_calc | Optional[bool] | None | Deprecated. Use `computation="kernel"` or `kernel_computation` instead. |
| kernel_computation | Optional[bool] | None | Legacy boolean for local DuckDB-backed kernel computation. Prefer `computation="kernel"` or `computation="browser"`. |
| cloud_computation | bool | False | Legacy boolean for Kanaries cloud computation. Prefer `computation="cloud"`. |
| use_kernel_calc | Optional[bool] | None | Deprecated; scheduled for removal in PyGWalker 0.7.0. Use `computation="kernel"` or `computation="browser"` instead. |
| kernel_computation | Optional[bool] | None | Legacy boolean for local DuckDB-backed kernel computation; scheduled for removal in PyGWalker 0.7.0. Prefer `computation`. |
| cloud_computation | bool | False | Legacy boolean for Kanaries cloud computation; scheduled for removal in PyGWalker 0.7.0. Prefer `computation="cloud"`. |
| show_cloud_tool | bool | True | Whether to show the Kanaries cloud tool when available. |
| kanaries_api_key | str | "" | Kanaries API key used by cloud features. |
| default_tab | Literal['data', 'vis'] | 'vis' | Default tab to show when the UI opens. |
Expand Down
173 changes: 173 additions & 0 deletions app/src/interfaces/comm.generated.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
/* eslint-disable */
// This file is generated by scripts/generate_comm_protocol_ts.py.
// Do not edit it by hand; update pygwalker.communications.protocol instead.

import type { IDataQueryPayload, IChatMessage, IMutField, IRow } from '@kanaries/graphic-walker/interfaces';

export type IViewField = IMutField;

export interface ICommSqlQueryRequest {
sql: string;
}

export interface ICommPayloadQueryRequest {
payload: IDataQueryPayload;
}

export interface ICommBatchQueryRequest<TQuery> {
queryList: TQuery[];
}

export interface ICommUploadSpecToCloudRequest {
fileName: string;
newToken?: string;
}

export interface ICommChartImageRequest {
rowIndex: number;
colIndex: number;
data: string;
height: number;
width: number;
canvasHeight: number;
canvasWidth: number;
}

export interface ICommSaveChartRequest {
charts: ICommChartImageRequest[];
singleChart: string;
nRows: number;
nCols: number;
title: string;
}

export interface ICommUpdateSpecRequest {
visSpec: Record<string, any>[];
chartData: ICommSaveChartRequest;
workflowList?: Record<string, any>[];
}

export interface ICommAskSpecRequest {
metas: IViewField[];
query: string;
}

export interface ICommChatChartRequest {
metas: IViewField[];
chats: IChatMessage[];
}

export interface ICommOpenDesktopRequest {
spec: Record<string, any>[];
fields: Record<string, any>[];
}

export interface ICommUploadCloudChartRequest {
chartName: string;
datasetName: string;
isPublic: boolean;
visSpec: Record<string, any>[];
workflow: Record<string, any>[];
}

export interface ICommUploadCloudDashboardRequest {
chartName: string;
datasetName: string;
isPublic: boolean;
isCreateDashboard: boolean;
visSpec: Record<string, any>[];
workflowList: Record<string, any>[][];
}

export interface ICommResponse<TData = any> {
code: number;
data?: TData;
message: string;
}

export interface ICommEnvelope<TAction extends string = string, TData = any> {
action: TAction;
data: TData;
rid?: string;
gid?: string | number;
}

export type ICommEmptyRequest = Record<string, never>;

export interface ICommEmptyResponse {}

export interface ICommLatestVisSpecResponse {
visSpec: Record<string, any>[];
}

export interface ICommDataRowsResponse {
datas: IRow[];
}

export interface ICommBatchDataRowsResponse {
datas: IRow[][];
}

export interface ICommUploadSpecToCloudResponse {
specFilePath: string;
}

export interface ICommCloudCallbackResponse {
data: any;
}

export interface ICommUploadCloudChartResponse {
chartId: string;
datasetId: string;
}

export interface ICommUploadCloudDashboardResponse {
dashboardId: string;
datasetId: string;
}

export interface ICommRequestMap {
ping: ICommEmptyRequest;
request_data: ICommEmptyRequest;
get_latest_vis_spec: ICommEmptyRequest;
save_chart: ICommSaveChartRequest;
update_spec: ICommUpdateSpecRequest;
upload_spec_to_cloud: ICommUploadSpecToCloudRequest;
get_datas: ICommSqlQueryRequest;
get_datas_by_payload: ICommPayloadQueryRequest;
batch_get_datas_by_sql: ICommBatchQueryRequest<string>;
batch_get_datas_by_payload: ICommBatchQueryRequest<IDataQueryPayload>;
get_spec_by_text: ICommAskSpecRequest;
get_chart_by_chats: ICommChatChartRequest;
export_dataframe_by_payload: ICommPayloadQueryRequest;
export_dataframe_by_sql: ICommSqlQueryRequest;
upload_to_cloud_charts: ICommUploadCloudChartRequest;
upload_to_cloud_dashboard: ICommUploadCloudDashboardRequest;
open_in_desktop: ICommOpenDesktopRequest;
}

export interface ICommResponseMap {
ping: ICommEmptyResponse;
request_data: ICommEmptyResponse;
get_latest_vis_spec: ICommLatestVisSpecResponse;
save_chart: ICommEmptyResponse;
update_spec: ICommEmptyResponse;
upload_spec_to_cloud: ICommUploadSpecToCloudResponse;
get_datas: ICommDataRowsResponse;
get_datas_by_payload: ICommDataRowsResponse;
batch_get_datas_by_sql: ICommBatchDataRowsResponse;
batch_get_datas_by_payload: ICommBatchDataRowsResponse;
get_spec_by_text: ICommCloudCallbackResponse;
get_chart_by_chats: ICommCloudCallbackResponse;
export_dataframe_by_payload: ICommEmptyResponse;
export_dataframe_by_sql: ICommEmptyResponse;
upload_to_cloud_charts: ICommUploadCloudChartResponse;
upload_to_cloud_dashboard: ICommUploadCloudDashboardResponse;
open_in_desktop: ICommEmptyResponse;
}

export type ICommAction = keyof ICommRequestMap;

export type ICommRequestEnvelope<TAction extends ICommAction> = ICommEnvelope<TAction, ICommRequestMap[TAction]>;

export type ICommResponseEnvelope<TData = any> = ICommEnvelope<"finish_request", ICommResponse<TData>>;
Loading
Loading