openswmm 5.3.0.dev0__py3-none-any.whl

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.
@@ -0,0 +1,31 @@
1
+ # Description: CMake configuration for openswmmcore python library
2
+ # Created by: Caleb Buahin (EPA/ORD/CESER/WID)
3
+ # Created on: 2024-11-19
4
+
5
+ # Add Cython targets for openswmmcore
6
+ add_cython_target(_openswmm _openswmm.pyx CXX PY3)
7
+
8
+ # Create Python extension modules
9
+ add_library(_openswmm MODULE ${_openswmm})
10
+
11
+ set_target_properties(_openswmm
12
+ PROPERTIES
13
+ VERSION ${LIBRARY_VERSION}
14
+ SOVERSION ${LIBRARY_SOVERSION}
15
+ )
16
+
17
+ python_extension_module(_openswmm)
18
+
19
+ # Install the openswmmcore module
20
+ install(TARGETS _openswmm LIBRARY DESTINATION openswmm)
21
+
22
+ # Include the current source directory
23
+ target_include_directories(
24
+ _openswmm
25
+ PUBLIC
26
+ ${CMAKE_CURRENT_SOURCE_DIR}
27
+ )
28
+
29
+ # Add subdirectories
30
+ add_subdirectory(solver)
31
+ add_subdirectory(output)
openswmm/__init__.py ADDED
@@ -0,0 +1,42 @@
1
+ """
2
+ openswmm Python API
3
+
4
+ This module provides a Python interface to the openswmm library.
5
+ """
6
+ import os
7
+ import platform
8
+ import sys
9
+ import importlib.metadata
10
+
11
+ # Platform-specific DLL/library path configuration
12
+ if platform.system() == "Windows":
13
+ lib_dir = os.path.join(sys.prefix, "bin")
14
+ if hasattr(os, "add_dll_directory"):
15
+ conda_exists = os.path.exists(os.path.join(sys.prefix, "conda-meta"))
16
+ if conda_exists:
17
+ os.environ["CONDA_DLL_SEARCH_MODIFICATION_ENABLE"] = "1"
18
+ os.add_dll_directory(lib_dir)
19
+ else:
20
+ os.environ["PATH"] = lib_dir + ";" + os.environ["PATH"]
21
+
22
+ elif platform.system() == "Linux":
23
+ lib_dir = os.path.join(sys.prefix, "lib")
24
+ sys.path.append(lib_dir)
25
+ os.environ["LD_LIBRARY_PATH"] = lib_dir + ":" + os.environ.get("LD_LIBRARY_PATH", "")
26
+
27
+ elif platform.system() == "Darwin": # macOS
28
+ lib_dir = os.path.join(sys.prefix, "lib")
29
+ sys.path.append(lib_dir)
30
+ os.environ["DYLD_LIBRARY_PATH"] = lib_dir + ":" + os.environ.get("DYLD_LIBRARY_PATH", "")
31
+
32
+ lib_dir = os.path.join(sys.prefix, "bin")
33
+ os.environ["DYLD_LIBRARY_PATH"] = lib_dir + ":" + os.environ.get("DYLD_LIBRARY_PATH", "")
34
+
35
+ # Get version from package metadata
36
+ __version__ = importlib.metadata.version('openswmm')
37
+
38
+ # Import submodules
39
+ from openswmm.solver import *
40
+ from openswmm.output import *
41
+
42
+ __all__ = ['__version__']
openswmm/_openswmm.pyx ADDED
@@ -0,0 +1,12 @@
1
+ # cython: language_level=3str
2
+ # Description: Cython module for encoding and decoding SWMM datetimes
3
+ # Created by: Caleb Buahin (EPA/ORD/CESER/WID)
4
+ # Created on: 2024-11-19
5
+
6
+ # python imports
7
+
8
+ # third-party imports
9
+
10
+ # project imports
11
+ from openswmm cimport openswmm
12
+
File without changes
File without changes
openswmm/openswmm.pxd ADDED
@@ -0,0 +1,10 @@
1
+ # Description: Cython module for encoding and decoding SWMM datetimes
2
+ # Created by: Caleb Buahin (EPA/ORD/CESER/WID)
3
+ # Created on: 2024-11-19
4
+
5
+ # cython: language_level=3
6
+ # python imports
7
+
8
+ # third-party imports
9
+
10
+ # project imports
@@ -0,0 +1,45 @@
1
+ # CMake configuration for openswmmcore python library
2
+ #
3
+ # Created by: Caleb Buahin (EPA/ORD/CESER/WID)
4
+ # Created on: 2024-11-19
5
+
6
+ add_cython_target(_output _output.pyx LANGUAGE CXX PY3)
7
+
8
+ # Add Cython target
9
+ add_library(_output MODULE ${_output})
10
+
11
+ # Add library
12
+ target_link_libraries(
13
+ _output
14
+ OpenSWMMCore::openswmmcore
15
+ OpenSWMMCore::openswmmcore_output
16
+ )
17
+
18
+ # Specify that this is a Python extension module
19
+ python_extension_module(_output)
20
+
21
+ if(APPLE)
22
+ set(INSTALL_LIB_ROOT "@loader_path;@rpath;@loader_path/../../../..;${OUTFILE_BUILD_DIR}")
23
+ set(BUILD_LIB_ROOT "@loader_path;@rpath;${OUTFILE_BUILD_DIR}")
24
+ elseif(UNIX)
25
+ set(INSTALL_LIB_ROOT "$ORIGIN;$ORIGIN/../../../..;${OUTFILE_BUILD_DIR}")
26
+ set(BUILD_LIB_ROOT "$ORIGIN;${OUTFILE_BUILD_DIR}")
27
+ endif()
28
+
29
+ # Set up rpath for runswmm inside install package
30
+ set_target_properties(_output
31
+ PROPERTIES
32
+ BUILD_RPATH "${BUILD_LIB_ROOT}"
33
+ INSTALL_RPATH "${INSTALL_LIB_ROOT}"
34
+ BUILD_WITH_INSTALL_RPATH True
35
+ )
36
+
37
+ # Install the target
38
+ install(TARGETS _output LIBRARY DESTINATION openswmm/output)
39
+
40
+ # Include directories
41
+ target_include_directories(
42
+ _output
43
+ PUBLIC
44
+ ${CMAKE_CURRENT_SOURCE_DIR}
45
+ )
@@ -0,0 +1 @@
1
+ from .output cimport *
@@ -0,0 +1,13 @@
1
+ from ._output import (
2
+ UnitSystem,
3
+ FlowUnits,
4
+ ConcentrationUnits,
5
+ ElementType,
6
+ TimeAttribute,
7
+ SubcatchAttribute,
8
+ NodeAttribute,
9
+ LinkAttribute,
10
+ SystemAttribute,
11
+ SWMMOutputException,
12
+ Output,
13
+ )