{"id":24132,"library":"nwdiag","title":"nwdiag","description":"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.","status":"active","version":"3.0.0","language":"python","source_language":"en","source_url":"https://github.com/blockdiag/nwdiag","tags":["diagram","network","graphviz","ascii"],"install":[{"cmd":"pip install nwdiag","lang":"bash","label":"Standard install"}],"dependencies":[],"imports":[{"note":"The package top-level is the module; use import nwdiag then call nwdiag.command()","wrong":"from nwdiag import nwdiag","symbol":"nwdiag","correct":"import nwdiag"},{"note":"nwdiag.parser is the correct submodule, not the standard library parser","wrong":"import parser","symbol":"parser","correct":"from nwdiag import parser"}],"quickstart":{"code":"import nwdiag\n\n# Create a simple network diagram\nnwdiag.command(['-o', 'output.png', '-']).stdout.write(\"\"\"\nnwdiag {\n  network dmz {\n    address = \"192.168.1.0/24\"\n\n    web01 [address = \"192.168.1.1\"];\n    web02 [address = \"192.168.1.2\"];\n  }\n  network internal {\n    address = \"10.0.0.0/8\";\n\n    db01 [address = \"10.0.0.1\"];\n    db02 [address = \"10.0.0.2\"];\n  }\n}\n\"\"\")","lang":"python","description":"Generates a network diagram from a DOT-like text description."},"warnings":[{"fix":"Use nwdiag.command(['-o', 'out.png', '-']) with stdin pipe, or nwdiag.command(['-o', 'out.png', 'diag.diag'])","message":"nwdiag 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.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider alternatives like diagrams (https://github.com/mingrammer/diagrams) for active development.","message":"The blockdiag suite is no longer actively maintained; issues and PRs may go unanswered.","severity":"deprecated","affected_versions":"all"},{"fix":"Ensure every bracket block ends with a semicolon, e.g., 'network name { ... };'","message":"The .diag file format uses semicolons at the end of definitions; missing semicolons cause parse errors with unhelpful messages.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'import nwdiag' and then call nwdiag.command() or other functions.","cause":"Trying to import the submodule as 'from nwdiag import nwdiag' instead of 'import nwdiag'.","error":"ImportError: cannot import name 'nwdiag' from 'nwdiag'"},{"fix":"Uninstall any conflicting package and install the official nwdiag: pip install --upgrade nwdiag","cause":"Installed a different package named nwdiag (e.g., from a third-party) or used an older version where the API was different.","error":"AttributeError: module 'nwdiag' has no attribute 'command'"},{"fix":"Check that every block ends with a semicolon. Example: 'network dmz { ... };' not 'network dmz { ... }'","cause":"Missing semicolon after closing brace of a network block, or incorrect nesting of networks.","error":"Parse error: syntax error, unexpected 'network'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}