PYPI PACKAGE AUDIT v6.0.0a4.dev3 Enterprise Healthy

openswmm

Python bindings for the OpenSWMM stormwater modelling engine.

PyPkgScore openswmm
Methodology & Criteria โ™ฅ Donate
905 / 1000
Quick Install
pip install openswmm
1. Governance
200/200
2. PEP Metadata
200/200
3. Security
200/200
4. Docs & SEO
105/200
5. CI Engineering
200/200
๐Ÿ“ฃ Share Audit: Share this report and visual preview in the current language
Advertisement
PYPI TELEMETRY

Downloads & Community Adoption

Last 30 days (without mirrors)
Last 7 days
715
Last 30 days
1735
Total (180 days)
7979
Metric / Ecosystem Status / Value Source
Downloads (30d / 180d) โ€” PyPI Stats (without mirrors)
Trusted Publishing (PEP 740) โœ“ Verified OIDC PyPI Integrity / Sigstore
Django Packages โ€” djangopackages.org
PyTech / PyPkgScore 905 / 1000 PyPkgScore Engine

Health & Engineering Analysis (5 Pillars)

1. Governance & Community200 / 200 โ–พ
LICENSEโœ“ 50 pts
SECURITY.mdโœ“ 50 pts
CONTRIBUTING.mdโœ“ 50 pts
CODE_OF_CONDUCT.mdโœ“ 50 pts
2. PEP Metadata & Packaging200 / 200 โ–พ
Wheel (.whl)โœ“ 50 pts
pyproject.tomlโœ“ 50 pts
Project URLsโœ“ 50 pts
Trove Classifiersโœ“ 50 pts
3. Security & Supply Chain200 / 200 โ–พ
Zero CVEs (OSV)โœ“ 60 pts
Trusted Publishing (OIDC)โœ“ 50 pts
Snyk / Audit Linkโœ“ 40 pts
HTTPS Repositoryโœ“ 50 pts
4. Documentation, SEO & Ecosystem105 / 200 โ–พ
Structured READMEโœ“ 60 pts
Read the Docsโœ• 0 pts
Django Packagesโœ• 0 pts
Website / Technical Articlesโœ“ 45 pts
5. Engineering, CI & Quality200 / 200 โ–พ
Automated Testsโœ“ 65 pts
GitHub Actions CIโœ“ 65 pts
CHANGELOG.mdโœ“ 35 pts
Env & Lockfile (uv/rye/poetry/pdm/hatch)โœ“ 35 pts
Advertisement
README & DOCS

Official Documentation & Usage Guide โ€” openswmm

PyPI Metadata v6.0.0a4.dev3
Show full original documentation (English README) โ–พ

OpenSWMM Engine

Open Storm Water Management Model โ€” Next-Generation Computational Engine

Unit Testing Python wheels Documentation Issues License: Apache 2.0 PyPI Downloads Python Wheel

Documentation

Site Contents
C / C++ Engine hydrocouple.org/openswmm.engine Full C API reference, hydrology / hydraulics / water-quality reference manuals, engine manual (input format, files, reports, C API), architecture notes.
Python Bindings hydrocouple.org/openswmm.engine/python Quickstart, per-domain user guide, Cython API reference, SWMM 5 โ†’ v6 migration.

Both sites cross-link from their top navigation.


Python API coverage and testing

The modern bindings include groundwater authoring/results and transport, surface-quality tables, transport capability diagnostics, batch editing and live output reading. Guides document their units, lifecycle and immutable snapshot behavior under python/docs/guide/. The strict API coverage check is python python/scripts/api_drift_audit.py --strict from the repository root.

Saved results have a named interface through Results. It reads 1D binary output and 2D HDF5 output independently of a running solver, including mixed meshes, species, envelopes and layered groundwater. Fields expose their units, dimensions and time coordinates before loading NumPy arrays:

from openswmm.engine import Results

with Results.open("model.out", surface="model.2d.h5") as results:
    depths = results.nodes["J1"].depth.read()
    flood_map = results.surface.depth.read(periods=-1)
    cell_history = results.surface.cells[42].depth.read()

See the results guide for selections, mesh coordinates, optional pandas/xarray conversions and lifecycle rules. Read 2D files after the writer closes or from an immutable copy; live monitoring remains available for 1D binary output. Output2DReader.available() checks for the optional backend. python python/scripts/api_drift_audit.py --json --coverage produces the per-header coverage table and C-to-Python member map.

Mesh-only first-order groundwater checkpoint sessions support matched optional BULK MSX/pollutant inventories, age-only and heat-only layouts, using WATER_ONLY or paired porous heat, with numerical state or mesh HDF5 output. Live network/catchment chemistry and binary/combined companions retain their separate guards; see the groundwater guide.

After initialization, solver.surface2d.groundwater.execution_status reports available and executed groundwater operators, accepted evaluation counts, effective host threads and CPU-owned companions. The optional OpenMP profile computes raw CLOSED_FORM recharge only; the surface backend label does not describe groundwater operator use.

For local validation use the openswmm Conda environment. After building and installing to a staging prefix, run conda run -n openswmm python python/scripts/test_staged_package.py STAGE python/tests --ignore=python/tests/typing. This verifies the selected native binaries and avoids an editable install silently redirecting tests to an older extension. CI runs the complete modern, legacy and top-level suites against built wheels, plus independent source and typing gates. Source reachability is not a claim of numerical validation.

openswmm.engine.catalog is a machine-readable map of this API: every target reachable from a Solver (services such as forcing, element kinds such as node and sub-views such as node.stats) with each property's type, access, units and lifecycle phases, and each method's signature. The MCP server and gymnasium use it to reach the whole API without per-function code. It is generated by python python/scripts/gen_catalog.py; CI runs the same script with --check and fails when the catalog is stale or a class is unreachable.

Overview

OpenSWMM Engine is a community-driven, open-source continuation of the EPA Storm Water Management Model โ€” a dynamic hydrology, hydraulic, and water-quality simulator for urban runoff. The project preserves the SWMM legacy under QA/QC and builds the community needed for long-term maintenance, working with ASCE/EWRI and the Water Environment Federation.

What's New in v6.0.0

Architecture & Performance

  • Data-Oriented Design โ€” Core state refactored to Structure-of-Arrays for cache efficiency and SIMD-friendly batches.
  • Reentrant Engine โ€” All simulation state lives behind an opaque SWMM_Engine handle; multiple independent simulations can run in the same process.
  • Plugin-Based I/O โ€” Output and report writing dispatch through plugin interfaces on a dedicated I/O thread.
  • C++20 Codebase โ€” Modern C++20 implementation; the legacy EPA SWMM 5.x solver is preserved unmodified in src/legacy/.

Process Formulation Enhancements

Implemented
  • Semi-Implicit Node Continuity โ€” Single-equation free-surface/surcharge formulation that removes the legacy two-branch discontinuity. Enabled via NODE_CONTINUITY SEMI_IMPLICIT (default). Reference ยป

  • Anderson Acceleration for Picard Iteration โ€” Two-point mixing of each node's last two head updates where the update is smooth, with fall-back to standard Picard elsewhere. Whether it saves iterations depends on the network (hydraulics manual ยง3.6). Enabled via ANDERSON_ACCEL YES.

  • Spatially Explicit Overland Flow & Groundwater (2D) โ€” 2D overland-flow grid coupled to the 1D pipe network. Surcharge re-routes over terrain to downstream nodes, lateral groundwater exchanges are tracked explicitly, and green-infrastructure placement is spatially resolved.

  • Dynamic Preissmann Slot โ€” Geometry-dependent slot width replaces the fixed-width slot at the free-surface / pressurized transition, improving stability for rapidly filling or draining conduits.

  • Physics-Based Initial Abstraction Recovery โ€” RDII initial abstraction now evolves as an exponential depletion/recovery process with additive base + thermal recovery rates and frozen-ground suppression. Seasonal RDII variation emerges from temperature dynamics on a single RTK set per sewershed โ€” no monthly parameter tables required. Configured via the new [RDII_DECAY] input section.

    $$IA_{avail}(t+\Delta t) = IA_{max} - \bigl(IA_{max} - IA_{avail}(t)\bigr) \cdot e^{-k_{rec}(T),\Delta t}, \quad k_{rec}(T) = k_0 + k_T \cdot e^{,\theta(T - T_{ref})}$$

In Development
  • Spatially Explicit Inlets โ€” Promotes inlets to mode-switching junction nodes that capture street flow when gutter spread exceeds a threshold and revert to passive junctions otherwise.
  • LID as Storage Nodes โ€” Maps LID layers (surface, media, gravel) onto extended storage nodes using a reduced-physics kinematic Richards ODE for two-way hydraulic feedback.

New C API

A domain-split C API replaces the monolithic legacy interface. Full reference at the C engine documentation site.

Header Domain
openswmm_engine.h Engine lifecycle, error codes, state machine
openswmm_model.h Model building, validation, serialization, options
openswmm_nodes.h Junctions, outfalls, storage, dividers
openswmm_links.h Conduits, pumps, orifices, weirs, outlets
openswmm_subcatchments.h Subcatchments, infiltration, coverage
openswmm_gages.h Rain gages
openswmm_pollutants.h Pollutant definitions and runtime injection
openswmm_tables.h Time series, curves, patterns
openswmm_inflows.h External inflows, DWF, RDII (incl. [RDII_DECAY])
openswmm_controls.h Control rules and direct link actions
openswmm_infrastructure.h Transects, streets, inlets, LID controls
openswmm_spatial.h CRS, coordinates, polylines, polygons
openswmm_quality.h Landuse, buildup, washoff, treatment
openswmm_massbalance.h Continuity errors and cumulative flux totals
openswmm_callbacks.h Progress, warning, and step callbacks
openswmm_hotstart.h Hot start file save / load / modify
openswmm_statistics.h Node, link, and subcatchment statistics
openswmm_geopackage.h Optional GeoPackage I/O

Additional Features

  • Hot Start API โ€” Save, load, modify, and query hot-start files through a stable C ABI.
  • Cross-Section Geometry โ€” XSectionGeometry exposes the engine's own geometry kernels (area, top width, hydraulic radius, section factor, critical depth, and their inverses) for all 26 shapes, standalone or per-link, with scalar or NumPy-batch evaluation.
  • CRS Support โ€” Coordinate reference systems specified in [OPTIONS].
  • User Flags โ€” Typed [USER_FLAGS] / [USER_FLAG_VALUES] sections attach custom metadata (boolean, integer, real, string) to nodes, links, subcatchments, or gages.
  • Extension Options โ€” Unrecognized [OPTIONS] keys are preserved and exposed to plugins at runtime.
  • Plugin SDK โ€” Header-only SDK in include/openswmm/plugin_sdk/ for input, output, and report plugins; the IPluginComponentInfo entry point advertises capabilities and supports custom .inp section handlers via SectionRegistry.
  • GeoPackage I/O โ€” Optional SQLite + spatial backing store for inputs, results, observed series, and topology in a single .gpkg file (-DOPENSWMM_WITH_GEOPACKAGE=ON).
  • HEC-22 Inlet Analysis โ€” Street inlet capture with grate and curb inlets (SWMM 5.2).
  • Variable Speed Pumps โ€” Type 5 pump curves with speed scaling.
  • New Storage Shapes โ€” Conical and pyramidal shapes with elliptical and rectangular bases.
  • Model Editing with Impact Analysis โ€” ModelEditor previews and cascades deletions across all 22 referenceable object categories (nodes, links, subcatchments, gages, tables, transects, pollutants, patterns, aquifers, snowpacks, LID controls, streets, inlet designs, land uses, unit hydrographs, and more), plus node/link type conversion.
  • Lenient Model Loading โ€” Solver.set_lenient_open() loads a model with validation errors into an editable OPENED state instead of failing, exposing them via Solver.open_errors / Solver.open_warnings for editor/GUI workflows.

Quick Start

# C / C++ engine
git clone https://github.com/HydroCouple/openswmm.engine.git
cd openswmm.engine
git clone https://github.com/microsoft/vcpkg.git && ./vcpkg/bootstrap-vcpkg.sh
export VCPKG_ROOT=$(pwd)/vcpkg

cmake --preset=<platform> -B build -DOPENSWMM_WITH_GEOPACKAGE=ON
cmake --build build --config Release
ctest --test-dir build -C Release --output-on-failure

# Python bindings (PyPI)
pip install openswmm

Presets: Windows, Windows-debug, Linux, Linux-debug, Darwin, Darwin-debug. Full build, test, and packaging instructions are in the C engine docs.

from openswmm.engine import Solver, Nodes, Links

with Solver("model.inp", "model.rpt", "model.out") as s:
    nodes, links = Nodes(s), Links(s)
    while s.step():
        depth = nodes.get_depth("J1")
        flow  = links.get_flow("C1")

Forcing, model building, hot-start, bulk NumPy access, mass balance, and statistics are covered in the Python docs.

Glossary

Brief definitions of the domain terms used throughout this README. Full treatment lives in the reference manuals.

  • RDII โ€” Rainfall-Dependent Inflow & Infiltration. Stormwater that enters sanitary or combined sewers through cracks, joints, defective laterals, and roof / foundation drains during and after rainfall.
  • RTK โ€” The triplet (R, T, K) that parameterises a SWMM synthetic unit hydrograph for RDII: R is the long-term fraction of rainfall that becomes RDII, T is the time to peak (hours), and K is the ratio of base time to peak time.
  • IA (Initial Abstraction) โ€” Rainfall depth absorbed by the catchment before any RDII response begins (interception, surface storage, soil wetting). Recovers between events.
  • DWF โ€” Dry-Weather Flow. Base sanitary flow plus infiltration unrelated to rainfall, typically specified as an average value with diurnal / day-of-week / monthly patterns.
  • LID โ€” Low-Impact Development. Distributed green-infrastructure controls (bio-retention cells, permeable pavement, green roofs, infiltration trenches, rain gardens) that intercept, store, and infiltrate runoff at the source.
  • CRS โ€” Coordinate Reference System. The geodetic / projected coordinate frame (e.g. EPSG:4326) the model's spatial data is expressed in.
  • CFS / CMS โ€” Cubic feet per second / cubic metres per second. The two flow-unit conventions exposed via FLOW_UNITS.
  • Dynamic Wave Routing โ€” Full Saint-Venant momentum solver for link flow, used for backwater, surcharge, and pressurized conditions.
  • Preissmann Slot โ€” A narrow virtual slot added to a closed conduit's cross-section so that pressurized flow can be solved with the same free-surface equations. The dynamic slot adjusts width with geometry to smooth the surface โ†” pressure transition.
  • Surcharge โ€” A pipe flowing full and under pressure (HGL above the crown), typically caused by downstream backwater or capacity exceedance.
  • Picard Iteration โ€” Fixed-point iteration used inside the dynamic-wave timestep to converge implicit node depths. Anderson Acceleration is a residual-history accelerator on top of Picard.
  • Hot Start โ€” A saved end-of-run state (depths, volumes, IA, snow, GW) that initialises a subsequent simulation, letting long runs be split into checkpoints or warm runs into operational forecasts.
  • HEC-22 โ€” FHWA Hydraulic Engineering Circular No. 22, the design reference whose grate and curb-opening capture equations are used by the inlet-analysis module.
  • GeoPackage โ€” OGC standard for a SQLite-based, single-file container holding spatial features and tabular data with full CRS metadata.

Prerequisites

Requirement Version
CMake 3.21+
C compiler C17 (GCC 10+, Clang 12+, MSVC 19.29+)
C++ compiler C++20 (GCC 10+, Clang 14+, MSVC 19.29+)
vcpkg 2025.02.14
Python 3.9 โ€“ 3.13 (optional)
Ninja recommended on Linux/macOS

Project Structure

openswmm.engine/
โ”œโ”€โ”€ include/openswmm/
โ”‚   โ”œโ”€โ”€ engine/           # New engine public C API headers
โ”‚   โ””โ”€โ”€ legacy/           # Legacy SWMM 5.x public headers
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ engine/           # New C++20 engine implementation
โ”‚   โ”‚   โ”œโ”€โ”€ input/geopackage/  # Optional GeoPackage I/O
โ”‚   โ”‚   โ””โ”€โ”€ 2d/                # 2D overland-flow & groundwater coupling
โ”‚   โ”œโ”€โ”€ legacy/           # Original EPA SWMM 5.x solver and output reader
โ”‚   โ”œโ”€โ”€ plugin_sdk/       # Header-only plugin SDK
โ”‚   โ””โ”€โ”€ cli/              # Command-line interface
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ unit/legacy/      # Legacy solver & output tests
โ”‚   โ”œโ”€โ”€ unit/engine/      # New engine unit tests
โ”‚   โ”œโ”€โ”€ regression/       # New-vs-legacy regression tests
โ”‚   โ””โ”€โ”€ benchmarks/       # Performance benchmarks
โ”œโ”€โ”€ python/               # Cython bindings (scikit-build)
โ”œโ”€โ”€ docs/                 # Doxygen config and technical manuals
โ””โ”€โ”€ .github/workflows/    # CI/CD pipelines

Libraries Built

Target Description
openswmm_legacy_engine Original EPA SWMM 5.x solver (shared)
openswmm_legacy_output Original SWMM binary output reader (shared)
openswmm_engine New refactored C++20 engine (shared)
openswmm_geopackage GeoPackage I/O (static, optional โ€” requires SQLite3)
openswmm_plugin_sdk Header-only plugin SDK (INTERFACE)
openswmm_cli Command-line executable

Contributing

Contributions are welcome โ€” bug reports, fixes, new features, docs, tests, and benchmarks.

  1. Read CONTRIBUTING.md for the development workflow and the Code of Conduct.
  2. Fork the repo and create a feature branch.
  3. Ensure C++ (ctest) and Python (pytest) tests pass.
  4. Follow existing style and naming.
  5. Open a PR against develop.

Contributor License Agreement

First-time contributors must sign the project CLA before a pull request can be merged. The CLA grants the project a perpetual, royalty-free copyright and patent license to your contributions and preserves the project's ability to relicense in the future; you retain full copyright ownership of your work.

Signing is automated through CLA Assistant โ€” when you open your first PR, a bot comments with a one-click sign-in link. The CLA covers all subsequent contributions, so you only sign once. Corporate contributors should additionally submit a CCLA per CLA ยง6.

License

Apache License, Version 2.0 โ€” see LICENSE and NOTICE. Original EPA SWMM material is in the public domain under 17 USC ยง 105 and is not subject to the Apache license grant.

Acknowledgements

OpenSWMM builds on the EPA Storm Water Management Model. See docs/authors.md for the full contributor list.