From aaf0450009a355ac8b08eaf043a55f478939748d Mon Sep 17 00:00:00 2001
From: Pooja Babu
Date: Thu, 25 Jul 2024 15:58:59 +0200
Subject: [PATCH] Address review comments
---
.github/workflows/nestml-build.yml | 60 +++++++++
doc/fig/nest-desktop.svg | 118 ++++++++++++++++++
doc/running/index.rst | 16 ++-
doc/running/running_nest_desktop.rst | 12 ++
.../nest_desktop_code_generator.py | 3 +-
5 files changed, 206 insertions(+), 3 deletions(-)
create mode 100644 doc/fig/nest-desktop.svg
create mode 100644 doc/running/running_nest_desktop.rst
diff --git a/.github/workflows/nestml-build.yml b/.github/workflows/nestml-build.yml
index a129fc47d..63c2ecbc2 100644
--- a/.github/workflows/nestml-build.yml
+++ b/.github/workflows/nestml-build.yml
@@ -118,6 +118,66 @@ jobs:
done;
exit $rc
+ build_and_test_nest_desktop:
+ needs: [static_checks]
+ runs-on: ubuntu-latest
+ steps:
+ # Checkout the repository contents
+ - name: Checkout NESTML code
+ uses: actions/checkout@v4
+
+ # Setup Python version
+ - name: Setup Python 3.8
+ uses: actions/setup-python@v5
+ with:
+ python-version: 3.8
+
+ # Install dependencies
+ - name: Install apt dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install libgsl0-dev libncurses5-dev pkg-config
+ sudo apt-get install python3-all-dev python3-matplotlib python3-numpy python3-scipy ipython3
+
+ # Install Python dependencies
+ - name: Python dependencies
+ run: |
+ python -m pip install --upgrade pip pytest jupyterlab matplotlib pycodestyle scipy
+ python -m pip install -r requirements.txt
+
+ - name: NEST simulator
+ run: |
+ python -m pip install cython
+ echo "GITHUB_WORKSPACE = $GITHUB_WORKSPACE"
+ NEST_SIMULATOR=$(pwd)/nest-simulator
+ NEST_INSTALL=$(pwd)/nest_install
+ echo "NEST_SIMULATOR = $NEST_SIMULATOR"
+ echo "NEST_INSTALL = $NEST_INSTALL"
+
+ git clone --depth=1 https://github.com/nest/nest-simulator --branch ${{ matrix.nest_branch }}
+ mkdir nest_install
+ echo "NEST_INSTALL=$NEST_INSTALL" >> $GITHUB_ENV
+ cd nest_install
+ cmake -DCMAKE_INSTALL_PREFIX=$NEST_INSTALL $NEST_SIMULATOR
+ make && make install
+ cd ..
+
+ # Install NESTML
+ - name: Install NESTML
+ run: |
+ export PYTHONPATH=${{ env.PYTHONPATH }}:${{ env.NEST_INSTALL }}/lib/python3.8/site-packages
+ #echo PYTHONPATH=`pwd` >> $GITHUB_ENV
+ echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
+ python setup.py install
+
+ # Run integration tests
+ - name: Run integration tests
+ run: |
+ rc=0
+ for fn in $GITHUB_WORKSPACE/tests/nest_desktop_tests/*.py; do
+ pytest -s -o log_cli=true -o log_cli_level="DEBUG" ${fn} || rc=1
+ done;
+ exit $rc
build_and_test_nest:
needs: [static_checks]
runs-on: ubuntu-latest
diff --git a/doc/fig/nest-desktop.svg b/doc/fig/nest-desktop.svg
new file mode 100644
index 000000000..e68653c77
--- /dev/null
+++ b/doc/fig/nest-desktop.svg
@@ -0,0 +1,118 @@
+
+
+
+
diff --git a/doc/running/index.rst b/doc/running/index.rst
index c71dcd428..db84e0880 100644
--- a/doc/running/index.rst
+++ b/doc/running/index.rst
@@ -49,6 +49,15 @@ Currently, the following target platforms are supported for code generation. Cli
|spinnaker_logo|
+.. grid:: 1
+
+ .. grid-item-card::
+ :text-align: center
+ :class-title: sd-d-flex-row sd-align-minor-center
+
+ :doc:`NEST Desktop `
+
+ |nest_desktop_logo|
.. |nest_logo| image:: https://raw.githubusercontent.com/nest/nestml/master/doc/fig/nest-simulator-logo.png
:width: 95px
@@ -65,6 +74,11 @@ Currently, the following target platforms are supported for code generation. Cli
:height: 40px
:target: running_spinnaker.html
+.. |nest_desktop_logo| image:: https://raw.githubusercontent.com/nest/nestml/master/doc/fig/nest-desktop.svg
+ :width: 40px
+ :height: 40px
+ :target: running_nest_desktop.html
+
.. warning::
To ensure correct and reproducible results, always inspect the generated code by hand. Run comprehensive numerical testing of the model(s).
@@ -101,7 +115,7 @@ The following default values are used, corresponding to the command line default
- *no default*
* - target_platform
- str
- - "NEST", "NEST_DESKTOP"
+ - "NEST"
* - target_path
- str
- None
diff --git a/doc/running/running_nest_desktop.rst b/doc/running/running_nest_desktop.rst
new file mode 100644
index 000000000..0e36295c2
--- /dev/null
+++ b/doc/running/running_nest_desktop.rst
@@ -0,0 +1,12 @@
+Python-standalone target
+------------------------
+
+*NESTML features supported:* :doc:`neurons `
+
+The aim of the NEST Desktop target is to generate ``json`` files with parameters for models. This data will be used for rendering the parameter values in the NEST Desktop UI when a NESTML model is loaded.
+
+
+Code generation options
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Several code generator options are available; for an overview see :class:`pynestml.codegeneration.nest_desktop_code_generator.NESTDesktopCodeGenerator`.
diff --git a/pynestml/codegeneration/nest_desktop_code_generator.py b/pynestml/codegeneration/nest_desktop_code_generator.py
index 6983888c5..b0063205e 100644
--- a/pynestml/codegeneration/nest_desktop_code_generator.py
+++ b/pynestml/codegeneration/nest_desktop_code_generator.py
@@ -19,11 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with NEST. If not, see .
import os
-from typing import Sequence, Union, Optional, Mapping, Any, Dict
+from typing import Sequence, Optional, Mapping, Any, Dict
from pynestml.codegeneration.code_generator import CodeGenerator
from pynestml.codegeneration.code_generator_utils import CodeGeneratorUtils
-from pynestml.frontend.frontend_configuration import FrontendConfiguration
from pynestml.meta_model.ast_model import ASTModel