nbpull is a read-only CLI tool that queries the NetBox REST API and renders IPAM data as Rich tables or JSON.
┌─────────────────────────────────────────────────────┐
│ CLI (Typer) │
│ prefixes · ip-addresses · vlans · vrfs · batch │
└───────────────┬─────────────────────┬───────────────┘
│ │
┌──────▼──────┐ ┌───────▼───────┐
│ Client │ │ Formatters │
│ (httpx) │ │ (Rich) │
│ GET-only │ │ table / json │
└──────┬──────┘ └───────────────┘
│
┌──────▼──────┐
│ Config │
│ (pydantic- │
│ settings) │
└──────┬──────┘
│
┌──────▼──────┐
│ Models │
│ (Pydantic) │
│ Prefix, IP, │
│ VLAN, VRF │
└─────────────┘
- Defines all Typer commands and options
- Builds API query parameters from CLI flags
- Orchestrates fetch → validate → render pipeline
- Shows progress spinners on stderr
- Read-only by design — only
get()andget_single()methods - Async HTTP via httpx
- Automatic pagination (follows
nextlinks) - Context manager for connection lifecycle
- Loads from
.envfile or environment variables - Validated with pydantic-settings
- Prefixed with
NETBOX_(e.g.NETBOX_URL)
- Rich table formatters for each resource type
- JSON output via
model_dump() - Colour-coded status indicators
- Batch summary with direct-match vs parent-container grouping
- Pydantic v2 models for each NetBox IPAM resource
extra="allow"tolerates API fields we don't explicitly modelNestedRef— for related objects ({id, display})ChoiceRef— for enum fields ({value, label})
- Read-only safety — The client has no write methods. This is enforced by code structure and verified by tests.
- Async I/O — All HTTP calls use
async/awaitfor efficient pagination. - Strict typing — mypy strict mode with Pydantic plugin.
- Fail-fast config — Bad settings surface immediately with helpful error messages.
- Tolerant models —
extra="allow"means new NetBox API fields won't break existing functionality.