Skip to main content

DotPruner DotPruner Python package Status PyPI version

Pruning redundant nodes from DOT graphs

Before:

DOT graph before pruning

After:

DOT graph after pruning

Installation

To install DotPruner with pip, run: pip install dotpruner

To install DotPruner from source, first clone the repository and then run: python setup.py install

Usage

CLI

Prune graph "in-place":

python -m dotpruner path/to/original/graph.dot

Use --dest or -d to specify destination for new graph:

python -m dotpruner path/to/original/graph.dot --dest path/to/new/graph.dot

Use --overwrite or -o to overwrite existing file in destination:

python -m dotpruner path/to/original/graph.dot -d path/to/new/graph.dot --overwrite

API

import dotpruner

# string representation of DOT graph
original_graph_str = ...

# pruned graph represented using pydot
pruned_graph = dotpruner.process_from_string(original_graph_str)

Optionally pass in a node_picker function to change which node is preserved in the pruning stage -- by default, the lexicographically smaller node is preserved.

# keep the lexicographically larger node
dotpruner.process_from_string(original_graph_str, node_picker=max)

Tests

python -m unittest discover dotpruner.tests --verbose

Metadata

Release files for dotpruner 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dotpruner 0.1.3
File Size Uploaded Provenance Actions
dotpruner-0.1.3.tar.gz 3.5 kB Without provenance Details for dotpruner-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dotpruner 0.1.3
File Interpreter ABI Platform Actions
dotpruner-0.1.3-py3-none-any.whl Python 3 none any Details for dotpruner-0.1.3-py3-none-any.whl

Total release size: 8.7 kB

Release files / dotpruner-0.1.3.tar.gz

Download URL dotpruner-0.1.3.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
55631691a0620b3610a960ef5308de160286c85002ad0b1c43190ffb19640f11
BLAKE2b-256 checksum
How to use checksums
ae2103c21876e839079556b4cb00aabe8ff568a989defe66020eaf5d8a8c8165
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.3

Release files / dotpruner-0.1.3-py3-none-any.whl

Download URL dotpruner-0.1.3-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8fca246a594c7dd0f6842765cbc78920fcdf8587a67d45979fb19a30967c8b7b
BLAKE2b-256 checksum
How to use checksums
bc1b57af149256246224729318ba3a798d1b26715482dd037db75fde2f8bdd07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.3

Security for dotpruner 0.1.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page