AlgorithmX Python
AlgorithmX Python is a library for network visualization and algorithm simulation, built on AlgorithmX. It can be used through a HTTP/WebSocket
server, or as a widget in Jupyter Notebooks and JupyterLab.
Resources
Installation
Python 3.7.0 or higher is required. Using pip:
python -m pip install algorithmx
Jupyter Widget
In classic Jupyter notebooks, the widget will typically be enabled by default. To enable it manually, run
jupyter nbextension enable --sys-prefix --py algorithmx
with the appropriate flag. To enable in JupyterLab, run
python -m jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build
python -m jupyter lab build
Example Usage
If you wish to use the library through a HTTP/WebSocket server, follow the template below:
import algorithmx
server = algorithmx.http_server(port=5050)
canvas = server.canvas()
def start():
canvas.nodes([1, 2]).add()
canvas.edge((1, 2)).add()
canvas.onmessage('start', start)
server.start()
The graphics can be found at http://localhost:5050/.
If you are using Jupyter, try adding the following code to a cell:
from algorithmx import jupyter_canvas
canvas = jupyter_canvas()
canvas.nodes([1, 2]).add()
canvas.edge((1, 2)).add()
canvas
Development
Manual install
Make sure you have Python 3.7 of higher, then run
# build js
cd js
npm run build
cd ..
# install dependencies
python -m pip install -r dev-requirements.txt
python -m pip install --no-deps --editable ".[jupyter,networkx]"
HTTP Server
Docker: Docker-compose up http-server
Manually: python examples/basic_http_server.py
Then open localhost:5050 in a browser.
Jupyter notebook
Docker: docker-compose up notebook
Manually:
python -m jupyter nbextenion list
python -m jupyter notebook
Then try opening examples/basic_notebook.ipynb.
Jupyter lab
Docker: docker-compose up jupyter-lab
Manually:
python -m jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build
python -m jupyter lab build
python -m jupyter labextension list
python -m jupyter lab
Then try opening examples/basic_notebook.ipynb.
Build and test package
Clean any previous builds with rm -rf build dist.
Docker: docker-compose up --build build
Manually:
python -m mypy .
python -m pytest tests -vv
python setup.py build sdist bdist_wheel
The bundle can be found in dist/.
Distribute
- Set up pre-commit hooks:
pre-commit install - Publish to PyPI:
./scripts/deploy.sh
Metadata
Release files for algorithmx 2.0.3
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 |
|---|---|---|---|---|
| algorithmx-2.0.3.tar.gz | 950.5 kB | Without provenance | Details for algorithmx-2.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| algorithmx-2.0.3-py3-none-any.whl | Python 3 | none | any | Details for algorithmx-2.0.3-py3-none-any.whl |
Total release size: 2.5 MB
Release files / algorithmx-2.0.3.tar.gz
| Download URL | algorithmx-2.0.3.tar.gz |
|---|---|
| Size | 950.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
354585a02883e096d6ecacd06a95c138344b419bda1ae0f480965861dbd051d8
|
|
BLAKE2b-256 checksum How to use checksums |
a8d1e293d0ed901dae76e18ea98606a9a6e6967f988857ed908101292ee031c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|
Release files / algorithmx-2.0.3-py3-none-any.whl
| Download URL | algorithmx-2.0.3-py3-none-any.whl |
|---|---|
| Size | 1.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
91d10a048671b5b0f741dfb9b8c7d8a8aa11d7351ed4f90870e2ca7118c9139f
|
|
BLAKE2b-256 checksum How to use checksums |
76f1bdef3135164119089fa0109a0362ca6ee4a01ca212d8c46476eff7529a16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|
Security for algorithmx 2.0.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.