Skip to main content

GMNSpy

Python tool for General Modeling Network Specification (GMNS) developed by Zephyr Foundation for Travel Analysis.

Installation

git clone https://github.com/e-lo/GMNSpy.git
cd GMNSpy
pip install .

Usage

Read a single file

Returns a dataframe that conforms to the specified schema and have been validated.

df = gmnspy.in_out.read_gmns_csv(data_filename, schema_file=schemafilename)

Read a network

Returns a dictionary of dataframes that conform to the specified schema and have been validated.

Checks foreign keys between files.

net = gmnspy.in_out.read_gmns_network(data_directory, config: "gmns.spec.json")

GMNS specification

A copy of the GMNS specification is kept in the /spec sub-directory as a series of JSON tables.

Data Table schemas

Data table schemas are specified in JSON and are compatible with the frictionless data table schema standards.

Example:

{
    "primaryKey": "segment_id",
    "missingValues": ["NaN",""],
    "fields": [
        {
            "name": "segment_id",
            "type": "any",
            "description": "Primary key.",
            "constraints": {
              "required": true,
              "unique": true
              }
        },
        {
            "name": "road_link_id",
            "type": "any",
            "description": "Required. Foreign key to road_links. The link that the segment is located on.",
            "foreign_key": "link.link_id",
            "constraints": {
              "required": true
              }
        },
        {
            "name": "ref_node_id",
            "type": "any",
            "description": "Required. Foreign key to node.",
            "foreign_key": "node.node_id",
            "constraints": {
              "required": true
              }
        },
        {
            "name": "start_lr",
            "type": "number",
            "description": "Required. Distance from ref_node_id.",
            "constraints": {
              "required": true,
              "minimum": 0
              }
        },
        {
            "name": "end_lr",
            "type": "number",
            "description": "Required. Distance from ref_node_id.",
            "constraints": {
              "required": true,
              "minimum": 0
              }
          }
    ]
}

Network Data Config

Network data schemas are specified in JSON and are compatible with the frictionless data data package standards.

Example:

{
  "profile": "gmns-data-package",
  "profile_version":0.0,
  "name": "my-dataset",
  "resources": [
   {
     "name":"link",
     "path": "link.csv",
     "schema": "link.schema.json",
     "required": true
   },
   {
     "name":"node",
     "path": "node.csv",
     "schema": "node.schema.json",
     "required": true
   }
 ]
}

Issues

Please add issues, bugs, and feature requests to Github.

Roadmap

Current feature roadmap includes:

  • conversion tools from open street map
  • network connectivity checks
  • auto documentation of schema to markdown files
  • tests tests tests

Feel free to submit pull requests for consideration. See CONTRIBUTING for more detailed instructions.

Credits

Primary Author: Elizabeth Sall, UrbanLabs LLC

Contributing authors and code maintainers:

  • Pedro Carmago, OuterLoop Consulting
  • Ian Berg, Volpe Center

See all in CONTRIBUTORS.md

License to Use

The code herein is licensed under the Apache License 2.0 as defined in file.

Metadata

Release files for gmnspy 0.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gmnspy 0.3.5
File Size Uploaded Provenance Actions
gmnspy-0.3.5.tar.gz 28.5 kB With provenance Details for gmnspy-0.3.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gmnspy 0.3.5
File Interpreter ABI Platform Actions
gmnspy-0.3.5-py3-none-any.whl Python 3 none any Details for gmnspy-0.3.5-py3-none-any.whl

Total release size: 69.6 kB

Release files / gmnspy-0.3.5.tar.gz

Download URL gmnspy-0.3.5.tar.gz
Size 28.5 kB
Tags Source
SHA-256 checksum
How to use checksums
525a9501ea4c07c8fc4a1ba26eb870837905194593e31768322b8bb18ee3006b
BLAKE2b-256 checksum
How to use checksums
3c46aac5c3cbf893fd6b3be9191aa2b938ccd43fa8d14c87870d2b73c4e0d0ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Feb 26, 2026.

Transparency log

Release files / gmnspy-0.3.5-py3-none-any.whl

Download URL gmnspy-0.3.5-py3-none-any.whl
Size 41.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf8912f0c0db77c61b4a1a05258cf608b73618f128c9edee41477a44809f67b5
BLAKE2b-256 checksum
How to use checksums
d1a624a2fbd8c8e8ce487bab51d1b36488e92387201632dc4053c3c4c6fd9374
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Feb 26, 2026.

Transparency log

Security for gmnspy 0.3.5

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for gmnspy-0.3.5.tar.gz

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 Feb 26, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page