Skip to main content

sPyTial: Spatial Python visualization with declarative constraints

Project description

sPyTial: Lightweight Diagrams for Structured Python Data

pip install spytial-diagramming

Sometimes you just want to see your data.

You’re working with a tree, a graph, a recursive object -- maybe an AST, a neural network, or a symbolic term. You don’t need an interactive dashboard or a production-grade visualization system. You just need a diagram, something that lays it out clearly so you can understand what’s going on.

That’s what sPyTial is for. It’s designed for developers, educators, and researchers who work with structured data and need to make that structure visible — to themselves or to others — with minimal effort.

Why Spatial Representation Matters

There’s strong evidence — from cognitive science, human-computer interaction, and decades of programming tool design — that spatial representations help people understand structure. When elements are placed meaningfully in space — grouped, aligned, oriented — we can spot patterns, detect errors, and reason more effectively. This idea shows up in research from Barbara Tversky, Larkin & Simon, and in the design of tools like Alloy and Scratch.

sPyTial gives you that kind of spatial layout by default. When you visualize a Python object, the diagram reflects how the parts are connected, not just how they're stored. You get:

  • A box-and-arrow diagram that shows the shape of your data
  • A layout that follows cognitive and structural conventions
  • A tool that knows when something doesn't make sense

Quick Start

import spytial

# Visualize any Python object
data = {
    'name': 'root',
    'children': [
        {'value': 1},
        {'value': 2},
        {'value': 3}
    ]
}

# Opens in browser or inline if in a jupyter notebook.
spytial.diagram(data)

# Or save to file
spytial.diagram(data, method='file')

# Step through a sequence of states
states = [
    {'value': 0, 'next': 1},
    {'value': 1, 'next': 2},
]
spytial.diagramSequence(states, sequence_policy='stability')

# If each step rebuilds fresh objects, provide an identity hook
class Node:
    def __init__(self, node_id, value):
        self.id = node_id
        self.value = value

states = [Node("A", 1), Node("A", 2)]
spytial.diagramSequence(
    states,
    sequence_policy='stability',
    identity=lambda obj: obj.id if hasattr(obj, "id") else None,
)

Documentation

Documentation is published at https://sidprasad.github.io/spytial/ and is generated from this repository with MkDocs.

The docs focus on user-facing material:

  • installation and first steps
  • diagramming, evaluation, annotations, and relationalizers
  • data-structure examples drawn from the spytial-clrs companion repo

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

spytial_diagramming-1.2.6.tar.gz (284.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spytial_diagramming-1.2.6-py3-none-any.whl (76.3 kB view details)

Uploaded Python 3

File details

Details for the file spytial_diagramming-1.2.6.tar.gz.

File metadata

  • Download URL: spytial_diagramming-1.2.6.tar.gz
  • Upload date:
  • Size: 284.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for spytial_diagramming-1.2.6.tar.gz
Algorithm Hash digest
SHA256 10e097d10d7cb569c189f39e7606903908f6abc3db9fed49175d766d41e02e51
MD5 e1fd25f2c1b851c387542e9de9bc84ab
BLAKE2b-256 26161bb81474b6cce24ec7dad6e0575f253f227f4bedacf15f8155624da79bc4

See more details on using hashes here.

File details

Details for the file spytial_diagramming-1.2.6-py3-none-any.whl.

File metadata

File hashes

Hashes for spytial_diagramming-1.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 979b4cc608f8a97e894456f7fabd2a72c32a5de8ebe2b04c74711b916d31a149
MD5 ec261afa0fff3b914eb7ae919c552527
BLAKE2b-256 76d746d325c6a4e7ba7d0411b4be9987433ba1eddb4200a1275beb7ff327d706

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