From 98cf829e17c9ccb261c7b418af81c2124a17e490 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Tue, 2 Apr 2024 19:54:15 -0600 Subject: [PATCH] Update C example through installation [skip ci] --- docs/source/example-c.rst | 44 +++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/docs/source/example-c.rst b/docs/source/example-c.rst index 90f3761..ba46370 100644 --- a/docs/source/example-c.rst +++ b/docs/source/example-c.rst @@ -167,29 +167,15 @@ generate a Python package for the model with the ``babelize init`` command: The results are placed in a new directory, ``pymt_heatc``, under the current directory. -Before we can build and install the Python package, -we must ensure that the dependencies required by the toolchain, -as well as those required by the model, -as specified in the *babelizer* configuration file, -are satisfied. +Build and install the wrapped model +................................... -Change to the ``pymt_heatc`` directory and install dependencies -into the conda environment: +Change to the ``pymt_heatc`` directory, +then build and install the Python package with: .. code:: bash - cd pymt_heatc - conda install -c conda-forge \ - --file requirements-build.txt \ - --file requirements-library.txt \ - --file requirements-testing.txt \ - --file requirements.txt - -Now build and install the Python package with: - -.. code:: bash - - pip install --no-build-isolation --editable . + pip install ."[dev]" This command sets off a long list of messages, at the end of which you'll hopefully see: @@ -199,22 +185,27 @@ at the end of which you'll hopefully see: Successfully installed pymt-heatc Pause a moment to see what we've done. -Change back to the initial ``build`` directory, +Change back to the initial ``example-c`` directory, make a new ``test`` directory, and change to it: .. code:: bash - $ cd .. - $ mkdir test && cd test + cd .. + mkdir test && cd test Start a Python session and try the following commands: .. code:: python - >>> from pymt_heatc import HeatModel - >>> m = HeatModel() - >>> print(m.get_component_name()) + from pymt_heatc import HeatC + m = HeatC() + m.get_component_name() + +You should see: + +.. code:: bash + The 2D Heat Equation We've imported the *heat* model, @@ -222,6 +213,9 @@ written in C, into Python! Exit the Python session. +Test the BMI +............ + At this point, it's a good idea to run the *bmi-tester* (`GitHub repo `_) over the model.