python wrappers for the Stormwater Management Model (SWMM5)
Getting started
-
Project Website: www.pyswmm.org
Introducing the SWAG STORE! All Proceeds go toward the hosting/service fees related to maintaining the PySWMM Project!!! Get yourself a hoodie or coffee cup!
🆘Do you need HELP?🆘
GitHub Discussions to answer support questions related to PySWMM.
Cite our Paper
McDonnell, Bryant E., Ratliff, Katherine M., Tryby, Michael E., Wu, Jennifer Jia Xin, & Mullapudi, Abhiram. (2020). PySWMM: The Python Interface to Stormwater Management Model (SWMM). Journal of Open Source Software, 5(52), 2292, https://doi.org/10.21105/joss.02292
YouTube Training Videos
Setting a manhole inflow during a running simulation!
Overview
PySWMM is a Python language software package for the creation, manipulation, and study of the structure, dynamics, and function of complex networks.
With PySWMM you can load and manipulate USEPA Stormwater Management Models. With the development of PySWMM, control algorithms can now be developed exclusively in Python which allows the use of functions and objects as well as storing and tracking hydraulic trends for control actions.
As of version v1.1.0, PySWMM includes new features to process metadata and timeseries stored in SWMM binary output file.
Who uses PySWMM?
PySWMM is used by engineers, modelers, and researchers who want to streamline stormwater modeling optimization, controls, and post-processing results.
Goals
PySWMM is intended to provide
- tools for the study of the structure and dynamics within USEPA SWMM5,
- a standard programming interface and graph implementation that is suitable for many applications,
- a rapid development environment for collaborative, multidisciplinary projects,
- an interface to USEPA SWMM5,
- development and implementation of control logic outside of native EPA-SWMM Controls,
- methods for users to establish their own node inflows,
- a coding interface to binary output files,
- new modeling possibilities for the SWMM5 Community.
Install
Get the latest version of PySWMM from PyPI See the Quick Guide!
$ pip install pyswmm
As of version 1.3.1, pyswmm can be installed with specific versions of the SWMM engine ranging from 5.1.14 to 5.2.4 using pip extras:
$ pip install "pyswmm[swmm5.2.4]"
Usage
A quick example that steps through a simulation:
Examples:
See the Latte Example
from pyswmm import Simulation, Nodes, Links
with Simulation(r'Example1.inp') as sim:
Node21 = Nodes(sim)["21"]
print("Invert Elevation: {}". format(Node21.invert_elevation))
Link15 = Links(sim)['15']
print("Outlet Node ID: {}".format(Link15.outlet_node))
# Launch a simulation!
for ind, step in enumerate(sim):
if ind % 100 == 0:
print(sim.current_time,",",round(sim.percent_complete*100),"%",\
Node21.depth, Link15.flow)
Opening a SWMM binary output file and accessing model metadata and timeseries.
from pyswmm import Output, SubcatchSeries, NodeSeries, LinkSeries, SystemSeries
with Output('model.out') as out:
print(len(out.subcatchments))
print(len(out.nodes))
print(len(out.links))
print(out.version)
sub_ts = SubcatchSeries(out)['S1'].runoff_rate
node_ts = NodeSeries(out)['J1'].invert_depth
link_ts = LinkSeries(out)['C2'].flow_rate
sys_ts = SystemSeries(out).rainfall
Contributing
Please check out our Wiki https://github.com/pyswmm/pyswmm/wiki for more information on contributing, including an Author Contribution Checklist.
Bugs
Our issue tracker is at https://github.com/pyswmm/pyswmm/issues. Please report any bugs that you find. Or, even better, fork the repository on GitHub and create a pull request. All changes are welcome, big or small, and we will help you make the pull request if you are new to git (just ask on the issue).
License
Distributed with a BSD2 license; see LICENSE.txt:
Copyright (C) 2014-2025 (See Authors)
Community-Owned See AUTHORS and CITATION.cff
Metadata
Release files for pyswmm 2.2.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 | |
|---|---|---|---|
| pyswmm-2.2.0.tar.gz | 114.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyswmm-2.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 265.7 kB
Release files / pyswmm-2.2.0.tar.gz
| Download URL | pyswmm-2.2.0.tar.gz |
|---|---|
| Size | 114.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c1388a18113432013111cc6aa576c484d912ac6874d8cbe57100b02035f4491
|
|
BLAKE2b-256 checksum How to use checksums |
7d02a9b7236bca62fb59bb39b33531a9b8dfbdb9f006699b2914b32687cf95f8
|
| 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 Oct 1, 2026.
Transparency logRelease files / pyswmm-2.2.0-py3-none-any.whl
| Download URL | pyswmm-2.2.0-py3-none-any.whl |
|---|---|
| Size | 151.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9682b37af9617b9a1b399a8552808aea7c22a03f66a76dc1961d7372e217831f
|
|
BLAKE2b-256 checksum How to use checksums |
904661fddca946611607becbb4dfce70726290b8cef599c142099f611d6daad4
|
| 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 Oct 1, 2026.
Transparency log