Registry / data / springpy

springpy

JSON →
library0.1.0pypypi✓ verified 83d ago

SpringPy is a Python library for visualizing distance matrices as force-directed spring layouts. Version 0.1.0, released with an unspecified cadence. It supports Python >=3.4 and provides an easy interface to generate spring-based visualizations from distance matrices.

pip install springpy
INSTALL
IMPORT
SIG · SPRINGPY
S
springpy
datapythonv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

springpy
import springpy
from springpy import springpy
springpy is a module, not a submodule; import directly.

Visualize a distance matrix using SpringPy's force-directed layout. Provide a square distance matrix as a 2D array-like (list of lists or numpy array). The draw function will display a matplotlib plot.

import springpy import numpy as np # Example distance matrix dist_matrix = np.array([[0, 1, 2], [1, 0, 3], [2, 3, 0]]) # Visualize using default settings springpy.draw(dist_matrix)
Debug
Known issues
gotchaThe distance matrix must be symmetric and non-negative. The library does not explicitly validate this; providing an asymmetric matrix may produce unexpected behavior.
fix
Ensure input matrix is symmetric (dist_matrix == dist_matrix.T) and contains only non-negative values.
affects: all
deprecatedThe library version 0.1.0 is early-stage and APIs may change without notice. Not recommended for production use.
fix
Consider pinning the version and testing thoroughly before upgrading.
affects: <1.0.0
gotchaThe library requires matplotlib for plotting, but it is not declared as a strict dependency. If matplotlib is missing, calling springpy.draw() will raise an ImportError.
fix
Install matplotlib separately: pip install matplotlib
affects: all
Errors
Common errors & fixes
ImportError: No module named 'springpy'
springpy is not installed or the Python environment does not include it.
fix
Run 'pip install springpy' to install the package.
AttributeError: module 'springpy' has no attribute 'draw'
The import statement might be incorrect (e.g., from springpy import springpy) or an outdated version.
fix
Use 'import springpy' then 'springpy.draw(...)'. If using an older version, upgrade with 'pip install --upgrade springpy'.
ValueError: The truth value of an array with more than one element is ambiguous
Passing a non-square or non-numeric matrix that causes internal boolean operations.
fix
Ensure the input is a square numeric matrix (list of lists or numpy array).
Upgrade
Version history
0.1.0latest on PyPI · released Apr 21, 2023
Audit
Dependencies
matplotliboptionalRequired for plotting the spring layout visualization.
Agent activity
13 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources
springpy — pip install springpy · libregistry