PyNetworkD3
Create D3 visualization networks with Python
Installation
Install using pip!
$ pip install pynetworkd3
Input JSON syntax
{
"nodes": [
{
"id": "id1",
"attribute 1": "value attribute 1",
"attribute 2": "value attribute 2",
(...)
"attribute N": "value attribute N",
},
{
"id": "id2",
"attribute 1": "value attribute 1",
"attribute 2": "value attribute 2",
(...)
"attribute N": "value attribute N",
},
(...)
],
"links": [
{
"source": "id1",
"target": "id2",
"attribute 1": "value attribute 1",
"attribute 2": "value attribute 2",
(...)
"attribute N": "value attribute N",
},
(...)
]
}
-
Every dictionary in "nodes" must have the id key. The other keys are optionals.
-
Every dictionary in "links" must have the source and target key. The other keys are optionals. Also, each id in source and target must redirect to an existing node in "nodes".
Usage
To use the library, import the Graph object directly and use the export method
to create a .html with the visualization.
from PyNetworkD3 import Graph
dataset = {
"nodes": [{"id": 1},{"id": 2},{"id": 3},{"id": 4},{"id": 5}],
"links": [
{"source": 1, "target": 3},
{"source": 2, "target": 3},
{"source": 1, "target": 3},
{"source": 5, "target": 3},
{"source": 4, "target": 1},
]
}
graph = Graph(dataset, width=300, height=200, radio=10, tooltip=["id"])
graph.export("output.html)
Also you can write the instance in the last line of the notebook's cell (ckeck the example in colab) to view the visualization.
Developing
This library uses PyTest as the test suite runner, and PyLint, Flake8, Black, ISort and MyPy as linters. It also uses Poetry as the default package manager.
The library includes a Makefile that has every command you need to start developing. If you don't have it, install Poetry using:
make get-poetry
Then, create a virtualenv to use throughout the development process, using:
make build-env
Activate the virtualenv using:
. .venv/bin/activate
Deactivate it using:
deactivate
To add a new package, use Poetry:
poetry add <new-package>
To run the linters, you can use:
# The following commands auto-fix the code
make black!
make isort!
# The following commands just review the code
make black
make isort
make flake8
make mypy
make pylint
To run the tests, you can use:
make tests
Releasing
To make a new release of the library, git switch to the master branch and execute:
make bump! minor
The word minor can be replaced with patch or major, depending on the type of release. The bump! command will bump the versions of the library, create a new branch, add and commit the changes. Then, just merge that branch to master. Finally, execute a merge to the stable branch. Make sure to update the version before merging into stable, as PyPi will reject packages with duplicated versions.
Metadata
Release files for pynetworkd3 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| PyNetworkD3-0.0.9.tar.gz | 14.7 kB | Without provenance | Details for PyNetworkD3-0.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| PyNetworkD3-0.0.9-py3-none-any.whl | Python 3 | none | any | Details for PyNetworkD3-0.0.9-py3-none-any.whl |
Total release size: 35.3 kB
Release files / PyNetworkD3-0.0.9.tar.gz
| Download URL | PyNetworkD3-0.0.9.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
791d3175edc59e8d5207493a8362d70eb9467a9c92ba7d1cc1057a93af05f13d
|
|
BLAKE2b-256 checksum How to use checksums |
2d16be104e432409b738b225d264881683b93f3dfaacf951387a7ab526a46043
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11
|
Release files / PyNetworkD3-0.0.9-py3-none-any.whl
| Download URL | PyNetworkD3-0.0.9-py3-none-any.whl |
|---|---|
| Size | 20.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9eb9d51b8e014b87a592102d1919fb4cdb87be5d96aee80d2f90e201d02e29ae
|
|
BLAKE2b-256 checksum How to use checksums |
0de12cc4364416a64ca5d640985d49edaa38953adf9ef1017e84aed2100069a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11
|
Security for pynetworkd3 0.0.9
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.