# glue-viz/glue architecture

> Architecture diagram of the GitHub repository glue-viz/glue, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/glue-viz/glue
- Repository: https://github.com/glue-viz/glue

## Overview

Glue-core provides the shared scientific-data model and linking machinery used by Glue front ends. The principal workflow is to load files into data objects, collect and link datasets, define subsets, and explore the linked data through viewers. The README also documents extensible loaders and scriptability; the tree includes specialized viewers and plugins. Several relationships below are supported by the README or SOURCE INDEX references; unsampled subsystems are represented without asserting unverified internal calls.

Main entry points: [`glue/core/data.py`](https://github.com/glue-viz/glue/blob/main/glue/core/data.py) (Dataset components), [`glue/config.py`](https://github.com/glue-viz/glue/blob/main/glue/config.py) (Loader registry), [`glue/core/data_collection.py`](https://github.com/glue-viz/glue/blob/main/glue/core/data_collection.py) (Dataset collection), [`glue/core/link_manager.py`](https://github.com/glue-viz/glue/blob/main/glue/core/link_manager.py) (Link manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Data ingestion"]
  node_factory["Loader registry<br/>[config.py]"]
  node_numpy["NumPy loader<br/>[numpy.py]"]
  node_fits["FITS loader<br/>[fits.py]"]
  node_formats["Other loaders"]
end

subgraph group_model["Data and linking"]
  node_data["Dataset components<br/>[data.py]"]
  node_collection["Dataset collection<br/>[data_collection.py]"]
  node_links["Component links<br/>[component_link.py]"]
  node_linkhelpers["Link builders<br/>[link_helpers.py]"]
  node_linkmanager["Link manager<br/>[link_manager.py]"]
  node_subsets["Subsets and regions<br/>[subset.py]"]
end

subgraph group_coord["Coordination and state"]
  node_hub["Message hub<br/>[hub.py]"]
  node_messages["Domain messages<br/>[message.py]"]
  node_commands["Commands and sessions<br/>[command.py]"]
  node_state["Viewer state<br/>[state.py]"]
end

subgraph group_explore["Viewing and extensions"]
  node_viewers["Interactive viewers"]
  node_plugins["Viewer and data plugins"]
  node_linkeditor["Link editor state<br/>[state.py]"]
end

node_user(("Scientist"))
node_files["Scientific files"]
node_frontend["Glue front ends"]

node_user -->|"selects"| node_files
node_files -->|"offers to load"| node_factory
node_numpy -->|"registers with"| node_factory
node_fits -->|"registers with"| node_factory
node_formats -.->|"extend loaders"| node_factory
node_numpy -->|"creates"| node_data
node_fits -->|"creates"| node_data
node_data -->|"combines datasets"| node_collection
node_collection -->|"maintains links"| node_linkmanager
node_linkmanager -->|"discovers derivations"| node_links
node_linkhelpers -->|"builds links"| node_links
node_data -->|"supports subsets"| node_subsets
node_hub -->|"broadcasts"| node_messages
node_linkmanager -->|"subscribes to"| node_hub
node_commands -->|"operates on"| node_collection
node_state -->|"uses state messages"| node_messages
node_frontend -->|"uses shared core"| node_collection
node_frontend -.->|"presents graphics"| node_viewers
node_viewers -.->|"visualizes linked data"| node_data
node_plugins -.->|"extends loaders"| node_factory
node_linkeditor -->|"uses link helpers"| node_linkhelpers
node_user -->|"explores results"| node_frontend

click node_factory "https://github.com/glue-viz/glue/blob/main/glue/config.py"
click node_numpy "https://github.com/glue-viz/glue/blob/main/glue/core/data_factories/numpy.py"
click node_fits "https://github.com/glue-viz/glue/blob/main/glue/core/data_factories/fits.py"
click node_formats "https://github.com/glue-viz/glue/tree/main/glue/core/data_factories"
click node_data "https://github.com/glue-viz/glue/blob/main/glue/core/data.py"
click node_collection "https://github.com/glue-viz/glue/blob/main/glue/core/data_collection.py"
click node_links "https://github.com/glue-viz/glue/blob/main/glue/core/component_link.py"
click node_linkhelpers "https://github.com/glue-viz/glue/blob/main/glue/core/link_helpers.py"
click node_linkmanager "https://github.com/glue-viz/glue/blob/main/glue/core/link_manager.py"
click node_subsets "https://github.com/glue-viz/glue/blob/main/glue/core/subset.py"
click node_hub "https://github.com/glue-viz/glue/blob/main/glue/core/hub.py"
click node_messages "https://github.com/glue-viz/glue/blob/main/glue/core/message.py"
click node_commands "https://github.com/glue-viz/glue/blob/main/glue/core/command.py"
click node_state "https://github.com/glue-viz/glue/blob/main/glue/viewers/matplotlib/state.py"
click node_viewers "https://github.com/glue-viz/glue/tree/main/glue/viewers"
click node_plugins "https://github.com/glue-viz/glue/tree/main/glue/plugins"
click node_linkeditor "https://github.com/glue-viz/glue/blob/main/glue/dialogs/link_editor/state.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_factory,node_numpy,node_fits,node_formats toneBlue
class node_data,node_collection,node_links,node_linkhelpers,node_linkmanager,node_subsets toneAmber
class node_hub,node_messages,node_commands,node_state toneMint
class node_viewers,node_plugins,node_linkeditor toneRose
class node_user,node_files,node_frontend toneIndigo
```

## Components

### Data ingestion

- [Loader registry](https://github.com/glue-viz/glue/blob/main/glue/config.py): `glue/config.py`
- [NumPy loader](https://github.com/glue-viz/glue/blob/main/glue/core/data_factories/numpy.py): `glue/core/data_factories/numpy.py`
- [FITS loader](https://github.com/glue-viz/glue/blob/main/glue/core/data_factories/fits.py): `glue/core/data_factories/fits.py`
- [Other loaders](https://github.com/glue-viz/glue/tree/main/glue/core/data_factories): `glue/core/data_factories`

### Data and linking

- [Dataset components](https://github.com/glue-viz/glue/blob/main/glue/core/data.py): `glue/core/data.py`
- [Dataset collection](https://github.com/glue-viz/glue/blob/main/glue/core/data_collection.py): `glue/core/data_collection.py`
- [Component links](https://github.com/glue-viz/glue/blob/main/glue/core/component_link.py): `glue/core/component_link.py`
- [Link builders](https://github.com/glue-viz/glue/blob/main/glue/core/link_helpers.py): `glue/core/link_helpers.py`
- [Link manager](https://github.com/glue-viz/glue/blob/main/glue/core/link_manager.py): `glue/core/link_manager.py`
- [Subsets and regions](https://github.com/glue-viz/glue/blob/main/glue/core/subset.py): `glue/core/subset.py`

### Coordination and state

- [Message hub](https://github.com/glue-viz/glue/blob/main/glue/core/hub.py): `glue/core/hub.py`
- [Domain messages](https://github.com/glue-viz/glue/blob/main/glue/core/message.py): `glue/core/message.py`
- [Commands and sessions](https://github.com/glue-viz/glue/blob/main/glue/core/command.py): `glue/core/command.py`
- [Viewer state](https://github.com/glue-viz/glue/blob/main/glue/viewers/matplotlib/state.py): `glue/viewers/matplotlib/state.py`

### Viewing and extensions

- [Interactive viewers](https://github.com/glue-viz/glue/tree/main/glue/viewers): `glue/viewers`
- [Viewer and data plugins](https://github.com/glue-viz/glue/tree/main/glue/plugins): `glue/plugins`
- [Link editor state](https://github.com/glue-viz/glue/blob/main/glue/dialogs/link_editor/state.py): `glue/dialogs/link_editor/state.py`

### Other components

- **Scientist**
- **Scientific files**
- **Glue front ends**

## Connections

- Scientist → Scientific files: selects
- Scientific files → Loader registry: offers to load
- NumPy loader → Loader registry: registers with (evidence: `glue/core/data_factories/numpy.py`)
- FITS loader → Loader registry: registers with (evidence: `glue/core/data_factories/fits.py`)
- Other loaders → Loader registry: extend loaders (evidence: `glue/core/data_factories/fits.py`)
- NumPy loader → Dataset components: creates (evidence: `glue/core/data_factories/numpy.py`)
- FITS loader → Dataset components: creates (evidence: `glue/core/data_factories/fits.py`)
- Dataset components → Dataset collection: combines datasets
- Dataset collection → Link manager: maintains links (evidence: `glue/core/link_manager.py`)
- Link manager → Component links: discovers derivations (evidence: `glue/core/link_manager.py`)
- Link builders → Component links: builds links (evidence: `glue/core/link_helpers.py`)
- Dataset components → Subsets and regions: supports subsets (evidence: `glue/core/data.py`)
- Message hub → Domain messages: broadcasts (evidence: `glue/core/hub.py`)
- Link manager → Message hub: subscribes to (evidence: `glue/core/link_manager.py`)
- Commands and sessions → Dataset collection: operates on (evidence: `glue/core/session.py`)
- Viewer state → Domain messages: uses state messages (evidence: `glue/viewers/matplotlib/state.py`)
- Glue front ends → Dataset collection: uses shared core
- Glue front ends → Interactive viewers: presents graphics
- Interactive viewers → Dataset components: visualizes linked data (evidence: `glue/viewers/scatter/layer_artist.py`)
- Viewer and data plugins → Loader registry: extends loaders (evidence: `glue/plugins/wcs_autolinking/wcs_autolinking.py`)
- Link editor state → Link builders: uses link helpers (evidence: `glue/dialogs/link_editor/state.py`)
- Scientist → Glue front ends: explores results
