๐ nbpull
Read-only CLI tool to pull IPAM data from NetBox.
๐ Safety guarantee: nbpull only reads data from NetBox. No POST / PUT / PATCH / DELETE requests are ever made. The HTTP client is hardcoded to GET-only โ this invariant is enforced by code structure and verified by tests.
๐ NetBox compatibility: Tested against NetBox Cloud v4.4.10. Compatible with NetBox v3.x+ (legacy
sitefield) and v4.2+ (genericscoperelation). ThePrefixmodel transparently handles both via theresolved_siteproperty.
โจ Features
- ๐ก Prefixes โ list and filter IPAM prefixes
- ๐ฅ๏ธ IP Addresses โ query IP address allocations
- ๐ท๏ธ VLANs โ browse VLAN assignments
- ๐ VRFs โ inspect VRF instances
- ๐ Aggregates โ list top-level IP space by RIR
- ๐ข Sites โ browse DCIM sites
- ๐ง Devices โ query DCIM devices
- ๐๏ธ Tenants โ list tenancy tenants
- ๐ RFC 1918 โ inventory Global VRF RFC 1918 prefixes with mapping status
- ๐ฆ Batch queries โ check many prefixes at once from a TOML file
- ๐จ Rich table output (default), JSON saved to a file (
--format json), or CSV (--format csv) - ๐ Filter by status, VRF, tenant, site, tag, or free-text search
- โก Async HTTP with automatic pagination
- ๐ Strict typing (mypy strict mode + Pydantic v2)
๐ฆ Installation
With uv (recommended)
uv tool install nbpull
With pipx
pipx install nbpull
With pip
pip install nbpull
From source
git clone https://github.com/Champion2005/nbpull.git
cd nbpull
make install # uses uv sync
๐ Quick Start
# 1. Run the interactive setup wizard
nbpull setup
# Or configure manually:
export NETBOX_URL=https://netbox.example.com
export NETBOX_TOKEN=your_read_only_token
# Or: cp .env.example .env && edit .env
# 2. Pull data
nbpull prefixes
nbpull prefixes --status active --vrf Production
nbpull ip-addresses --prefix 10.0.0.0/24
nbpull vlans --site DC1
nbpull vrfs --tenant Ops
nbpull aggregates --rir ARIN
nbpull sites --status active
nbpull devices --role "Core Router"
nbpull tenants
nbpull rfc1918
nbpull batch-prefixes --file my_prefixes.toml --status-only
๐ Commands
| Command | Description |
|---|---|
nbpull setup |
Interactive setup wizard |
nbpull prefixes |
List IPAM prefixes |
nbpull ip-addresses |
List IP addresses |
nbpull vlans |
List VLANs |
nbpull vrfs |
List VRFs |
nbpull aggregates |
List IPAM aggregates (top-level space by RIR) |
nbpull sites |
List DCIM sites |
nbpull devices |
List DCIM devices |
nbpull tenants |
List tenancy tenants |
nbpull rfc1918 |
Inventory Global VRF RFC 1918 prefixes with mapping status |
nbpull location-report |
Location-to-IP report โ mapped prefixes with PRD and general columns |
nbpull batch-prefixes |
Query multiple prefixes from a TOML file |
Common Flags
| Flag | Description |
|---|---|
--status |
Filter by status (active, reserved, deprecated, container) |
--vrf |
Filter by VRF name |
--tenant |
Filter by tenant name |
--site |
Filter by site name |
--tag |
Filter by tag slug |
--search / -s |
Free-text search |
--limit / -l |
Max results (default: 50) |
--format / -f |
Output format: table (default), json (writes to file), or csv |
--output / -o |
JSON output file path (prompts with default if omitted) |
--verbose / -v |
Enable debug logging |
See the full command reference for all options.
โ๏ธ Configuration
Set these in .env or as environment variables:
| Variable | Required | Default | Description |
|---|---|---|---|
NETBOX_URL |
โ | โ | NetBox instance URL |
NETBOX_TOKEN |
โ | โ | API token (read-only recommended) |
NETBOX_PAGE_SIZE |
โ | 100 |
Results per API page |
NETBOX_TIMEOUT |
โ | 30 |
Request timeout (seconds) |
NETBOX_VERIFY_SSL |
โ | true |
Verify SSL certificates |
See docs/configuration.md for details on token setup and SSL options.
๐ฆ Batch Queries
Create a TOML file to query multiple prefixes in one run:
prefixes = [
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16",
]
[filters]
# status = "active"
# vrf = "Production"
nbpull batch-prefixes --file prefixes.toml --status-only
๐ Architecture
src/netbox_data_puller/
โโโ cli.py # Typer commands + filtering + JSON file output
โโโ client.py # Async GET-only NetBox API client
โโโ config.py # Pydantic Settings (.env)
โโโ formatters.py # Rich table renderers
โโโ models/ # Pydantic models per resource
โโโ __init__.py
โโโ common.py # Shared field types / base classes
โโโ aggregate.py
โโโ device.py
โโโ ip_address.py
โโโ prefix.py
โโโ site.py
โโโ tenant.py
โโโ vlan.py
โโโ vrf.py
See docs/architecture.md for a full breakdown.
๐ ๏ธ Development
Prerequisites
- Python 3.13+
- uv โ fast Python package manager
Setup
git clone https://github.com/Champion2005/nbpull.git
cd nbpull
make install # Install dependencies
Commands
make all # format โ lint โ typecheck โ test
make test # unit tests (no network)
make lint # ruff linter
make format # auto-format with ruff
make typecheck # mypy strict mode
make test-integration # hits real NetBox API
Running Tests
Unit tests use mocked HTTP responses and require no network access:
make test
Integration tests require NETBOX_URL and NETBOX_TOKEN:
make test-integration
๐ค Contributing
Contributions are welcome! Please read CONTRIBUTING.md before opening a PR.
๐ Changelog
See CHANGELOG.md for a history of changes.
๐ License
This project is licensed under the GNU General Public License v3.0 โ see the LICENSE file for details.
๐ Acknowledgements
Metadata
Release files for nbpull 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| nbpull-0.4.0.tar.gz | 23.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nbpull-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 52.7 kB
Release files / nbpull-0.4.0.tar.gz
| Download URL | nbpull-0.4.0.tar.gz |
|---|---|
| Size | 23.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
284f549a47dd8e7f65cde1f7877a30bc16e6e0035459df3f2c520b67b955dcce
|
|
BLAKE2b-256 checksum How to use checksums |
e658ccb546c582c9b9bd4747f3ffa84ed49c7d5a7a50a211fbb6f0681b41ddaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 5, 2026.
Transparency logRelease files / nbpull-0.4.0-py3-none-any.whl
| Download URL | nbpull-0.4.0-py3-none-any.whl |
|---|---|
| Size | 29.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e336885a06f2183fbf4c60c2710f10672dbb2b500e7bb47d6cc977c11a997877
|
|
BLAKE2b-256 checksum How to use checksums |
7366a967e1845a758d4b948ad95fc57e93b7292488f82f7e0141bd5b3fc6a76c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 5, 2026.
Transparency logSecurity for nbpull 0.4.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for nbpull-0.4.0.tar.gz
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 Mar 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.