# mapbox/mapbox-cli-py architecture

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

- Interactive diagram: https://gitdiagram.com/mapbox/mapbox-cli-py
- Repository: https://github.com/mapbox/mapbox-cli-py

## Overview

This is the archived Mapbox CLI (0.8.0), a command-line interface for Mapbox web services. The main workflow is: a user invokes the CLI, which loads configuration and credentials, dispatches a command, calls a Mapbox service, and prints or writes its response. Distinct command branches cover geocoding, directions, map matching, static maps, uploads, and dataset operations. The README only establishes the product’s archived status; command behavior and relationships below are based on sampled source and the SOURCE INDEX. Several command modules were not excerpted, so their documented branches are shown without inferred internal steps.

Main entry points: [`mapboxcli/scripts/cli.py`](https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/scripts/cli.py) (Command dispatcher), [`mapboxcli/errors.py`](https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/errors.py) (CLI exceptions), [`mapboxcli/scripts/geocoding.py`](https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/scripts/geocoding.py) (Geocoding), [`mapboxcli/scripts/directions.py`](https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/scripts/directions.py) (Directions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and configuration"]
  node_entrypoint["Module entry<br/>[__main__.py]"]
  node_cli["Command dispatcher<br/>[cli.py]"]
  node_config["Config display<br/>[config.py]"]
end

subgraph group_geo["Geospatial queries"]
  node_geocoding["Geocoding<br/>[geocoding.py]"]
  node_directions["Directions<br/>[directions.py]"]
  node_matching["Map matching<br/>[mapmatching.py]"]
end

subgraph group_mapsdata["Maps and data"]
  node_static["Static maps<br/>[static.py]"]
  node_datasets["Datasets<br/>[datasets.py]"]
  node_uploads["Uploads<br/>[uploads.py]"]
end

subgraph group_internal["Shared internals"]
  node_compat["Compatibility helpers<br/>[compat.py]"]
  node_errors["CLI exceptions<br/>[errors.py]"]
end

node_user(("CLI user"))
node_mapbox["Mapbox services"]
node_output["Terminal or file"]

node_user -->|"invokes"| node_entrypoint
node_entrypoint -->|"calls"| node_cli
node_user -->|"runs commands"| node_cli
node_cli -->|"registers"| node_config
node_cli -->|"registers"| node_geocoding
node_cli -->|"registers"| node_directions
node_cli -->|"registers"| node_matching
node_cli -->|"registers"| node_static
node_cli -->|"registers"| node_datasets
node_cli -->|"registers"| node_uploads
node_cli -->|"uses config parser"| node_compat
node_geocoding -->|"uses map helper"| node_compat
node_geocoding -->|"requests geocoding"| node_mapbox
node_directions -->|"requests routes"| node_mapbox
node_matching -->|"matches traces"| node_mapbox
node_static -->|"requests image"| node_mapbox
node_datasets -->|"reads and writes"| node_mapbox
node_uploads -->|"uploads data"| node_mapbox
node_geocoding -->|"writes response"| node_output
node_directions -->|"writes response"| node_output
node_matching -->|"writes response"| node_output
node_static -->|"writes image"| node_output
node_datasets -->|"writes response"| node_output
node_uploads -->|"writes response"| node_output
node_config -->|"prints settings"| node_output
node_datasets -->|"raises"| node_errors
node_directions -->|"raises"| node_errors
node_geocoding -->|"raises"| node_errors
node_matching -->|"raises"| node_errors
node_static -->|"raises"| node_errors
node_uploads -->|"raises"| node_errors

click node_entrypoint "https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/__main__.py"
click node_cli "https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/scripts/cli.py"
click node_config "https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/scripts/config.py"
click node_geocoding "https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/scripts/geocoding.py"
click node_directions "https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/scripts/directions.py"
click node_matching "https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/scripts/mapmatching.py"
click node_static "https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/scripts/static.py"
click node_datasets "https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/scripts/datasets.py"
click node_uploads "https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/scripts/uploads.py"
click node_compat "https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/compat.py"
click node_errors "https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/errors.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_entrypoint,node_cli,node_config,node_user toneBlue
class node_geocoding,node_directions,node_matching toneAmber
class node_static,node_datasets,node_uploads toneMint
class node_compat,node_errors toneRose
class node_mapbox,node_output toneIndigo
```

## Components

### CLI and configuration

- [Module entry](https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/__main__.py): `mapboxcli/__main__.py`
- [Command dispatcher](https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/scripts/cli.py): `mapboxcli/scripts/cli.py`
- [Config display](https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/scripts/config.py): `mapboxcli/scripts/config.py`

### Geospatial queries

- [Geocoding](https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/scripts/geocoding.py): `mapboxcli/scripts/geocoding.py`
- [Directions](https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/scripts/directions.py): `mapboxcli/scripts/directions.py`
- [Map matching](https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/scripts/mapmatching.py): `mapboxcli/scripts/mapmatching.py`

### Maps and data

- [Static maps](https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/scripts/static.py): `mapboxcli/scripts/static.py`
- [Datasets](https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/scripts/datasets.py): `mapboxcli/scripts/datasets.py`
- [Uploads](https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/scripts/uploads.py): `mapboxcli/scripts/uploads.py`

### Shared internals

- [Compatibility helpers](https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/compat.py): `mapboxcli/compat.py`
- [CLI exceptions](https://github.com/mapbox/mapbox-cli-py/blob/master/mapboxcli/errors.py): `mapboxcli/errors.py`

### Other components

- **CLI user**
- **Mapbox services**
- **Terminal or file**

## Connections

- CLI user → Module entry: invokes (evidence: `mapboxcli/__main__.py`)
- Module entry → Command dispatcher: calls (evidence: `mapboxcli/__main__.py`)
- CLI user → Command dispatcher: runs commands (evidence: `mapboxcli/scripts/cli.py`)
- Command dispatcher → Config display: registers (evidence: `mapboxcli/scripts/cli.py`)
- Command dispatcher → Geocoding: registers (evidence: `mapboxcli/scripts/cli.py`)
- Command dispatcher → Directions: registers (evidence: `mapboxcli/scripts/cli.py`)
- Command dispatcher → Map matching: registers (evidence: `mapboxcli/scripts/cli.py`)
- Command dispatcher → Static maps: registers (evidence: `mapboxcli/scripts/cli.py`)
- Command dispatcher → Datasets: registers (evidence: `mapboxcli/scripts/cli.py`)
- Command dispatcher → Uploads: registers (evidence: `mapboxcli/scripts/cli.py`)
- Command dispatcher → Compatibility helpers: uses config parser (evidence: `mapboxcli/scripts/cli.py`)
- Geocoding → Compatibility helpers: uses map helper (evidence: `mapboxcli/scripts/geocoding.py`)
- Geocoding → Mapbox services: requests geocoding (evidence: `mapboxcli/scripts/geocoding.py`)
- Directions → Mapbox services: requests routes (evidence: `mapboxcli/scripts/directions.py`)
- Map matching → Mapbox services: matches traces (evidence: `mapboxcli/scripts/mapmatching.py`)
- Static maps → Mapbox services: requests image (evidence: `mapboxcli/scripts/static.py`)
- Datasets → Mapbox services: reads and writes (evidence: `mapboxcli/scripts/datasets.py`)
- Uploads → Mapbox services: uploads data (evidence: `mapboxcli/scripts/uploads.py`)
- Geocoding → Terminal or file: writes response (evidence: `mapboxcli/scripts/geocoding.py`)
- Directions → Terminal or file: writes response (evidence: `mapboxcli/scripts/directions.py`)
- Map matching → Terminal or file: writes response (evidence: `mapboxcli/scripts/mapmatching.py`)
- Static maps → Terminal or file: writes image (evidence: `mapboxcli/scripts/static.py`)
- Datasets → Terminal or file: writes response (evidence: `mapboxcli/scripts/datasets.py`)
- Uploads → Terminal or file: writes response (evidence: `mapboxcli/scripts/uploads.py`)
- Config display → Terminal or file: prints settings (evidence: `mapboxcli/scripts/config.py`)
- Datasets → CLI exceptions: raises (evidence: `mapboxcli/scripts/datasets.py`)
- Directions → CLI exceptions: raises (evidence: `mapboxcli/scripts/directions.py`)
- Geocoding → CLI exceptions: raises (evidence: `mapboxcli/scripts/geocoding.py`)
- Map matching → CLI exceptions: raises (evidence: `mapboxcli/scripts/mapmatching.py`)
- Static maps → CLI exceptions: raises (evidence: `mapboxcli/scripts/static.py`)
- Uploads → CLI exceptions: raises (evidence: `mapboxcli/scripts/uploads.py`)
