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.4.1.tar.gz (17.3 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.4.1-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: topolib-0.4.1.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.14 Linux/5.15.154+

File hashes

Hashes for topolib-0.4.1.tar.gz
Algorithm Hash digest
SHA256 4d9ee9fde8f0bd9ba0fa1039dd81c6f1b96856c67a32263a40c613dcef6ba506
MD5 4278a404c355fe0311ef3069d7fe5f75
BLAKE2b-256 025c7cd95485a82090ec8502e98f6a9a00a8cb016c3f048e13d35d5315c9b6ee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: topolib-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.14 Linux/5.15.154+

File hashes

Hashes for topolib-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3187ff3b3e9f2ea15ca8330569e0943427535dfa22433e3be74d5bffb7995189
MD5 cf2f0bb1b4e6886c2b849a491f01dadd
BLAKE2b-256 cc0e13173b31c3c05b92f9d38cbbbe246017a34c7b7302337c6bbbc286a6cbed

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