Skip to main content

A compact Python library for modeling, analyzing, and visualizing optical network topologies.

Project description

Topolib 🚀

Python Version License Issues Develop coverage Release coverage Documentation Status

A compact Python library for working with optical network topologies: nodes, links, metrics and visualization tools. 🌐

Overview

Topolib models network topologies with three main modules:

  • topolib.elements — Definitions of elementary building blocks

    • Node — represents a network node with id, name and geographic coordinates
    • Link — connects two Node objects and stores link length and id
  • topolib.topology — High-level topology model

    • Topology — holds nodes and links, provides methods to add/remove nodes and links, compute metrics, export JSON, and compute shortest/disjoint paths
    • Path — represents a path through the topology
  • topolib.analysis — Metrics and analysis helpers

    • Metrics — functions to compute node degree, link length statistics, connection matrices, etc.
  • topolib.visualization — Visualization helpers

    • MapView — functions to display topology with OSM or paper-style maps

(These components are derived from the project's class diagram in diagrams/class_diagram.puml.)

Features

  • Modular design: elements, topology, analysis, and visualization
  • Easy-to-use classes for nodes, links, and paths
  • Built-in metrics and analysis helpers
  • JSON import/export and interoperability
  • Ready for Sphinx, Read the Docs, and PyPI

Quickstart ⚡

Create and activate a virtual environment, install dev dependencies and run tests:

python -m venv .venv
source .venv/bin/activate
python -m pip install -U pip
python -m pip install -r dev-requirements.txt
python -m pytest -q

Installation

pip install topolib

Or for development:

git clone https://gitlab.com/DaniloBorquez/topolib.git
cd topolib
python -m venv .venv
source .venv/bin/activate
pip install -e .
pip install -r dev-requirements.txt

Documentation

Full documentation: https://topolib.readthedocs.io/

Basic usage example

from topolib.elements.node import Node
from topolib.topology.topology import Topology

# Create nodes
n1 = Node(1, 'A', 10.0, 20.0)
n2 = Node(2, 'B', 11.0, 21.0)

# Build topology
topo = Topology()
topo.add_node(n1)
topo.add_node(n2)
# add links, compute metrics, visualize

Development 🛠️

See CONTRIBUTING.md for development guidelines, commit message rules and pre-commit setup.

Class diagram

(If you prefer a rendered image of the UML, render the PlantUML file locally or in your CI pipeline.)

License

See LICENSE in the project root.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

topolib-0.3.0.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

topolib-0.3.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file topolib-0.3.0.tar.gz.

File metadata

  • Download URL: topolib-0.3.0.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for topolib-0.3.0.tar.gz
Algorithm Hash digest
SHA256 77af9dca119de11c8c6f08ade82bed02b862545cf8b53404b81bf3345f1cc5cc
MD5 ce8c3f58e9daa9f63b33817dafc63f62
BLAKE2b-256 e9e36e836e7e5d40a7de2cc94516252a3d8663807570b88849796c8b94c7f6e5

See more details on using hashes here.

File details

Details for the file topolib-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: topolib-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for topolib-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 93cf4ac394f836f5273eb6d2977a8e41d861c1ee2934381bdaaa63a3b827b7be
MD5 97de214ae035b0c5ca387ffb669b54c1
BLAKE2b-256 3fb3d40ea5f278e64208396c92fe030b6e9068250b001bc74ad019b4f5587d50

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page