Registry / devops / nwdiag

nwdiag

JSON →
library3.0.0pypypi✓ verified 84d ago

A simple text-to-image diagram generator for network diagrams, part of the blockdiag suite. Current version 3.0.0 supports Python >=3.7. Maintained irregularly.

pip install nwdiag
INSTALL
IMPORT
SIG · NWDIAG
N
nwdiag
devopspythonv3.0.0
Install
3.0s avg
Import
Disk
58MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 55.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.0s · import 0.000s · 57MB
58MB installed
● package 58MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

nwdiag
import nwdiag
from nwdiag import nwdiag
The package top-level is the module; use import nwdiag then call nwdiag.command()
parser
from nwdiag import parser
import parser
nwdiag.parser is the correct submodule, not the standard library parser

Generates a network diagram from a DOT-like text description.

import nwdiag # Create a simple network diagram nwdiag.command(['-o', 'output.png', '-']).stdout.write(""" nwdiag { network dmz { address = "192.168.1.0/24" web01 [address = "192.168.1.1"]; web02 [address = "192.168.1.2"]; } network internal { address = "10.0.0.0/8"; db01 [address = "10.0.0.1"]; db02 [address = "10.0.0.2"]; } } """)
nwdiag --version
Debug
Known issues
gotchanwdiag command line tool uses a different syntax than the Python API. The Python API expects a list of arguments similar to sys.argv, not the string directly.
fix
Use nwdiag.command(['-o', 'out.png', '-']) with stdin pipe, or nwdiag.command(['-o', 'out.png', 'diag.diag'])
affects: all
deprecatedThe blockdiag suite is no longer actively maintained; issues and PRs may go unanswered.
fix
Consider alternatives like diagrams (https://github.com/mingrammer/diagrams) for active development.
affects: all
gotchaThe .diag file format uses semicolons at the end of definitions; missing semicolons cause parse errors with unhelpful messages.
fix
Ensure every bracket block ends with a semicolon, e.g., 'network name { ... };'
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'nwdiag' from 'nwdiag'
Trying to import the submodule as 'from nwdiag import nwdiag' instead of 'import nwdiag'.
fix
Use 'import nwdiag' and then call nwdiag.command() or other functions.
AttributeError: module 'nwdiag' has no attribute 'command'
Installed a different package named nwdiag (e.g., from a third-party) or used an older version where the API was different.
fix
Uninstall any conflicting package and install the official nwdiag: pip install --upgrade nwdiag
Parse error: syntax error, unexpected 'network'
Missing semicolon after closing brace of a network block, or incorrect nesting of networks.
fix
Check that every block ends with a semicolon. Example: 'network dmz { ... };' not 'network dmz { ... }'
Upgrade
Version history
3.0.0latest on PyPI · released Dec 6, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
nwdiag — pip install nwdiag · libregistry