Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/record_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ else

GIT_AUTHOR_NAME="github-actions[bot]" GIT_AUTHOR_EMAIL="41898282+github-actions[bot]@users.noreply.github.com" \
GIT_COMMITTER_NAME="github-actions[bot]" GIT_COMMITTER_EMAIL="41898282+github-actions[bot]@users.noreply.github.com" \
git -c commit.gpgSign=false commit -m "Release pysvzerod $RELEASE_VERSION"
git -c commit.gpgSign=false commit -m "Release svzerod $RELEASE_VERSION"
commit_sha=$(git rev-parse HEAD)
git tag "$tag" "$commit_sha"
if ! git push --atomic origin "HEAD:refs/heads/$DEFAULT_BRANCH" "refs/tags/$tag"; then
Expand Down
12 changes: 6 additions & 6 deletions .github/scripts/release_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

VERSION = re.compile(r"(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)")
INDEX_URLS = {
"pypi": "https://pypi.org/pypi/pysvzerod/{version}/json",
"testpypi": "https://test.pypi.org/pypi/pysvzerod/{version}/json",
"pypi": "https://pypi.org/pypi/svzerod/{version}/json",
"testpypi": "https://test.pypi.org/pypi/svzerod/{version}/json",
}


Expand Down Expand Up @@ -84,7 +84,7 @@ def set_version(path, version, expected_current):

def check_metadata(content, version, filename):
metadata = BytesParser().parsebytes(content)
for field, expected in (("Name", "pysvzerod"), ("Version", version)):
for field, expected in (("Name", "svzerod"), ("Version", version)):
if metadata.get_all(field, []) != [expected]:
raise ValueError(f"{filename}: expected exactly one {field}: {expected}")

Expand All @@ -93,7 +93,7 @@ def inspect_distributions(dist, version):
parse_version(version)
paths = sorted(Path(dist).iterdir())
kinds = set()
prefix = f"pysvzerod-{version}"
prefix = f"svzerod-{version}"
wheel_pattern = re.compile(
re.escape(prefix) + r"-(?:[0-9][A-Za-z0-9_.]*-)?[A-Za-z0-9_.]+-[A-Za-z0-9_.]+-[A-Za-z0-9_.]+\.whl"
)
Expand Down Expand Up @@ -223,13 +223,13 @@ def main():
print(args.version)
elif args.command == "verify-dist":
paths = inspect_distributions(args.dist, args.version)
print(f"Verified {len(paths)} distributions for pysvzerod {args.version}")
print(f"Verified {len(paths)} distributions for svzerod {args.version}")
elif args.command == "check-index":
check_index(args.index, args.dist, args.version)
print(f"Existing {args.index} files match the candidate distributions")
else:
verify_index(args.index, args.dist, args.version, args.attempts, args.delay)
print(f"Verified all distributions on {args.index} for pysvzerod {args.version}")
print(f"Verified all distributions on {args.index} for svzerod {args.version}")
except (OSError, ValueError, tarfile.TarError, zipfile.BadZipFile) as error:
parser.exit(1, f"Error: {error}\n")

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
enable-cache: true

- name: Install Flask dependencies
# The GUI only needs Flask, not the compiled pysvzerod extension.
# The GUI only needs Flask, not the compiled svzerod extension.
run: uv sync --no-install-project --no-default-groups --group gui

- name: Start Flask Application
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ on:
- pyproject.toml
- MANIFEST.in
- CMakeLists.txt
- applications/pysvzerod.cpp
- applications/svzerod.cpp

permissions:
contents: read
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
- name: Build and verify source distribution
run: |
uv build --sdist
uv build --wheel dist/pysvzerod-*.tar.gz --out-dir /tmp/sdist-wheel
uv build --wheel dist/svzerod-*.tar.gz --out-dir /tmp/sdist-wheel
uvx twine check --strict dist/*.tar.gz
- uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -374,7 +374,7 @@ jobs:
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.prepare_release.outputs.release_version }}
name: pysvzerod ${{ needs.prepare_release.outputs.release_version }}
name: svzerod ${{ needs.prepare_release.outputs.release_version }}
target_commitish: ${{ steps.record.outputs.commit_sha }}
generate_release_notes: ${{ steps.release.outputs.exists != 'true' }}
overwrite_files: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_visualization.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

- name: Install dependencies
# The dirgraph test only needs the Python dev tooling, not the compiled
# pysvzerod extension, so skip building the project.
# svzerod extension, so skip building the project.
run: uv sync --no-install-project --no-default-groups --group dev

- name: Install Graphviz
Expand Down
46 changes: 23 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,16 @@ add_executable(svzerodcalibrator applications/svzerodcalibrator.cpp
)

# -----------------------------------------------------------------------------
# Setup building of the pysvzerod Python extension module.
# Setup building of the svzerod Python extension module.
# -----------------------------------------------------------------------------
# Replace EXCLUDE_FROM_ALL with SHARED to test building the Python
# shared library.

pybind11_add_module(pysvzerod applications/pysvzerod.cpp)
set(PYSVZEROD_VERSION "dev" CACHE STRING "Python package version")
target_compile_definitions(pysvzerod PRIVATE PYSVZEROD_VERSION="${PYSVZEROD_VERSION}")
pybind11_add_module(svzerod applications/svzerod.cpp)
set(SVZEROD_VERSION "dev" CACHE STRING "Python package version")
target_compile_definitions(svzerod PRIVATE SVZEROD_VERSION="${SVZEROD_VERSION}")
if(WIN32 AND "${CMAKE_GENERATOR}" STREQUAL "MinGW Makefiles")
message(STATUS ">> Applying static‑link flags to pysvzerod")
message(STATUS ">> Applying static‑link flags to svzerod")

include(CheckCXXCompilerFlag)
set(_static_flags
Expand All @@ -199,20 +199,20 @@ if(WIN32 AND "${CMAKE_GENERATOR}" STREQUAL "MinGW Makefiles")
list(APPEND _static_flags -static-libwinpthread)
else()
find_package(Threads REQUIRED)
target_link_libraries(pysvzerod PRIVATE Threads::Threads)
target_link_libraries(svzerod PRIVATE Threads::Threads)
endif()
# apply to compile *and* link
foreach(_f IN LISTS _static_flags)
target_compile_options(pysvzerod PRIVATE ${_f})
target_compile_options(svzerod PRIVATE ${_f})
# CMake ≥3.13:
target_link_options (pysvzerod PRIVATE ${_f})
target_link_options (svzerod PRIVATE ${_f})
endforeach()

# verify in the configure log for static compilation:
get_target_property(_ccopts pysvzerod COMPILE_OPTIONS)
message(STATUS ">>> pysvzerod COMPILE_OPTIONS = ${_ccopts}")
get_target_property(_lnkopts pysvzerod LINK_OPTIONS)
message(STATUS ">>> pysvzerod LINK_OPTIONS = ${_lnkopts}")
get_target_property(_ccopts svzerod COMPILE_OPTIONS)
message(STATUS ">>> svzerod COMPILE_OPTIONS = ${_ccopts}")
get_target_property(_lnkopts svzerod LINK_OPTIONS)
message(STATUS ">>> svzerod LINK_OPTIONS = ${_lnkopts}")
endif()

# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -241,7 +241,7 @@ target_include_directories(svzerodcalibrator PUBLIC
${CMAKE_SOURCE_DIR}/src/solve
)

target_include_directories(pysvzerod PUBLIC
target_include_directories(svzerod PUBLIC
${CMAKE_SOURCE_DIR}/src/algebra
${CMAKE_SOURCE_DIR}/src/model
${CMAKE_SOURCE_DIR}/src/optimize
Expand All @@ -259,13 +259,13 @@ target_link_libraries(svzerodsolver PRIVATE nlohmann_json::nlohmann_json)
target_link_libraries(svzerodcalibrator PRIVATE Eigen3::Eigen)
target_link_libraries(svzerodcalibrator PRIVATE nlohmann_json::nlohmann_json)

target_link_libraries(pysvzerod PRIVATE Eigen3::Eigen)
target_link_libraries(pysvzerod PRIVATE nlohmann_json::nlohmann_json)
target_link_libraries(pysvzerod PRIVATE pybind11_json)
target_link_libraries(pysvzerod PRIVATE svzero_algebra_library)
target_link_libraries(pysvzerod PRIVATE svzero_model_library)
target_link_libraries(pysvzerod PRIVATE svzero_optimize_library)
target_link_libraries(pysvzerod PRIVATE svzero_solve_library)
target_link_libraries(svzerod PRIVATE Eigen3::Eigen)
target_link_libraries(svzerod PRIVATE nlohmann_json::nlohmann_json)
target_link_libraries(svzerod PRIVATE pybind11_json)
target_link_libraries(svzerod PRIVATE svzero_algebra_library)
target_link_libraries(svzerod PRIVATE svzero_model_library)
target_link_libraries(svzerod PRIVATE svzero_optimize_library)
target_link_libraries(svzerod PRIVATE svzero_solve_library)


# Create distribution
Expand All @@ -289,20 +289,20 @@ add_custom_target(codecheck
COMMAND npm run check
COMMAND find ${SDIR}/*.h ${SDIR}/*.cpp | xargs clang-format -style=file:${PROJECT_SOURCE_DIR}/.clang-format --dry-run --Werror)

set_target_properties(pysvzerod PROPERTIES
set_target_properties(svzerod PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/python
)

# standard install target locations
install(TARGETS pysvzerod
install(TARGETS svzerod
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)

# append correct suffix for windows python runtime files
if (WIN32)
set_target_properties(pysvzerod PROPERTIES
set_target_properties(svzerod PROPERTIES
PREFIX ""
SUFFIX ".pyd"
)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ You can find more information under the following links:
Install the Python bindings from PyPI with:

```sh
python -m pip install pysvzerod
python -m pip install svzerod
```

Use `pysvzerod.simulate("model.json")` to run a model from Python. The package
Use `svzerod.simulate("model.json")` to run a model from Python. The package
also installs the `svzerodsolver` and `svzerodcalibrator` commands.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import sys
import numpy as np
import pandas as pd
import pysvzerod
import svzerod

# Add src to path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../..'))
Expand Down Expand Up @@ -51,7 +51,7 @@ def run_baseline(config_file):

# Run baseline simulation
try:
solver = pysvzerod.Solver(config_file)
solver = svzerod.Solver(config_file)
solver.run()
print("✓ Simulation completed successfully\n")
except Exception as e:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module load cmake
# Relative paths (submit from this directory)
VENV_DIR="../../venv"
REQUIREMENTS="../../requirements.txt"
SVZEROD_ROOT="../../../.." # svZeroDSolver repo root (for pip install -e pysvzerod)
SVZEROD_ROOT="../../../.." # svZeroDSolver repo root (for pip install -e svzerod)

# Check if virtual environment exists and has Python; if not, create and install
if [[ ! -f "$VENV_DIR/bin/python" ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import sys
import numpy as np
import pandas as pd
import pysvzerod
import svzerod

# Add src to path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../..'))
Expand Down Expand Up @@ -51,7 +51,7 @@ def run_baseline(config_file):

# Run baseline simulation
try:
solver = pysvzerod.Solver(config_file)
solver = svzerod.Solver(config_file)
solver.run()
print("✓ Simulation completed successfully\n")
except Exception as e:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module load cmake
# Relative paths (submit from this directory)
VENV_DIR="../../venv"
REQUIREMENTS="../../requirements.txt"
SVZEROD_ROOT="../../../.." # svZeroDSolver repo root (for pip install -e pysvzerod)
SVZEROD_ROOT="../../../.." # svZeroDSolver repo root (for pip install -e svzerod)

# Check if virtual environment exists and has Python; if not, create and install
if [[ ! -f "$VENV_DIR/bin/python" ]]; then
Expand Down
4 changes: 2 additions & 2 deletions applications/svZeroDTuner/examples/right_heart_pa/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import sys
import numpy as np
import pandas as pd
import pysvzerod
import svzerod

# Add src to path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../..'))
Expand All @@ -42,7 +42,7 @@ def run_baseline(config_file):
print()

try:
solver = pysvzerod.Solver(config_file)
solver = svzerod.Solver(config_file)
solver.run()
print("\u2713 Simulation completed successfully\n")
except Exception as e:
Expand Down
4 changes: 2 additions & 2 deletions applications/svZeroDTuner/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ pandas>=1.3.0
pyyaml>=6.0
matplotlib>=3.5.0

# pysvzerod is a requirement, but it is not available on PyPI, so we need to
#install it from source using "pip install -e ." from the svZeroDSolver repo root
# svzerod is also required. Install it from PyPI with "pip install svzerod",
# or from source using "pip install -e ." from the svZeroDSolver repo root.
6 changes: 3 additions & 3 deletions applications/svZeroDTuner/svzerodtuner/output_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import numpy as np
import pandas as pd
from typing import Union, Literal, Optional
import pysvzerod
import svzerod


class OutputExtractor:
Expand All @@ -19,12 +19,12 @@ class OutputExtractor:
Supports extraction of time series or scalar metrics (min, max, mean).
"""

def __init__(self, solver: pysvzerod.Solver):
def __init__(self, solver: svzerod.Solver):
"""
Initialize output extractor with a solver instance.

Args:
solver: pysvzerod.Solver instance (must have run() called)
solver: svzerod.Solver instance (must have run() called)
"""
self.solver = solver
self._result_df = None
Expand Down
6 changes: 3 additions & 3 deletions applications/svZeroDTuner/svzerodtuner/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"""

import numpy as np
import pysvzerod
import svzerod
from typing import List, Dict, Any, Tuple

from .parameter_handler import ParameterHandler
Expand All @@ -17,7 +17,7 @@ def run_simulation(
param_handler: ParameterHandler,
parameters: List[Dict[str, Any]],
param_values: np.ndarray,
) -> Tuple[pysvzerod.Solver, OutputExtractor]:
) -> Tuple[svzerod.Solver, OutputExtractor]:
"""
Run sv0D simulation with given parameter values.

Expand All @@ -42,7 +42,7 @@ def run_simulation(
param_handler.set_parameter(name, value)

config_dict = param_handler.get_config()
solver = pysvzerod.Solver(config_dict)
solver = svzerod.Solver(config_dict)
solver.run()
extractor = OutputExtractor(solver)
return solver, extractor
2 changes: 1 addition & 1 deletion applications/svZeroDTuner/svzerodtuner/sv0d_tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def __init__(self, config_file: str):
def __getstate__(self):
"""
Make tuner pickle-safe for multiprocessing objective dispatch.
`pysvzerod.Solver`/extractor instances are runtime-only and not pickleable.
`svzerod.Solver`/extractor instances are runtime-only and not pickleable.
"""
state = self.__dict__.copy()
state["solver"] = None
Expand Down
4 changes: 2 additions & 2 deletions applications/svZeroDVisualization/visualize_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import sys
import argparse
import pysvzerod
import svzerod
import pandas as pd
import matplotlib.pyplot as plt
import networkx as nx
Expand All @@ -27,7 +27,7 @@
'''

def dirgraph(filepath, output_dir, export_csv):
solver = pysvzerod.Solver(filepath)
solver = svzerod.Solver(filepath)
solver.run()
results = pd.DataFrame(solver.get_full_result())

Expand Down
6 changes: 3 additions & 3 deletions applications/pysvzerod.cpp → applications/svzerod.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: Copyright (c) Stanford University, The Regents of the
// University of California, and others. SPDX-License-Identifier: BSD-3-Clause
/**
* @file pysvzerod.cpp
* @file svzerod.cpp
* @brief Python interface for svZeroDSolver
*/
#include <pybind11/eigen.h>
Expand All @@ -15,8 +15,8 @@

namespace py = pybind11;

PYBIND11_MODULE(pysvzerod, m) {
m.attr("__version__") = PYSVZEROD_VERSION;
PYBIND11_MODULE(svzerod, m) {
m.attr("__version__") = SVZEROD_VERSION;
using Solver = Solver;
py::class_<Solver>(m, "Solver")
.def(py::init([](py::dict& config) {
Expand Down
Loading
Loading