Skip to content

Commit faf72b8

Browse files
authored
Merge pull request #96 from OpenWaterAnalytics/release_version
v.0.9.0 release draft
2 parents 1d8e9a6 + ce9b1c2 commit faf72b8

23 files changed

+893
-389
lines changed

.github/workflows/python-package.yml

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,73 @@ env:
77

88

99
jobs:
10+
build_nrtest_plugin:
11+
name: Build nrtest-swmm plugin
12+
runs-on: ubuntu-latest
13+
defaults:
14+
run:
15+
working-directory: ./nrtest-swmm
16+
17+
steps:
18+
- name: Checkout repo
19+
uses: actions/checkout@v2
20+
with:
21+
submodules: true
22+
23+
- name: Install Python
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: 3.7
27+
28+
- name: Build wheel
29+
run: |
30+
pip install wheel
31+
python setup.py bdist_wheel
32+
- uses: actions/upload-artifact@v2
33+
with:
34+
path: nrtest-swmm/dist/*.whl
35+
36+
build_conda_wheels:
37+
name: Conda wheel test mac
38+
runs-on: macos-latest
39+
defaults:
40+
run:
41+
shell: bash -l {0}
42+
43+
steps:
44+
- name: Checkout repo
45+
uses: actions/checkout@v2
46+
with:
47+
submodules: true
48+
49+
- uses: conda-incubator/setup-miniconda@v2
50+
with:
51+
auto-update-conda: true
52+
channels: conda-forge
53+
python-version: 3.8
54+
55+
- name: Install required system packages
56+
run: brew install swig ninja
57+
58+
- name: Install requirements
59+
run: |
60+
cd swmm-toolkit
61+
conda activate test
62+
conda install --yes --file build-requirements.txt
63+
python setup.py bdist_wheel
64+
65+
- name: Test wheel
66+
run: |
67+
cd swmm-toolkit
68+
conda activate test
69+
conda install --yes --file test-requirements.txt
70+
python -m pip install --no-index --find-links=./dist swmm_toolkit --user
71+
pytest
72+
73+
1074
build_linux_wheels:
1175
name: Build wheels on linux
12-
runs-on: ubuntu-18.04
76+
runs-on: ubuntu-latest
1377

1478
steps:
1579
- name: Checkout repo
@@ -43,10 +107,10 @@ jobs:
43107
strategy:
44108
fail-fast: false
45109
matrix:
46-
os: [windows-2016, macos-10.15]
47-
py: [3.6, 3.7, 3.8, 3.9]
110+
os: [windows-2022, macos-10.15]
111+
py: ["3.7", "3.8", "3.9", "3.10"]
48112
include:
49-
- os: windows-2016
113+
- os: windows-2022
50114
sys_pkgs: choco install swig
51115
activate: ./build-env/Scripts/activate
52116

@@ -85,4 +149,4 @@ jobs:
85149
- name: Upload artifacts
86150
uses: actions/upload-artifact@v2
87151
with:
88-
path: swmm-toolkit/dist/*.whl
152+
path: swmm-toolkit/dist/*.whl

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[submodule "swmm-toolkit/swmm-solver"]
22
path = swmm-toolkit/swmm-solver
33
url = https://github.com/OpenWaterAnalytics/Stormwater-Management-Model.git
4-
branch = swig
4+
branch = master

nrtest-swmm/nrtest_swmm/output_reader.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from itertools import islice
1919

2020
# project import
21-
from swmm.toolkit import output, output_enum
21+
from swmm.toolkit import output, shared_enum
2222

2323

2424
def output_generator(path_ref):
@@ -40,7 +40,7 @@ def output_generator(path_ref):
4040
with OutputReader(path_ref) as reader:
4141

4242
for period_index in range(0, reader.report_periods()):
43-
for element_type in islice(output_enum.ElementType, 4):
43+
for element_type in islice(shared_enum.ElementType, 4):
4444
for element_index in range(0, reader.element_count(element_type)):
4545

4646
yield (reader.element_result(element_type, period_index, element_index),
@@ -57,10 +57,10 @@ def __init__(self, filename):
5757
self.handle = None
5858
self.count = None
5959
self.get_element_result = {
60-
output_enum.ElementType.SUBCATCH: output.get_subcatch_result,
61-
output_enum.ElementType.NODE: output.get_node_result,
62-
output_enum.ElementType.LINK: output.get_link_result,
63-
output_enum.ElementType.SYSTEM: output.get_system_result
60+
shared_enum.ElementType.SUBCATCH: output.get_subcatch_result,
61+
shared_enum.ElementType.NODE: output.get_node_result,
62+
shared_enum.ElementType.LINK: output.get_link_result,
63+
shared_enum.ElementType.SYSTEM: output.get_system_result
6464
}
6565

6666
def __enter__(self):
@@ -73,7 +73,7 @@ def __exit__(self, type, value, traceback):
7373
output.close(self.handle)
7474

7575
def report_periods(self):
76-
return output.get_times(self.handle, output_enum.Time.NUM_PERIODS)
76+
return output.get_times(self.handle, shared_enum.Time.NUM_PERIODS)
7777

7878
def element_count(self, element_type):
7979
return self.count[element_type]

swmm-toolkit/AUTHORS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Authors ordered by first contribution
22

33
Michael Tryby <[email protected]> (public domain)
4+
45
Jennifer Wu <[email protected]>
56
Caleb Buahin <[email protected]>
67
Laurent Courty <[email protected]>
8+
Constantine Karos <[email protected]>
9+
Abhiram Mullapudi <[email protected]>
10+
Brooke Mason <[email protected]>

swmm-toolkit/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ cmake_minimum_required (VERSION 3.17)
1515

1616
project(swmm-toolkit
1717
VERSION
18-
0.8.2
18+
0.9.0
1919
)
2020

2121

swmm-toolkit/README.md

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,27 @@
33
`swmm-toolkit` contains SWIG generated Python wrappers for the swmm-solver and swmm-output libraries.
44

55

6-
## Features
6+
## Build Status
77

8-
`swmm-toolkit` makes SWMM a fully fledged Python extension with:
9-
10-
- Python integration at the speed of C
11-
- Full access to library APIs
12-
- Pythonic naming, enums, exceptions, and return value handling
8+
![Build Wheels](https://github.com/SWMM-Project/swmm-python/workflows/Build%20Wheels/badge.svg)
139

1410

1511
## Installation
1612

13+
[![version](https://img.shields.io/pypi/v/swmm-toolkit.svg?maxAge=3600)](https://pypi.org/project/swmm-toolkit/) [![Downloads](https://pepy.tech/badge/swmm-toolkit)](https://pepy.tech/project/swmm-toolkit)
1714

18-
## Build
19-
1. Initialize submodule
20-
```cmd
21-
git submodule init
22-
git submodule update
23-
```
24-
2. Create virtual environment
25-
3. `pip install` from requirements.txt
26-
4. `python setup.py build`
27-
28-
## Troubleshoot
29-
30-
Steps to try if `python setup.py build` fails
15+
``pip install swmm-toolkit``
3116

32-
### Establish working swmm-solver build
33-
1. Create an environment variable `BOOST_ROOT_1_67_0` and set the variable to boost install location
34-
2. Confirm swmm-solver directory is initialized
35-
3. Confirm swmm-solver build is working
3617

37-
```
38-
cd swmm-solver
39-
mkdir buildprod
40-
cd buildprod
41-
cmake -G "Visual Studio 14 2015 Win64" ..
42-
cmake --build . --config Release --target install
43-
```
18+
## Features
4419

20+
`swmm-toolkit` makes SWMM a fully fledged Python extension with:
21+
- Compatibility with USEPA SWMM
22+
- Python integration at the speed of C
23+
- Full access to library APIs
24+
- Pythonic naming, enums, exceptions, and return value handling
25+
26+
4527
## Basic Usage
4628

4729
Run a SWMM simulation.

swmm-toolkit/build-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
setuptools==41.4.0
55
wheel==0.33.6
66
scikit-build==0.11.1
7-
cmake==3.18.4
7+
cmake==3.21

swmm-toolkit/setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def run(self):
6565

6666
# Set Platform specific cmake args here
6767
if platform_system == "Windows":
68-
cmake_args = ["-GVisual Studio 15 2017 Win64"]
68+
cmake_args = ["-GVisual Studio 17 2022","-Ax64"]
6969

7070
elif platform_system == "Darwin":
7171
cmake_args = ["-GNinja","-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.9"]
@@ -88,7 +88,7 @@ def exclude_files(cmake_manifest):
8888

8989
setup(
9090
name = "swmm-toolkit",
91-
version = "0.8.2",
91+
version = "0.9.0",
9292

9393
packages = ["swmm_toolkit", "swmm.toolkit"],
9494
package_dir = package_dir,
@@ -109,18 +109,18 @@ def exclude_files(cmake_manifest):
109109
maintainer_email='[email protected]',
110110
license='CC0',
111111

112-
keywords="swmm5, swmm, stormwater, hydraulics, hydrology, ",
112+
keywords="swmm5, swmm, stormwater, hydraulics, hydrology",
113113
classifiers=[
114114
"Topic :: Scientific/Engineering",
115115
"Operating System :: Microsoft :: Windows",
116116
"Operating System :: POSIX :: Linux",
117117
"Operating System :: MacOS",
118118
"License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
119-
"Programming Language :: Python :: 3.6",
120119
"Programming Language :: Python :: 3.7",
121120
"Programming Language :: Python :: 3.8",
122121
"Programming Language :: Python :: 3.9",
122+
"Programming Language :: Python :: 3.10",
123123
"Programming Language :: C",
124-
"Development Status :: 4 - Beta",
124+
"Development Status :: 5 - Production/Stable",
125125
]
126126
)

swmm-toolkit/src/swmm/toolkit/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ target_link_libraries(solver
139139
set_target_properties(solver
140140
PROPERTIES
141141
SUFFIX ${PYTHON_SUFFIX}
142+
SWIG_COMPILE_DEFINITIONS EXPORT_TOOLKIT
142143
MACOSX_RPATH TRUE
143144
SKIP_BUILD_RPATH FALSE
144145
BUILD_WITH_INSTALL_RPATH FALSE

swmm-toolkit/src/swmm/toolkit/__init__.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
# __init__.py - SWMM toolkit package
55
#
66
# Created: Aug 9, 2018
7-
# Updated: May 19, 2021
7+
# Updated: July 2, 2022
88
#
99
# Author: See AUTHORS
1010
#
1111

12-
'''
12+
"""
1313
A low level pythonic API for the swmm-output and swmm-solver dlls using SWIG.
14-
'''
14+
"""
1515

1616

1717
__author__ = "See AUTHORS"
1818
__copyright__ = "None"
1919
__credits__ = "Colleen Barr, Sam Hatchett"
2020
__license__ = "CC0 1.0 Universal"
2121

22-
__version__ = "0.8.2"
22+
__version__ = "0.9.0"
2323
__date__ = "June 7, 2021"
2424

2525
__maintainer__ = "Michael Tryby"
@@ -29,13 +29,17 @@
2929

3030
import os
3131
import platform
32+
import sys
3233

3334

3435
# Adds directory containing swmm libraries to path
3536
if platform.system() == "Windows":
3637
libdir = os.path.join(os.path.dirname(__file__), "../../swmm_toolkit")
3738

3839
if hasattr(os, 'add_dll_directory'):
40+
conda_exists = os.path.exists(os.path.join(sys.prefix, 'conda-meta'))
41+
if conda_exists:
42+
os.environ['CONDA_DLL_SEARCH_MODIFICATION_ENABLE'] = "1"
3943
os.add_dll_directory(libdir)
4044
else:
4145
os.environ["PATH"] = libdir + ";" + os.environ["PATH"]

0 commit comments

Comments
 (0)