diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8078c4aac..fb528891aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,8 +92,8 @@ jobs: fi # Check for changes to trigger documentation build checks - # Updates in doc, bindings/sundials4py, or tools directories - if echo "$CHANGED" | grep -qE '^(doc/|bindings/sundials4py/|tools/)'; then + # Updates in doc, bindings/sundials4py, or suntools directories + if echo "$CHANGED" | grep -qE '^(doc/|bindings/sundials4py/|suntools/)'; then echo "docs=true" >> "$GITHUB_OUTPUT" else echo "docs=false" >> "$GITHUB_OUTPUT" diff --git a/.gitignore b/.gitignore index 86211661fd..3a14244cc3 100644 --- a/.gitignore +++ b/.gitignore @@ -85,9 +85,6 @@ uberenv_libs # swig /swig/swig -# tools -/tools/suntools/__pycache__ - # python .pytest_cache __pycache__ diff --git a/doc/arkode/examples/source/conf.py b/doc/arkode/examples/source/conf.py index 74824d3cc5..7f45bbd6f1 100644 --- a/doc/arkode/examples/source/conf.py +++ b/doc/arkode/examples/source/conf.py @@ -20,8 +20,8 @@ sys.path.append(os.path.dirname(os.path.abspath("../../../shared"))) -# Add suntools directory to import python function docstings with autodoc -sys.path.append(os.path.abspath("../../../../tools/suntools")) +# Add the suntools package source parent for autodoc imports. +sys.path.append(os.path.abspath("../../../../suntools/src/suntools")) # -- General configuration ----------------------------------------------------- diff --git a/doc/arkode/guide/source/Usage/ARKStep/User_callable.rst b/doc/arkode/guide/source/Usage/ARKStep/User_callable.rst index 55dcd59817..ac3bea859a 100644 --- a/doc/arkode/guide/source/Usage/ARKStep/User_callable.rst +++ b/doc/arkode/guide/source/Usage/ARKStep/User_callable.rst @@ -3095,7 +3095,7 @@ Main solver optional output functions .. note:: - The Python module ``tools/suntools`` provides utilities to read and output + The Python package ``suntools`` provides utilities to read and output the data from a SUNDIALS CSV output file using the key and value pair format. diff --git a/doc/arkode/guide/source/Usage/ERKStep/User_callable.rst b/doc/arkode/guide/source/Usage/ERKStep/User_callable.rst index a80ca7882e..952a7485d1 100644 --- a/doc/arkode/guide/source/Usage/ERKStep/User_callable.rst +++ b/doc/arkode/guide/source/Usage/ERKStep/User_callable.rst @@ -1668,7 +1668,7 @@ Main solver optional output functions .. note:: - The Python module ``tools/suntools`` provides utilities to read and output + The Python package ``suntools`` provides utilities to read and output the data from a SUNDIALS CSV output file using the key and value pair format. diff --git a/doc/arkode/guide/source/Usage/MRIStep/User_callable.rst b/doc/arkode/guide/source/Usage/MRIStep/User_callable.rst index 4fc4f40397..8d28cb7551 100644 --- a/doc/arkode/guide/source/Usage/MRIStep/User_callable.rst +++ b/doc/arkode/guide/source/Usage/MRIStep/User_callable.rst @@ -1732,7 +1732,7 @@ Main solver optional output functions .. note:: - The Python module ``tools/suntools`` provides utilities to read and output + The Python package ``suntools`` provides utilities to read and output the data from a SUNDIALS CSV output file using the key and value pair format. diff --git a/doc/arkode/guide/source/Usage/SPRKStep/User_callable.rst b/doc/arkode/guide/source/Usage/SPRKStep/User_callable.rst index 85b327c893..cf0d132058 100644 --- a/doc/arkode/guide/source/Usage/SPRKStep/User_callable.rst +++ b/doc/arkode/guide/source/Usage/SPRKStep/User_callable.rst @@ -749,7 +749,7 @@ Main solver optional output functions .. note:: - The Python module ``tools/suntools`` provides utilities to read and output + The Python package ``suntools`` provides utilities to read and output the data from a SUNDIALS CSV output file using the key and value pair format. diff --git a/doc/arkode/guide/source/Usage/User_callable.rst b/doc/arkode/guide/source/Usage/User_callable.rst index 4854e5c0db..1db23a1404 100644 --- a/doc/arkode/guide/source/Usage/User_callable.rst +++ b/doc/arkode/guide/source/Usage/User_callable.rst @@ -4275,7 +4275,7 @@ Current stage index, and total number of stages :c:func:`ARKodeGetStageIn .. note:: - The Python module ``tools/suntools`` provides utilities to read and output + The Python package ``suntools`` provides utilities to read and output the data from a SUNDIALS CSV output file using the key and value pair format. diff --git a/doc/arkode/guide/source/conf.py b/doc/arkode/guide/source/conf.py index d9e6ed5e75..e791ffe169 100644 --- a/doc/arkode/guide/source/conf.py +++ b/doc/arkode/guide/source/conf.py @@ -20,8 +20,8 @@ sys.path.append(os.path.dirname(os.path.abspath("../../../shared"))) -# Add suntools directory to import python function docstrings with autodoc -sys.path.append(os.path.abspath("../../../../tools/suntools")) +# Add the suntools package source parent for autodoc imports. +sys.path.append(os.path.abspath("../../../../suntools/src/suntools")) # -- General configuration ---------------------------------------------------- diff --git a/doc/cvode/examples/source/conf.py b/doc/cvode/examples/source/conf.py index 0197a87648..2e875d0f1d 100644 --- a/doc/cvode/examples/source/conf.py +++ b/doc/cvode/examples/source/conf.py @@ -20,8 +20,8 @@ sys.path.append(os.path.dirname(os.path.abspath("../../../shared"))) -# Add suntools directory to import python function docstings with autodoc -sys.path.append(os.path.abspath("../../../../tools/suntools")) +# Add the suntools package source parent for autodoc imports. +sys.path.append(os.path.abspath("../../../../suntools/src/suntools")) # -- General configuration ----------------------------------------------------- diff --git a/doc/cvode/guide/source/Usage/index.rst b/doc/cvode/guide/source/Usage/index.rst index 2929ab59c4..dfc8150101 100644 --- a/doc/cvode/guide/source/Usage/index.rst +++ b/doc/cvode/guide/source/Usage/index.rst @@ -3026,7 +3026,7 @@ described next. .. note:: - The Python module ``tools/suntools`` provides utilities to read and output + The Python package ``suntools`` provides utilities to read and output the data from a SUNDIALS CSV output file using the key and value pair format. diff --git a/doc/cvode/guide/source/conf.py b/doc/cvode/guide/source/conf.py index 94f7190510..ceaf0b636e 100644 --- a/doc/cvode/guide/source/conf.py +++ b/doc/cvode/guide/source/conf.py @@ -20,8 +20,8 @@ sys.path.append(os.path.dirname(os.path.abspath("../../../shared"))) -# Add suntools directory to import python function docstings with autodoc -sys.path.append(os.path.abspath("../../../../tools/suntools")) +# Add the suntools package source parent for autodoc imports. +sys.path.append(os.path.abspath("../../../../suntools/src/suntools")) # -- General configuration ---------------------------------------------------- diff --git a/doc/cvodes/examples/source/conf.py b/doc/cvodes/examples/source/conf.py index 0efd4e305b..0732520edd 100644 --- a/doc/cvodes/examples/source/conf.py +++ b/doc/cvodes/examples/source/conf.py @@ -20,8 +20,8 @@ sys.path.append(os.path.dirname(os.path.abspath("../../../shared"))) -# Add suntools directory to import python function docstings with autodoc -sys.path.append(os.path.abspath("../../../../tools/suntools")) +# Add the suntools package source parent for autodoc imports. +sys.path.append(os.path.abspath("../../../../suntools/src/suntools")) # -- General configuration ----------------------------------------------------- diff --git a/doc/cvodes/guide/source/Usage/SIM.rst b/doc/cvodes/guide/source/Usage/SIM.rst index 5ee88ad335..9e70c28ae4 100644 --- a/doc/cvodes/guide/source/Usage/SIM.rst +++ b/doc/cvodes/guide/source/Usage/SIM.rst @@ -3021,7 +3021,7 @@ described next. .. note:: - The Python module ``tools/suntools`` provides utilities to read and output + The Python package ``suntools`` provides utilities to read and output the data from a SUNDIALS CSV output file using the key and value pair format. diff --git a/doc/cvodes/guide/source/conf.py b/doc/cvodes/guide/source/conf.py index d55f3a60cd..64717ac23c 100644 --- a/doc/cvodes/guide/source/conf.py +++ b/doc/cvodes/guide/source/conf.py @@ -20,8 +20,8 @@ sys.path.append(os.path.dirname(os.path.abspath("../../../shared"))) -# Add suntools directory to import python function docstings with autodoc -sys.path.append(os.path.abspath("../../../../tools/suntools")) +# Add the suntools package source parent for autodoc imports. +sys.path.append(os.path.abspath("../../../../suntools/src/suntools")) # -- General configuration ---------------------------------------------------- diff --git a/doc/ida/examples/source/conf.py b/doc/ida/examples/source/conf.py index 375cd8503a..ba82cc8d5d 100644 --- a/doc/ida/examples/source/conf.py +++ b/doc/ida/examples/source/conf.py @@ -20,8 +20,8 @@ sys.path.append(os.path.dirname(os.path.abspath("../../../shared"))) -# Add suntools directory to import python function docstings with autodoc -sys.path.append(os.path.abspath("../../../../tools/suntools")) +# Add the suntools package source parent for autodoc imports. +sys.path.append(os.path.abspath("../../../../suntools/src/suntools")) # -- General configuration ----------------------------------------------------- diff --git a/doc/ida/guide/source/Usage/index.rst b/doc/ida/guide/source/Usage/index.rst index 2f3b992c04..6e2d01904f 100644 --- a/doc/ida/guide/source/Usage/index.rst +++ b/doc/ida/guide/source/Usage/index.rst @@ -2842,7 +2842,7 @@ described next. .. note:: - The Python module ``tools/suntools`` provides utilities to read and output + The Python package ``suntools`` provides utilities to read and output the data from a SUNDIALS CSV output file using the key and value pair format. diff --git a/doc/ida/guide/source/conf.py b/doc/ida/guide/source/conf.py index ab83c0e82b..edc299281e 100644 --- a/doc/ida/guide/source/conf.py +++ b/doc/ida/guide/source/conf.py @@ -20,8 +20,8 @@ sys.path.append(os.path.dirname(os.path.abspath("../../../shared"))) -# Add suntools directory to import python function docstings with autodoc -sys.path.append(os.path.abspath("../../../../tools/suntools")) +# Add the suntools package source parent for autodoc imports. +sys.path.append(os.path.abspath("../../../../suntools/src/suntools")) # -- General configuration ---------------------------------------------------- diff --git a/doc/idas/examples/source/conf.py b/doc/idas/examples/source/conf.py index d60c9521f2..a06de569be 100644 --- a/doc/idas/examples/source/conf.py +++ b/doc/idas/examples/source/conf.py @@ -20,8 +20,8 @@ sys.path.append(os.path.dirname(os.path.abspath("../../../shared"))) -# Add suntools directory to import python function docstings with autodoc -sys.path.append(os.path.abspath("../../../../tools/suntools")) +# Add the suntools package source parent for autodoc imports. +sys.path.append(os.path.abspath("../../../../suntools/src/suntools")) # -- General configuration ----------------------------------------------------- diff --git a/doc/idas/guide/source/Usage/SIM.rst b/doc/idas/guide/source/Usage/SIM.rst index 1630210b12..ae208fce63 100644 --- a/doc/idas/guide/source/Usage/SIM.rst +++ b/doc/idas/guide/source/Usage/SIM.rst @@ -2867,7 +2867,7 @@ described next. .. note:: - The Python module ``tools/suntools`` provides utilities to read and output + The Python package ``suntools`` provides utilities to read and output the data from a SUNDIALS CSV output file using the key and value pair format. diff --git a/doc/idas/guide/source/conf.py b/doc/idas/guide/source/conf.py index ab8e3c9344..1f75956cff 100644 --- a/doc/idas/guide/source/conf.py +++ b/doc/idas/guide/source/conf.py @@ -20,8 +20,8 @@ sys.path.append(os.path.dirname(os.path.abspath("../../../shared"))) -# Add suntools directory to import python function docstings with autodoc -sys.path.append(os.path.abspath("../../../../tools/suntools")) +# Add the suntools package source parent for autodoc imports. +sys.path.append(os.path.abspath("../../../../suntools/src/suntools")) # -- General configuration ---------------------------------------------------- diff --git a/doc/kinsol/examples/source/conf.py b/doc/kinsol/examples/source/conf.py index 7fb3af5f17..ef673b3376 100644 --- a/doc/kinsol/examples/source/conf.py +++ b/doc/kinsol/examples/source/conf.py @@ -20,8 +20,8 @@ sys.path.append(os.path.dirname(os.path.abspath("../../../shared"))) -# Add suntools directory to import python function docstings with autodoc -sys.path.append(os.path.abspath("../../../../tools/suntools")) +# Add the suntools package source parent for autodoc imports. +sys.path.append(os.path.abspath("../../../../suntools/src/suntools")) # -- General configuration ----------------------------------------------------- diff --git a/doc/kinsol/guide/source/Usage/index.rst b/doc/kinsol/guide/source/Usage/index.rst index e9a19da944..a577948e52 100644 --- a/doc/kinsol/guide/source/Usage/index.rst +++ b/doc/kinsol/guide/source/Usage/index.rst @@ -1667,7 +1667,7 @@ functions are described next. .. note:: - The Python module ``tools/suntools`` provides utilities to read and output + The Python package ``suntools`` provides utilities to read and output the data from a SUNDIALS CSV output file using the key and value pair format. diff --git a/doc/kinsol/guide/source/conf.py b/doc/kinsol/guide/source/conf.py index 43f89840dd..f0f273de9b 100644 --- a/doc/kinsol/guide/source/conf.py +++ b/doc/kinsol/guide/source/conf.py @@ -20,8 +20,8 @@ sys.path.append(os.path.dirname(os.path.abspath("../../../shared"))) -# Add suntools directory to import python function docstings with autodoc -sys.path.append(os.path.abspath("../../../../tools/suntools")) +# Add the suntools package source parent for autodoc imports. +sys.path.append(os.path.abspath("../../../../suntools/src/suntools")) # -- General configuration ---------------------------------------------------- diff --git a/doc/shared/sundials/Types.rst b/doc/shared/sundials/Types.rst index b2c807a690..1e3b804952 100644 --- a/doc/shared/sundials/Types.rst +++ b/doc/shared/sundials/Types.rst @@ -169,7 +169,7 @@ Output formatting type .. note:: - The Python module ``tools/suntools`` provides utilities to read and output + The Python package ``suntools`` provides utilities to read and output the data from a SUNDIALS CSV output file using the key and value pair format. diff --git a/doc/superbuild/source/conf.py b/doc/superbuild/source/conf.py index 113bedcee2..92fb9223d0 100644 --- a/doc/superbuild/source/conf.py +++ b/doc/superbuild/source/conf.py @@ -20,8 +20,8 @@ sys.path.append(os.path.dirname(os.path.abspath("../../shared"))) -# Add suntools directory to import python function docstrings with autodoc -sys.path.append(os.path.abspath("../../../tools/suntools")) +# Add the suntools package source parent for autodoc imports. +sys.path.append(os.path.abspath("../../../suntools/src/suntools")) # -- General configuration ---------------------------------------------------- diff --git a/pyproject.toml b/pyproject.toml index f3c2f4a712..6cbd15e273 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ classifiers = [ ] dependencies = [ "nanobind >= 2.9.2", - "numpy >= 2.0.0", + "numpy >= 2.0.0" ] [project.optional-dependencies] diff --git a/scripts/shared.sh b/scripts/shared.sh index cdfad0f8a5..7b322bf0a3 100755 --- a/scripts/shared.sh +++ b/scripts/shared.sh @@ -92,5 +92,5 @@ $tar $tarfile $distrobase/test/unit_tests/ echo " --- Add external files to $tarfile" $tar $tarfile $distrobase/external/ -echo " --- Add tools to $tarfile" -$tar $tarfile $distrobase/tools/ +echo " --- Add suntools to $tarfile" +$tar $tarfile $distrobase/suntools/ diff --git a/scripts/tarscript.sh b/scripts/tarscript.sh index d52ede0191..b967bd5304 100755 --- a/scripts/tarscript.sh +++ b/scripts/tarscript.sh @@ -210,7 +210,7 @@ mkdir $tmpdir/examples mkdir $tmpdir/include mkdir $tmpdir/src mkdir $tmpdir/test -mkdir $tmpdir/tools +mkdir $tmpdir/suntools #---------------------------------- # Copy appropriate files in $tmpdir @@ -258,7 +258,7 @@ cp -r $sundialsdir/src/sundomeigest $tmpdir/src/ cp $sundialsdir/test/testRunner $tmpdir/test/ cp -r $sundialsdir/test/unit_tests $tmpdir/test/ -cp -r $sundialsdir/tools $tmpdir/ +cp -r $sundialsdir/suntools $tmpdir/ # Clean up tmpdir rm -rf $tmpdir/doc/shared/__pycache__ @@ -269,7 +269,7 @@ find $tmpdir -name ".DS_Store" -delete # Remove ignored or untracked files that may have been added cd $sundialsdir -for f in $(git ls-files --others --directory benchmarks cmake doc examples external include src test tools); do +for f in $(git ls-files --others --directory benchmarks cmake doc examples external include src test suntools); do rm -rf $tmpdir/$f done cd - diff --git a/suntools/README.md b/suntools/README.md new file mode 100644 index 0000000000..ac60291cd2 --- /dev/null +++ b/suntools/README.md @@ -0,0 +1,20 @@ +# suntools (SUNDIALS) + +This directory contains the `suntools` Python package which provides utilities for + +- parsing SUNDIALS log files +- more to come... + +## Install + +From this directory: + +```bash +python -m pip install -e . +``` + +Then import as: + +```python +import suntools +``` diff --git a/tools/log_example.py b/suntools/examples/log_example.py similarity index 100% rename from tools/log_example.py rename to suntools/examples/log_example.py diff --git a/tools/log_example_mri.py b/suntools/examples/log_example_mri.py similarity index 100% rename from tools/log_example_mri.py rename to suntools/examples/log_example_mri.py diff --git a/tools/log_example_print.py b/suntools/examples/log_example_print.py similarity index 100% rename from tools/log_example_print.py rename to suntools/examples/log_example_print.py diff --git a/suntools/pyproject.toml b/suntools/pyproject.toml new file mode 100644 index 0000000000..7819da4898 --- /dev/null +++ b/suntools/pyproject.toml @@ -0,0 +1,35 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "suntools" +version = "7.7.0" +description = "Utilities designed to assist users of the SUNDIALS suite of nonlinear and differential/algebraic equation solvers." +readme = "README.md" +requires-python = ">=3.9" +license = { text = "BSD-3-Clause" } +authors = [ + { name = "SUNDIALS Developers", email = "sundials-users@llnl.gov" } +] +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent" +] + +[project.urls] +Homepage = "https://computing.llnl.gov/projects/sundials" +Documentation = "https://sundials.readthedocs.io/" +Source = "https://github.com/LLNL/sundials" + +[tool.hatch.build.targets.wheel] +packages = ["src/suntools"] + +[tool.hatch.build.targets.sdist] +include = [ + "/src/suntools", + "/examples", + "/README.md", + "/pyproject.toml", +] diff --git a/tools/suntools/__init__.py b/suntools/src/suntools/__init__.py similarity index 100% rename from tools/suntools/__init__.py rename to suntools/src/suntools/__init__.py diff --git a/tools/suntools/csv.py b/suntools/src/suntools/csv.py similarity index 100% rename from tools/suntools/csv.py rename to suntools/src/suntools/csv.py diff --git a/tools/suntools/logs.py b/suntools/src/suntools/logs.py similarity index 100% rename from tools/suntools/logs.py rename to suntools/src/suntools/logs.py diff --git a/tools/suntools/table.py b/suntools/src/suntools/table.py similarity index 100% rename from tools/suntools/table.py rename to suntools/src/suntools/table.py diff --git a/tools/suntools/utils.py b/suntools/src/suntools/utils.py similarity index 100% rename from tools/suntools/utils.py rename to suntools/src/suntools/utils.py diff --git a/test/unit_tests/suntools/CMakeLists.txt b/test/unit_tests/suntools/CMakeLists.txt index a79e0e0d22..ce3e0c2d85 100644 --- a/test/unit_tests/suntools/CMakeLists.txt +++ b/test/unit_tests/suntools/CMakeLists.txt @@ -15,8 +15,8 @@ # SUNDIALS Copyright End # --------------------------------------------------------------- -# Locate suntools module -set(SUNTOOLS_DIR "${CMAKE_SOURCE_DIR}/tools/suntools") +# Locate suntools module source directory. +set(SUNTOOLS_DIR "${CMAKE_SOURCE_DIR}/suntools/src/suntools") if(NOT EXISTS "${SUNTOOLS_DIR}/logs.py") message(WARNING "Skipped suntools log parser tests (logs.py not found)")