epaswmm-bmi 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- epaswmm_bmi-0.1.0/.github/actions/setup/action.yml +25 -0
- epaswmm_bmi-0.1.0/.github/workflows/publish.yml +81 -0
- epaswmm_bmi-0.1.0/.github/workflows/test.yml +92 -0
- epaswmm_bmi-0.1.0/.gitignore +11 -0
- epaswmm_bmi-0.1.0/CHANGELOG.md +25 -0
- epaswmm_bmi-0.1.0/CITATION.cff +34 -0
- epaswmm_bmi-0.1.0/CODE_OF_CONDUCT.md +11 -0
- epaswmm_bmi-0.1.0/COMPATIBILITY.md +33 -0
- epaswmm_bmi-0.1.0/CONTRIBUTING.md +70 -0
- epaswmm_bmi-0.1.0/LICENSE +28 -0
- epaswmm_bmi-0.1.0/PKG-INFO +437 -0
- epaswmm_bmi-0.1.0/README.md +417 -0
- epaswmm_bmi-0.1.0/docs/basinledger-coupling.md +179 -0
- epaswmm_bmi-0.1.0/docs/figures/tour-outfalls.png +0 -0
- epaswmm_bmi-0.1.0/docs/groundwater-hooks.md +158 -0
- epaswmm_bmi-0.1.0/docs/swmm-notes.md +165 -0
- epaswmm_bmi-0.1.0/examples/daily.py +58 -0
- epaswmm_bmi-0.1.0/examples/tour.py +147 -0
- epaswmm_bmi-0.1.0/pyproject.toml +35 -0
- epaswmm_bmi-0.1.0/src/epaswmm_bmi/__init__.py +10 -0
- epaswmm_bmi-0.1.0/src/epaswmm_bmi/bmi.py +704 -0
- epaswmm_bmi-0.1.0/src/epaswmm_bmi/inp.py +75 -0
- epaswmm_bmi-0.1.0/src/epaswmm_bmi/units.py +181 -0
- epaswmm_bmi-0.1.0/tests/conftest.py +55 -0
- epaswmm_bmi-0.1.0/tests/data/LICENSE-pyswmm.txt +25 -0
- epaswmm_bmi-0.1.0/tests/data/README.md +21 -0
- epaswmm_bmi-0.1.0/tests/data/epa_Example1.inp +350 -0
- epaswmm_bmi-0.1.0/tests/data/epa_Example2.inp +165 -0
- epaswmm_bmi-0.1.0/tests/data/epa_Example3.inp +131 -0
- epaswmm_bmi-0.1.0/tests/data/epa_inlet_drains.inp +502 -0
- epaswmm_bmi-0.1.0/tests/data/pyswmm_full_features.inp +283 -0
- epaswmm_bmi-0.1.0/tests/data/pyswmm_lids.inp +351 -0
- epaswmm_bmi-0.1.0/tests/data/pyswmm_storage_pump_MGD.inp +272 -0
- epaswmm_bmi-0.1.0/tests/models.py +323 -0
- epaswmm_bmi-0.1.0/tests/test_balance.py +152 -0
- epaswmm_bmi-0.1.0/tests/test_bmi.py +124 -0
- epaswmm_bmi-0.1.0/tests/test_models.py +272 -0
- epaswmm_bmi-0.1.0/tests/test_quality.py +84 -0
- epaswmm_bmi-0.1.0/tests/test_release.py +25 -0
- epaswmm_bmi-0.1.0/tests/test_stepping.py +168 -0
- epaswmm_bmi-0.1.0/tests/test_units.py +108 -0
- epaswmm_bmi-0.1.0/tools/bmi_conformance.py +52 -0
- epaswmm_bmi-0.1.0/tools/check_wheel.py +75 -0
- epaswmm_bmi-0.1.0/tools/time_large.py +125 -0
- epaswmm_bmi-0.1.0/uv.lock +1259 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: setup
|
|
2
|
+
description: Python, the epaswmm-bmi package, swmm-toolkit and pytest through uv, from uv.lock
|
|
3
|
+
inputs:
|
|
4
|
+
python:
|
|
5
|
+
description: Python version (empty for uv's choice under requires-python)
|
|
6
|
+
default: ""
|
|
7
|
+
runs:
|
|
8
|
+
using: composite
|
|
9
|
+
steps:
|
|
10
|
+
- uses: astral-sh/setup-uv@v5
|
|
11
|
+
- name: Python, the package and pytest from uv.lock
|
|
12
|
+
shell: bash
|
|
13
|
+
run: |
|
|
14
|
+
if [ -n "${{ inputs.python }}" ]; then uv sync --locked --python "${{ inputs.python }}"; else uv sync --locked; fi
|
|
15
|
+
# macOS can refuse to load swmm-toolkit's libraries in a new environment (README, Install)
|
|
16
|
+
- name: swmm-toolkit loads (macOS signs its libraries ad hoc if refused)
|
|
17
|
+
shell: bash
|
|
18
|
+
run: |
|
|
19
|
+
if ! uv run --no-sync python -c "import swmm.toolkit.solver as s; print('SWMM', s.swmm_version_info())"; then
|
|
20
|
+
[ "$RUNNER_OS" = macOS ] || exit 1
|
|
21
|
+
for f in .venv/lib/python3.*/site-packages/swmm/toolkit/*.so .venv/lib/python3.*/site-packages/swmm/toolkit/*.dylib; do
|
|
22
|
+
codesign --force -s - "$f"
|
|
23
|
+
done
|
|
24
|
+
uv run --no-sync python -c "import swmm.toolkit.solver as s; print('SWMM', s.swmm_version_info())"
|
|
25
|
+
fi
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
name: publish
|
|
2
|
+
# Push a tag v* (for example v0.1.0) to release: the tests run on Linux, macOS and Windows, the package is built
|
|
3
|
+
# (the source and a pure wheel), the wheel is installed alone and run against the suite on each, and both are
|
|
4
|
+
# published to PyPI by trusted publishing (no stored token) from the environment pypi. The tag then gets a GitHub
|
|
5
|
+
# release with its notes from that version's section of CHANGELOG.md. With the repository switched on in Zenodo,
|
|
6
|
+
# the GitHub release is archived there with a DOI.
|
|
7
|
+
#
|
|
8
|
+
# Before the first release: add this repository as a trusted publisher on PyPI (project epaswmm-bmi, workflow
|
|
9
|
+
# publish.yml, environment pypi), and create the environment pypi in the repository's settings.
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
tags: ["v*"]
|
|
13
|
+
|
|
14
|
+
defaults:
|
|
15
|
+
run:
|
|
16
|
+
shell: bash
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
build:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
- uses: ./.github/actions/setup
|
|
24
|
+
- name: The tag matches the package version
|
|
25
|
+
run: |
|
|
26
|
+
test "${GITHUB_REF_NAME#v}" = "$(uv run python -c 'import epaswmm_bmi; print(epaswmm_bmi.__version__)')"
|
|
27
|
+
grep -q "^version = \"${GITHUB_REF_NAME#v}\"" pyproject.toml
|
|
28
|
+
grep -q "^## ${GITHUB_REF_NAME#v} " CHANGELOG.md
|
|
29
|
+
- run: uv run pytest -q
|
|
30
|
+
- run: |
|
|
31
|
+
uv build
|
|
32
|
+
uvx twine check dist/*
|
|
33
|
+
- uses: actions/upload-artifact@v4
|
|
34
|
+
with:
|
|
35
|
+
name: dist
|
|
36
|
+
path: dist/
|
|
37
|
+
|
|
38
|
+
check:
|
|
39
|
+
needs: build
|
|
40
|
+
strategy:
|
|
41
|
+
fail-fast: true
|
|
42
|
+
matrix:
|
|
43
|
+
os: [ubuntu-latest, macos-15, windows-latest]
|
|
44
|
+
runs-on: ${{ matrix.os }}
|
|
45
|
+
steps:
|
|
46
|
+
- uses: actions/checkout@v4
|
|
47
|
+
- uses: ./.github/actions/setup
|
|
48
|
+
- run: uv run pytest -q
|
|
49
|
+
- name: The wheel, installed alone and run against the suite
|
|
50
|
+
run: uv run python tools/check_wheel.py --out wheels
|
|
51
|
+
|
|
52
|
+
pypi:
|
|
53
|
+
needs: [build, check]
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
environment:
|
|
56
|
+
name: pypi
|
|
57
|
+
url: https://pypi.org/project/epaswmm-bmi/
|
|
58
|
+
permissions:
|
|
59
|
+
id-token: write
|
|
60
|
+
steps:
|
|
61
|
+
- uses: actions/download-artifact@v4
|
|
62
|
+
with:
|
|
63
|
+
name: dist
|
|
64
|
+
path: dist/
|
|
65
|
+
- run: ls -l dist/
|
|
66
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
67
|
+
|
|
68
|
+
github-release:
|
|
69
|
+
needs: pypi
|
|
70
|
+
runs-on: ubuntu-latest
|
|
71
|
+
permissions:
|
|
72
|
+
contents: write
|
|
73
|
+
steps:
|
|
74
|
+
- uses: actions/checkout@v4
|
|
75
|
+
- env:
|
|
76
|
+
GH_TOKEN: ${{ github.token }}
|
|
77
|
+
run: |
|
|
78
|
+
v=${GITHUB_REF_NAME#v}
|
|
79
|
+
awk -v h="## $v " 'index($0,h)==1{on=1;next} /^## /{on=0} on' CHANGELOG.md > notes.md
|
|
80
|
+
test -s notes.md
|
|
81
|
+
gh release create "$GITHUB_REF_NAME" --verify-tag --title "epaswmm-bmi $v" --notes-file notes.md
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Run the test suite on Linux, macOS and Windows.
|
|
2
|
+
#
|
|
3
|
+
# supported: uv.lock's dependencies (swmm-toolkit 0.17.0) on every push, pull request and night: the suite, CSDMS's
|
|
4
|
+
# BMI conformance tests, the example, and the wheel installed alone into a new environment and run against the
|
|
5
|
+
# whole suite.
|
|
6
|
+
# latest: the newest release of every dependency the package allows, on the oldest and newest supported Python,
|
|
7
|
+
# nightly and on demand, so an upstream release that breaks the package shows up before users hit it.
|
|
8
|
+
# canary: the newest swmm-toolkit on PyPI even past the package's pin (<0.18), nightly and on demand, as an early
|
|
9
|
+
# warning that the next toolkit may change units or totals the wrapper relies on (COMPATIBILITY.md). Not
|
|
10
|
+
# supported; a failure here doesn't fail the run.
|
|
11
|
+
|
|
12
|
+
name: test
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
push:
|
|
16
|
+
pull_request:
|
|
17
|
+
schedule:
|
|
18
|
+
- cron: "41 7 * * *" # nightly, 07:41 UTC
|
|
19
|
+
workflow_dispatch:
|
|
20
|
+
|
|
21
|
+
defaults:
|
|
22
|
+
run:
|
|
23
|
+
shell: bash
|
|
24
|
+
|
|
25
|
+
jobs:
|
|
26
|
+
supported:
|
|
27
|
+
strategy:
|
|
28
|
+
fail-fast: false
|
|
29
|
+
matrix:
|
|
30
|
+
os: [ubuntu-latest, macos-15, windows-latest]
|
|
31
|
+
runs-on: ${{ matrix.os }}
|
|
32
|
+
name: swmm-toolkit 0.17.0 on ${{ matrix.os }}
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v4
|
|
35
|
+
- uses: ./.github/actions/setup
|
|
36
|
+
- run: uv run pytest -q
|
|
37
|
+
- name: CSDMS's BMI conformance tests (bmi-tester), on the campus in U.S. and SI units and on the public models
|
|
38
|
+
run: |
|
|
39
|
+
uv run python tools/bmi_conformance.py CFS
|
|
40
|
+
uv run python tools/bmi_conformance.py CMS
|
|
41
|
+
for f in tests/data/*.inp; do uv run python tools/bmi_conformance.py "$f"; done
|
|
42
|
+
- name: The examples
|
|
43
|
+
run: |
|
|
44
|
+
uv run python examples/daily.py CFS
|
|
45
|
+
uv run python examples/daily.py CMS
|
|
46
|
+
uv run --group examples python examples/tour.py
|
|
47
|
+
- name: The wheel, installed alone and run against the suite
|
|
48
|
+
run: uv run python tools/check_wheel.py --out wheels
|
|
49
|
+
- if: matrix.os == 'ubuntu-latest'
|
|
50
|
+
uses: actions/upload-artifact@v4
|
|
51
|
+
with:
|
|
52
|
+
name: wheel
|
|
53
|
+
path: wheels/*.whl
|
|
54
|
+
retention-days: 14
|
|
55
|
+
|
|
56
|
+
latest:
|
|
57
|
+
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
|
58
|
+
strategy:
|
|
59
|
+
fail-fast: false
|
|
60
|
+
matrix:
|
|
61
|
+
os: [ubuntu-latest, macos-15, windows-latest]
|
|
62
|
+
python: ["3.11", "3.14"]
|
|
63
|
+
runs-on: ${{ matrix.os }}
|
|
64
|
+
name: Newest dependencies, Python ${{ matrix.python }} on ${{ matrix.os }}
|
|
65
|
+
steps:
|
|
66
|
+
- uses: actions/checkout@v4
|
|
67
|
+
- uses: ./.github/actions/setup
|
|
68
|
+
with:
|
|
69
|
+
python: ${{ matrix.python }}
|
|
70
|
+
- name: The newest release of every dependency, not uv.lock's
|
|
71
|
+
run: |
|
|
72
|
+
uv sync --upgrade --python "${{ matrix.python }}"
|
|
73
|
+
uv pip list
|
|
74
|
+
- run: uv run --no-sync pytest -q
|
|
75
|
+
|
|
76
|
+
canary:
|
|
77
|
+
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
|
78
|
+
continue-on-error: true
|
|
79
|
+
strategy:
|
|
80
|
+
fail-fast: false
|
|
81
|
+
matrix:
|
|
82
|
+
os: [ubuntu-latest, macos-15, windows-latest]
|
|
83
|
+
runs-on: ${{ matrix.os }}
|
|
84
|
+
name: Newest swmm-toolkit, past the pin, on ${{ matrix.os }}
|
|
85
|
+
steps:
|
|
86
|
+
- uses: actions/checkout@v4
|
|
87
|
+
- uses: ./.github/actions/setup
|
|
88
|
+
- name: The newest swmm-toolkit on PyPI
|
|
89
|
+
run: |
|
|
90
|
+
uv pip install --upgrade swmm-toolkit
|
|
91
|
+
uv run --no-sync python -c "import swmm.toolkit as t, swmm.toolkit.solver as s; print('swmm-toolkit', t.__version__, 'SWMM', s.swmm_version_info())"
|
|
92
|
+
- run: uv run --no-sync pytest -q
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 (2026-11-30)
|
|
4
|
+
|
|
5
|
+
First version.
|
|
6
|
+
|
|
7
|
+
- `SwmmBmi`: SWMM 5.2.4 (swmm-toolkit 0.17) under BMI 2.0, every value in SI.
|
|
8
|
+
- Rates and states for subcatchments, nodes, outfalls, storage units, gages and links.
|
|
9
|
+
- Volumes, three ways each (since the start, since a mark, over the last update): per subcatchment, node, outfall
|
|
10
|
+
and storage unit, and SWMM's runoff and routing continuity terms. Also `continuity()`.
|
|
11
|
+
- Outfall concentrations, mass flow rates and loads, per pollutant.
|
|
12
|
+
- Node inflow and gage rain as inputs.
|
|
13
|
+
- `update_until` lands exactly on a time.
|
|
14
|
+
- Subcatchment washoff loads per pollutant (`subcatchment_water_<pollutant>__washoff_mass`), undoing swmm-toolkit
|
|
15
|
+
0.17.0's double conversion of them.
|
|
16
|
+
- `last_update=False`, for stepping by `update()` as fast as SWMM alone.
|
|
17
|
+
- Models without links (no statistics in SWMM; the toolkit's calls for them crash) and without subcatchments run;
|
|
18
|
+
grids with no objects get no variables.
|
|
19
|
+
- Tested on seven public models (EPA's examples, pyswmm's test models) and a winter campus with snow, RDII, an LID,
|
|
20
|
+
a pump under a control rule and a count pollutant, as well as the campus in all six flow units.
|
|
21
|
+
- A tour with a figure (`examples/tour.py`), and a timing tool (`tools/time_large.py`).
|
|
22
|
+
- Tested on Linux, macOS and Windows in CI, with CSDMS's BMI conformance tests, and with the wheel installed on
|
|
23
|
+
its own; a nightly run on the newest dependencies and the newest swmm-toolkit.
|
|
24
|
+
- Notes on SWMM behaviour the wrapper accounts for, findings on groundwater hooks, and a design note for nesting
|
|
25
|
+
SWMM in Basin Ledger.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use epaswmm-bmi in your work, please cite it as below."
|
|
3
|
+
title: "epaswmm-bmi: EPA SWMM 5 through the Basic Model Interface, in SI units, with volumes a daily ledger can book"
|
|
4
|
+
type: software
|
|
5
|
+
authors:
|
|
6
|
+
- family-names: Sommerlot
|
|
7
|
+
given-names: Andrew
|
|
8
|
+
affiliation: Northline Hydrology
|
|
9
|
+
version: 0.1.0
|
|
10
|
+
date-released: 2026-11-30
|
|
11
|
+
license: BSD-3-Clause
|
|
12
|
+
repository-code: "https://github.com/northlinehydrology/epaswmm-bmi"
|
|
13
|
+
keywords:
|
|
14
|
+
- hydrology
|
|
15
|
+
- stormwater
|
|
16
|
+
- SWMM
|
|
17
|
+
- Basic Model Interface
|
|
18
|
+
- BMI
|
|
19
|
+
- model coupling
|
|
20
|
+
references:
|
|
21
|
+
- type: software
|
|
22
|
+
title: "Storm Water Management Model (SWMM)"
|
|
23
|
+
authors:
|
|
24
|
+
- name: "U.S. Environmental Protection Agency"
|
|
25
|
+
repository-code: "https://github.com/USEPA/Stormwater-Management-Model"
|
|
26
|
+
- type: article
|
|
27
|
+
title: "PySWMM: The Python Interface to Stormwater Management Model (SWMM)"
|
|
28
|
+
authors:
|
|
29
|
+
- family-names: McDonnell
|
|
30
|
+
given-names: Bryant E.
|
|
31
|
+
- name: "and others"
|
|
32
|
+
journal: "Journal of Open Source Software"
|
|
33
|
+
year: 2020
|
|
34
|
+
doi: 10.21105/joss.02292
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Code of conduct
|
|
2
|
+
|
|
3
|
+
This project follows the [Contributor Covenant, version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
|
|
4
|
+
|
|
5
|
+
In short: be respectful and constructive, assume good faith, and keep discussion about the
|
|
6
|
+
work. Harassment and personal attacks aren't tolerated in issues, pull requests or any other
|
|
7
|
+
project space.
|
|
8
|
+
|
|
9
|
+
Report a problem to the maintainer, Andrew Sommerlot, at andrew@northlinehydrology.com. Reports
|
|
10
|
+
are kept confidential. The maintainer will respond, and may warn, suspend or remove anyone who
|
|
11
|
+
doesn't follow this code, as the Contributor Covenant's enforcement guidelines describe.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# swmm-toolkit versions
|
|
2
|
+
|
|
3
|
+
epaswmm-bmi runs on [swmm-toolkit](https://github.com/pyswmm/swmm-python)'s solver API, as published on PyPI, with
|
|
4
|
+
no patch. The wrapper relies on exactly what each toolkit getter returns: which totals SWMM converts to the model's
|
|
5
|
+
units and which it hands over unconverted, which are volumes and which depths, and how SWMM integrates them
|
|
6
|
+
(`docs/swmm-notes.md`). Those are read from the toolkit's source for each version, so a version is supported only
|
|
7
|
+
when that reading has been done and the full suite passes on it. `pyproject.toml` pins the supported range.
|
|
8
|
+
|
|
9
|
+
| swmm-toolkit | SWMM | Solver | Status | Tested on |
|
|
10
|
+
|---|---|---|---|---|
|
|
11
|
+
| 0.17.0 | 5.2.4 | OWA `ebbce38` (Jan 21, 2026) | **Supported** | CI on every push: Ubuntu, macOS 15 (Apple silicon) and Windows, Python from uv.lock; nightly on Python 3.11 and 3.14 with the newest dependencies. Locally: macOS 14 arm64, Python 3.13 |
|
|
12
|
+
| newer | | | Watched: the newest release on PyPI is tested nightly past the pin, as an early warning. Not supported until read and added here | nightly canary |
|
|
13
|
+
| 0.16.x and earlier | 5.2.x | | Not supported: not read | — |
|
|
14
|
+
|
|
15
|
+
## Policy
|
|
16
|
+
|
|
17
|
+
- A new swmm-toolkit is added when its getters and totals have been read against the solver source it pins
|
|
18
|
+
(`toolkit.c`, `stats.c`, `massbal.c`, `swmm5.c`), `docs/swmm-notes.md` is updated for anything that changed, and
|
|
19
|
+
the full suite passes on all three platforms. Then the pin in `pyproject.toml` moves.
|
|
20
|
+
- Two bugs in swmm-toolkit 0.17.0 are worked around (docs/swmm-notes.md): subcatchment loads converted twice, and
|
|
21
|
+
statistics calls that crash in a model without links. A new toolkit is checked for both; if either is fixed, the
|
|
22
|
+
workaround changes with the pin.
|
|
23
|
+
- The nightly canary runs the newest toolkit on PyPI past the pin. When it fails, the next toolkit needs work here
|
|
24
|
+
before it is supported.
|
|
25
|
+
- EPA's own Python package, `epaswmm` (5.3.0.dev, PyPI), targets a different, newer SWMM API. It isn't supported;
|
|
26
|
+
`docs/groundwater-hooks.md` describes it.
|
|
27
|
+
|
|
28
|
+
## Platforms
|
|
29
|
+
|
|
30
|
+
swmm-toolkit 0.17.0 publishes abi3 wheels with SWMM inside for Linux (x86-64 and ARM, glibc and musl), macOS
|
|
31
|
+
(Apple silicon and Intel) and Windows (x86-64), for Python 3.9 and later. epaswmm-bmi needs Python 3.11 or later.
|
|
32
|
+
CI covers Linux x86-64, macOS on Apple silicon and Windows x86-64. On macOS, a new environment can refuse to load
|
|
33
|
+
the toolkit's libraries until they are signed ad hoc (README, Install).
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
epaswmm-bmi is a standalone BMI for EPA SWMM 5: any BMI framework or driver can use it. It was written so that a
|
|
4
|
+
SWMM site can be nested in a basin model and coupled through a daily ledger that must conserve, as
|
|
5
|
+
[Basin Ledger](https://github.com/northlinehydrology/basinledger) does. So the one promise it makes is: **every
|
|
6
|
+
volume and load it reports is SWMM's own total, in SI converted exactly, and they add up to SWMM's own balance.**
|
|
7
|
+
The rules below follow from that.
|
|
8
|
+
|
|
9
|
+
## Ways to contribute
|
|
10
|
+
|
|
11
|
+
- **Report a bug.** Open an issue with your swmm-toolkit version, platform and Python, what you ran and what
|
|
12
|
+
happened. A small `.inp` that shows it is the most useful thing to attach.
|
|
13
|
+
- **Share a test model.** The tests run on a synthetic campus in two seasons (`tests/models.py`) and seven public
|
|
14
|
+
models (`tests/data`). A real, public city or campus model, larger than these and with its own calibration, would
|
|
15
|
+
widen them most. Groundwater (`[GROUNDWATER]`) on more than one subcatchment, and evaporation from a file or
|
|
16
|
+
temperature series, aren't yet in any of them.
|
|
17
|
+
- **Ask for a variable.** Say what you want to read or set, which SWMM result or total holds it, and what you would
|
|
18
|
+
check it against.
|
|
19
|
+
- **Pull requests** are welcome for fixes, variables, tests and documentation. For a larger change (a new
|
|
20
|
+
swmm-toolkit, groundwater hooks), open an issue first.
|
|
21
|
+
|
|
22
|
+
## Rules for changes
|
|
23
|
+
|
|
24
|
+
1. **SWMM's numbers, not ours.** A volume is a difference of SWMM's own cumulative totals, never an integral of
|
|
25
|
+
rates the wrapper computes. A new volume or load is checked against SWMM's report or totals over a whole run and
|
|
26
|
+
summed day by day (`tests/test_balance.py`).
|
|
27
|
+
2. **Units in one place.** Every conversion goes through `units.py`: undo SWMM's own factor, then convert to SI
|
|
28
|
+
exactly. A new quantity gets a unit test in each of the six flow units (`tests/test_units.py`).
|
|
29
|
+
3. **Inputs reach SWMM exactly,** and what SWMM took can be read back as a volume. A new input gets a test that the
|
|
30
|
+
same water enters in every unit system.
|
|
31
|
+
4. **No patched SWMM in the package.** The wrapper runs on the swmm-toolkit wheel as published. Work that needs
|
|
32
|
+
SWMM changed (the groundwater hooks, `docs/groundwater-hooks.md`) is proposed upstream, or kept apart and
|
|
33
|
+
pinned, and said so.
|
|
34
|
+
5. **SWMM's behaviour is written down.** Anything SWMM does that a coupling has to know about (units, clocks,
|
|
35
|
+
integration, bugs) goes in `docs/swmm-notes.md` with the source line it comes from and a test where one can hold
|
|
36
|
+
it.
|
|
37
|
+
6. **Plain writing.** Documentation and comments say what the code does and why, plainly.
|
|
38
|
+
|
|
39
|
+
## Running the checks
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
uv sync
|
|
43
|
+
uv run pytest # a few seconds
|
|
44
|
+
uv run python tools/check_wheel.py # the wheel, installed alone, against the suite
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
CI runs the same on Linux, macOS and Windows (`.github/workflows/test.yml`).
|
|
48
|
+
|
|
49
|
+
## Releasing
|
|
50
|
+
|
|
51
|
+
A version bump is one change, made together:
|
|
52
|
+
|
|
53
|
+
1. `version` in `pyproject.toml` and `__version__` in `src/epaswmm_bmi/__init__.py`.
|
|
54
|
+
2. The README, checked against the code: the status line's version and test counts, the variables, the limits, the
|
|
55
|
+
install notes, and anything the release changed.
|
|
56
|
+
3. The changelog's section for the version, from "unreleased" to the date. It becomes the GitHub release's notes.
|
|
57
|
+
4. `CITATION.cff`'s version and date, and `COMPATIBILITY.md` if the supported swmm-toolkit changed.
|
|
58
|
+
|
|
59
|
+
`tests/test_release.py` fails if the versions in these files disagree. Then push a tag `v<version>`.
|
|
60
|
+
`.github/workflows/publish.yml` checks the tag against the version, tests on all three platforms, publishes to PyPI
|
|
61
|
+
by trusted publishing, and makes the GitHub release.
|
|
62
|
+
|
|
63
|
+
## Conduct
|
|
64
|
+
|
|
65
|
+
Everyone taking part follows the [code of conduct](CODE_OF_CONDUCT.md).
|
|
66
|
+
|
|
67
|
+
## License of contributions
|
|
68
|
+
|
|
69
|
+
Everything here is under the BSD 3-Clause license. By opening a pull request you agree to license your
|
|
70
|
+
contribution that way.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Andrew Sommerlot
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|