Solves constrained connectivity between sources & sinks
Project description
Patch Panel
Patch Panel is a Python library for solving constrained connectivity between sources and sinks. The sources and sinks can be any arbitrary (hashable) object, and connectivity is returned as a simple list of tuples. This library does not guarantee a unique solution, it simply returns the first legal solution that satisfies all constraints.
Installing
Easiest way to install Patch Panel is to grab it from PyPI:
$> pip install patchpanel
Alternatively you can install it manually:
$> git clone git@github.com:Intuity/patchpanel
$> cd patchpanel
$> python3 setup.py install
Example
from patchpanel.problem import Problem
# Create I/O
sources = [f"src_{x}" for x in range(2)]
sinks = [f"snk_{x}" for x in range(2)]
# Create the problem
problem = Problem(sources, sinks)
# Constrain to allow any-to-any
problem.constrain(sources, sinks)
# Solve
conns, u_src, u_sink = problem.solve()
# Display
print(f"Connections: {conns}")
print(f"Uncon. src : {u_src}")
print(f"Uncon. sink: {u_sink}")
Running Tests
Patch Panel comes with a basic suite of tests, which use pytest
for regression:
$> git clone git@github.com:Intuity/patchpanel
$> cd patchpanel
$> python3 setup.py test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file patchpanel-0.1.tar.gz
.
File metadata
- Download URL: patchpanel-0.1.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d30131ee1dbb1c1861d0757728ea29fb2f695c6c4635206aa45478c8ae411a98 |
|
MD5 | c3e649b4ef055d95d55a4674726d0ea1 |
|
BLAKE2b-256 | 95fa6f9e0921b8230a7fe77aece2c9fe4b7d2ae319079911230514fa08ff2c95 |
File details
Details for the file patchpanel-0.1-py3-none-any.whl
.
File metadata
- Download URL: patchpanel-0.1-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 272cfdda9fa70927d18a9e2013fce1fba8454ec4b1afba3319f205d4e0cee89d |
|
MD5 | e8a1ab8fab24cf95fc52fe5f7788038a |
|
BLAKE2b-256 | 93e221294cbb2381c1b088f152b24e28aa3802953757c6ebaafdaa63b9cd9978 |