This release is a pre-release and may not be stable for production use.
gofish-python
A Python wrapper for the GoFish graphics library. Both the mid-level chart API and the low-level mark/operator API are supported. (See notes/design.md and notes/implementation.md for more details.)
Installation
pip install --pre gofish-graphics
The latest stable release on PyPI is old and lags far behind development. The docs at
gofish.graphics describe the current dev
builds, which are published on every change to main. You must include the --pre
flag, otherwise pip installs the outdated stable release.
The package is imported as gofish:
from gofish import chart
See the getting started docs for a full introduction.
Usage
from gofish import chart, spread, stack, rect
# Create a chart specification
data = [{"lake": "A", "species": "B", "count": 10}]
c = (
chart(data, options={"w": 800, "h": 600})
.flow(
spread("lake", dir="x", spacing=64),
stack("species", dir="y", spacing=0),
)
.mark(rect(h="count", fill="species"))
)
# Convert to JSON IR
ir = c.to_ir()
print(ir)
# {
# "data": None,
# "operators": [
# {"type": "spread", "field": "lake", "dir": "x", "spacing": 64},
# {"type": "stack", "field": "species", "dir": "y", "spacing": 0}
# ],
# "mark": {"type": "rect", "h": "count", "fill": "species"},
# "options": {"w": 800, "h": 600}
# }
IR Format
The JSON IR has the following structure:
{
"data": null,
"operators": [
{ "type": "spread", "field": "lake", "dir": "x", "spacing": 8 },
{ "type": "derive", "lambdaId": "uuid-here" },
{ "type": "stack", "field": "species", "dir": "y" }
],
"mark": { "type": "rect", "h": "count", "fill": "species" },
"options": {}
}
Development
Note: This package uses uv for fast package management and testing.
Prerequisites
- Python 3.10+
- uv - Fast Python package manager
- Node.js (for building the widget bundle)
- pnpm (for managing Node.js dependencies)
Development Install
cd packages/gofish-python
uv pip install -e .
Installing Node.js Dependencies
If you need to build the widget bundle, install Node.js dependencies:
pnpm install
Building the Widget Bundle
The widget bundle is a self-contained JavaScript module that includes all dependencies. Build it with:
# From the package directory
pnpm run build:widget
# Or directly with Node.js
node build-widget.mjs
This will:
- Bundle the TypeScript widget source (
widget-src/index.ts) - Include all dependencies (gofish-graphics, solid-js, apache-arrow)
- Output to
gofish/_static/widget.esm.js
Note: The build process will automatically use gofish-graphics/dist/index.js if available, otherwise it falls back to the package import. Make sure gofish-graphics is built first if you're developing locally.
Running Tests
Python Unit Tests
# Install with test dependencies
uv pip install -e ".[test]"
# Run all tests
uv run pytest
# Or run directly if installed
pytest
# Run specific test file
pytest tests/test_ast.py
# Run with verbose output
pytest -v
Jupyter Notebook Tests
The package includes Jupyter notebooks for interactive testing:
tests/test_ir.ipynb- Tests for IR generationtests/test_rendering.ipynb- Tests for widget rendering
To run these:
# Start Jupyter
jupyter notebook
# Or use the provided script (if available)
./run_notebook.sh
Development Workflow
-
Install dependencies:
uv pip install -e ".[test]" pnpm install
-
Make changes to Python code or widget TypeScript source
-
Build widget (if you modified widget code):
pnpm run build:widget
-
Run tests:
pytest
-
Test in Jupyter (optional):
jupyter notebook tests/test_rendering.ipynb
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gofish_graphics-0.1.1.dev20260716.tar.gz.
File metadata
- Download URL: gofish_graphics-0.1.1.dev20260716.tar.gz
- Upload date:
- Size: 973.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fedf7170fad1a319eaa51653d17f261730bb19db5e965529da0abf853ddac1f1
|
|
| MD5 |
6f0572c4844dfb380ac3e49cfc7daf71
|
|
| BLAKE2b-256 |
6f0e442540bc932815621296557f474a75214c18db9be2eb65ba04ee00cc7cd3
|
Provenance
The following attestation bundles were made for gofish_graphics-0.1.1.dev20260716.tar.gz:
Publisher:
release.yml on gofish-graphics/gofish-graphics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gofish_graphics-0.1.1.dev20260716.tar.gz -
Subject digest:
fedf7170fad1a319eaa51653d17f261730bb19db5e965529da0abf853ddac1f1 - Sigstore transparency entry: 2180289412
- Sigstore integration time:
-
Permalink:
gofish-graphics/gofish-graphics@1ae643aea700ea8d818a0e242f86a7a89732dd25 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/gofish-graphics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1ae643aea700ea8d818a0e242f86a7a89732dd25 -
Trigger Event:
schedule
-
Statement type:
File details
Details for the file gofish_graphics-0.1.1.dev20260716-py3-none-any.whl.
File metadata
- Download URL: gofish_graphics-0.1.1.dev20260716-py3-none-any.whl
- Upload date:
- Size: 970.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87f01f7a71f9981380ac0fab25c932177a1f5a8aabfa8053879649fef77db3e8
|
|
| MD5 |
899582b109ecfc3430832e2e1131bc74
|
|
| BLAKE2b-256 |
0fe1b9e2e8f6f12ca3e1a7a6fa9c4b34345440a00ad5b2585f5b775a3cd82e51
|
Provenance
The following attestation bundles were made for gofish_graphics-0.1.1.dev20260716-py3-none-any.whl:
Publisher:
release.yml on gofish-graphics/gofish-graphics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gofish_graphics-0.1.1.dev20260716-py3-none-any.whl -
Subject digest:
87f01f7a71f9981380ac0fab25c932177a1f5a8aabfa8053879649fef77db3e8 - Sigstore transparency entry: 2180289455
- Sigstore integration time:
-
Permalink:
gofish-graphics/gofish-graphics@1ae643aea700ea8d818a0e242f86a7a89732dd25 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/gofish-graphics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1ae643aea700ea8d818a0e242f86a7a89732dd25 -
Trigger Event:
schedule
-
Statement type: