A simple CLI tool to compute network details for IPv4/IPv6 CIDR input.
- Inputs a CIDR (e.g.,
192.168.10.0/24
or2001:db8::/64
) - Outputs: network address, broadcast (v4), first/last usable (v4), total hosts, wildcard mask, and CIDR summary
- Supports bulk mode from a file of prefixes
- Tested with
pytest
python3 -m venv .venv
source .venv/bin/activate
Re-run the source .venv/bin/activate
command whenever you open a new
terminal session so the virtual environment stays active.
Choose one of the following approaches:
-
Editable install (recommended for development) – installs the package along with dependencies and exposes the
subnetcalc
console shortcut declared inpyproject.toml
:python3 -m pip install --editable .
-
Requirements file – installs only third-party dependencies, after which you continue running the CLI through
python3 -m subnet_calc
:python3 -m pip install -r requirements.txt
python3 -m subnet_calc --cidr 192.168.1.0/24
python3 -m subnet_calc --file prefixes.txt --summary
If you performed the editable install you can now invoke the shortcut directly:
subnetcalc --cidr 192.168.1.0/24
subnetcalc --file prefixes.txt --summary
python3 -m pytest -q