Pyvis HTML Export: Check What the File Still Loads

Compare the native export with the prepared reading file before calling it self-contained.

You generated a graph in Python and selected inline resources, but the HTML still contains remote asset addresses. Inspect the exported file before calling it self-contained. Keep the untouched output separate from any reading copy you prepare for a more constrained environment.

An export option is a starting point for a resource check, not proof that every dependency is embedded. This article uses Pyvis 0.3.2 and an original fictional reading network: Field note connects to Catalog entry, which connects to Cross-reference. Those are document relationships for the example, not live library records.

Actual Pyvis export: three reading records and a checked resource boundary
Actual Pyvis export: three reading records and a checked resource boundary
Open the full example ↗

Open the complete example · Download the full HTML source

Generate a bounded graph before packaging it

The Pyvis tutorial introduces the Network instance, node IDs, labels and edges. Keep IDs separate from the labels a reader sees:

from pyvis.network import Network

net = Network(height="420px", width="100%", cdn_resources="in_line")
net.add_node("field", label="Field note", x=-140, y=0)
net.add_node("catalog", label="Catalog entry", x=0, y=-80)
net.add_node("crossref", label="Cross-reference", x=140, y=0)
net.add_edge("field", "catalog")
net.add_edge("catalog", "crossref")
net.toggle_physics(False)
net.write_html("reading-network.html", notebook=False, open_browser=False)

This source deliberately turns off the physics layout so the initial positions are reproducible. The two supplied edges are undirected; neither their visual slope nor their order in the source establishes a publication sequence.

The selected implementation's export method distinguishes writing the file from opening a browser. Use write_html with open_browser=False for this reproduction. Retain the actual Python source and its executed output instead of presenting a manually drawn network as Pyvis output.

Inspect the generated resource references

Search the generated document for script src attributes and stylesheet href attributes. Classify active resource references separately from URLs that merely appear inside comments, license notices or a bundled library's source text.

In the selected 0.3.2 template, cdn_resources="in_line" embeds the vis-network resources. That same template also contains Bootstrap stylesheet and script references. The recorded export retains those references even though this fixture does not request selection menus or configuration panels. Keep the original export when documenting that observation.

Check the file your recipient will open, not only the constructor argument in Python. A resource named “inline” in your source does not establish what a third-party template emitted in this particular release.

For the prepared reading copy here, the unused Bootstrap references are removed and local presentation styles are supplied. The actual generated graph data and embedded visualization code remain with the page. That prepared copy is identified separately from the untouched native export; the original download is not relabeled as fully offline.

The self-contained HTML checklist provides a separate way to review the delivered file’s references. Apply it to the untouched export and the prepared copy individually, and retain the difference between them. Do not transfer the prepared copy’s resource findings to the native export just because both show the same three labels.

Compare the graph data as well as its appearance

Require the three IDs field, catalog and crossref, with exactly two edges: field–catalog and catalog–crossref. Keep those records readable below the drawing. Confirm that the visible labels still read Field note, Catalog entry and Cross-reference at phone width.

Moving a node changes the view rather than editing those source relationships. In the reading copy, Fit view reframes the current drawing. The prepared copy leaves extra space around that fitted view so the longest label remains inside a narrow embedded panel. It does not regenerate the Python source or claim to restore data that a different application may have edited.

The existing vis-network selection guide addresses a browser application's selection event behavior. This task begins with an actual Python-generated export and checks what its delivery file contains. It does not add a path calculation or replace the graph's source records.

Keep both export and prepared copy available

Deliver the Python generator, untouched native export and prepared reading page as distinct files. If the graph changes, regenerate from Python and repeat the same node, edge and resource checks before replacing the reading copy.

For a review in NOS, keep the relationship list beside the graph and use the prepared copy whose active resources have been checked. Finish by matching the delivered page to its three source records and two connections.

Maintained source · Untouched native output (ZIP)

Keep reading