Skip to main content
Pre-release

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, axes=True)
    .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": {"axes": True}
# }

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 generation
  • tests/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

  1. Install dependencies:

    uv pip install -e ".[test]"
    pnpm install
    
  2. Make changes to Python code or widget TypeScript source

  3. Build widget (if you modified widget code):

    pnpm run build:widget
    
  4. Run tests:

    pytest
    
  5. Test in Jupyter (optional):

    jupyter notebook tests/test_rendering.ipynb
    

Metadata

Release files for gofish-graphics 0.1.1.dev20261001

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gofish-graphics 0.1.1.dev20261001
File Size Uploaded
gofish_graphics-0.1.1.dev20261001.tar.gz 1.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for gofish-graphics 0.1.1.dev20261001
File Interpreter ABI Platform
gofish_graphics-0.1.1.dev20261001-py3-none-any.whl Python 3 none any Details

Total release size: 2.2 MB

Release files / gofish_graphics-0.1.1.dev20261001.tar.gz

Download URL gofish_graphics-0.1.1.dev20261001.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
9383ffb64cc76815e324cc7ce6a85a4c6209d79097c0f7a8f974b2ba905ad1e1
BLAKE2b-256 checksum
How to use checksums
57f975bbcb1b71d2cee7f45c27b5051ba5b2cf8eba530f35aa5d7f906dcddfd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release files / gofish_graphics-0.1.1.dev20261001-py3-none-any.whl

Download URL gofish_graphics-0.1.1.dev20261001-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
b837c90172edb92926e676e19039d81761f82b5dd3d57c20d90b63eded7b2b07
BLAKE2b-256 checksum
How to use checksums
1f635c09e01a6447c139ab685b862ee1d87043c2a55bdbb22e43446d8e4c948d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page