GNPy API
FastAPI service
This repository extends GNPy with a FastAPI-based HTTP service, allowing more flexible control and interaction with its simulation engine. The service can be used to integrate GNPy into software-defined networking (SDN) architectures or other external applications.
GNPy is an open-source Python-based library that models and evaluates the performance of optical networks. It is widely used for path computation, QoT (Quality of Transmission) estimation, and network planning.
🚀 Installation
Build from Source - Option 1
Clone the repository and install the package:
python3 setup.py install
or if you want to install it in a docker container:
docker build ./ -t gnpy-api
PyPI - Option 2
pip install gnpy-api
Quick Start
🧪 Usage - CLI
Start the FastAPI server:
python ./samples/rest_example.py
OpenAPI docs are available at http://localhost:8080/docs.
Send example data to the API:
curl --location 'http://localhost:8080/api/v1.0/path-request' --header 'Content-Type: application/json' --data @gnpyapi/exampledata/planning_demand_example.json
The example server runs over HTTP. Use a reverse proxy or uvicorn TLS settings for HTTPS.
🧪 Usage - Docker
docker run --rm -p 8080:8080 gnpy-api
🔄 Compatibility
Different versions of this interface extension are compatible with specific versions of GNPy. Please refer to the table below to ensure that you are using a supported version combination.
| Interface Version | Compatible GNPy Version | Notes |
|---|---|---|
v1.0.x |
2.14 |
FastAPI service, OpenAPI support |
v0.2.x |
2.14 |
YANG model validation |
v0.1.x |
>=2.12.1 |
Initial release |
⚠️ If you use an incompatible combination, some features may not work correctly or may produce unexpected errors.
To check your GNPy version, run:
pip show gnpy
📚 Documentation
Refer to the official GNPy documentation for information about network modeling and simulation capabilities.
API documentation is available in the docs folder.
Metadata
Release files for gnpy-api 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gnpy_api-1.0.0.tar.gz | 67.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gnpy_api-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 81.4 kB
Release files / gnpy_api-1.0.0.tar.gz
| Download URL | gnpy_api-1.0.0.tar.gz |
|---|---|
| Size | 67.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff8d97750bde9d223f04fad67d3192bdc56d094d48d3485e4f67df80bae5e32c
|
|
BLAKE2b-256 checksum How to use checksums |
40b83818bdb4594ae5d5f161e6c29cbda99175a6a408b92fad5e3c0c2a064b8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.
Transparency logRelease files / gnpy_api-1.0.0-py3-none-any.whl
| Download URL | gnpy_api-1.0.0-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3e5b16ffca6849c6210f193a1add63a3d1cec05d3ed5fe0bd15e035ef61e6f02
|
|
BLAKE2b-256 checksum How to use checksums |
a642af599f2472fc557bf75bef4a260cde8e1a0e58c80f3930e58f25cda7fb65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.
Transparency log