-
Notifications
You must be signed in to change notification settings - Fork 3
Add scaffolding for python wrappers and SBML #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kwabenantim
wants to merge
73
commits into
main
Choose a base branch
from
pychaste_template
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
e26d52e
#3 Fix minor setup bugs
kwabenantim f7ed54d
#3 Add convenience scripts
kwabenantim 444e6e8
#3 Update gitignore
kwabenantim ee9479c
#3 Add setup query about project name
kwabenantim 871bf1e
#3 Summarise chosen options
kwabenantim 16dc0e4
#3 Add docstrings in setup.py
kwabenantim c8cf2ed
#3 Add linting, update gitignore
kwabenantim 4e27e93
#3 Add safe delete in scripts
kwabenantim 539336f
#3 Update safe delete in scripts
kwabenantim 9eebf7c
#3 Update reset, add setup settings
kwabenantim abf6caa
#3 Remove complicated reset
kwabenantim 76e0f1b
#3 Add end of setup message
kwabenantim 238ffc7
#3 Check if project is already setup
kwabenantim 23f60a0
#3 Update setup answer defaults
kwabenantim c3e5bf5
#3 Simplify cmake project substitutions
kwabenantim fa11860
#3 Verify Chaste source directory exists
kwabenantim a05b8ce
#3 Add optional Python bindings support
kwabenantim dc6703e
#3 Fix test workflow
kwabenantim d257012
#3 Default to checkout v6
kwabenantim f1b6294
#3 Use privileged test container
kwabenantim 6151fd0
#3 Fix workflow template path
kwabenantim a79d642
#3 Auto-set chaste source dir
kwabenantim 3ab6d49
#3 Add standard project github workflow
kwabenantim 6075a2a
#3 Add BUILD_PROJECT_PYTHON_BINDINGS script var
kwabenantim 5470b1f
#3 Simplify python bindings build
kwabenantim f4cb2d7
#3 Update safe_rm
kwabenantim a1675f0
#3 Simplify python src copy
kwabenantim efc28ca
#3 Add chaste src dir guard
kwabenantim 48dc02a
#3 Add pybind11 OPT_SIZE flag
kwabenantim 9ba5389
#3 Fail configure if necessary wrappers don't generate
kwabenantim d53c804
#3 Simplify python cmake
kwabenantim 0b05c0c
#3 Default Chaste provenance to off
kwabenantim 66cb27d
#3 Add common template substitutions to config.yaml
kwabenantim f892ff6
#3 Add SBML template project
kwabenantim adaaab4
#3 Add python bindings guide and example
kwabenantim 894f936
#3 Fix pychaste bindings inheritance
kwabenantim 3e90cfb
#3 Update cross-package bindings inheritance
kwabenantim 25b4b89
#3 Use cmake flto setting
kwabenantim 246455e
Merge branch 'pychaste_template' into sbml-template
kwabenantim 4b35e12
#3 Update workflow prompts and dependencies
kwabenantim 061cf3a
#3 Include Goldbeter example
kwabenantim 24c616f
#3 Switch CI to chaste/base
kwabenantim ce2d655
Merge branch 'pychaste_template' into sbml-template
kwabenantim a2dc66a
#3 Fix Goldbeter1991 example
kwabenantim 753d18e
#3 Remove wrapper generation guard
kwabenantim 52b0f96
#3 Update wrapping troubleshooting docs
kwabenantim 8f8294a
#3 Update force example
kwabenantim 091e0a7
#3 Update force example
kwabenantim 82b9612
#3 Create virtualenv during python setup
kwabenantim de3e7ad
Merge branch 'pychaste_template' into sbml-template
kwabenantim 7f2ebac
#3 Add create_venv.sh
kwabenantim 1d578a1
Merge pull request #5 from Chaste/sbml-template
kwabenantim a13463b
Fix missing CHASTE_SOURCE_DIR env var in workflow files
Copilot ac1716c
#3 Copy SBML base classes from the chaste-sbml package
kwabenantim 202d8cd
Fix review comments in workflow and manifest
Copilot 15d42b4
Merge branch 'main' into pychaste_template
kwabenantim ec4ac32
#3 Simplify python config compatible with cppwg 0.5.0
kwabenantim b93cc0f
Merge branch 'main' into pychaste_template
kwabenantim 0ba29f6
#3 Simplify python project ci tests
kwabenantim 6482f5b
#3 Update sbml project compatible with chaste-sbml 0.0.1
kwabenantim f6c930d
#3 Fix python_example CI
kwabenantim 7d5cbcd
#3 Fix sbml_example CI
kwabenantim 72ef349
#3 Fix python force example
kwabenantim 257de85
#3 Update sbml example timescale
kwabenantim 611e82f
copyright updates
mirams b2bdba4
#3 Move bindings and SBML files into top-level folders
kwabenantim 54c1821
#3 Update path references for the bindings and sbml folders
kwabenantim 1744561
#3 Split the README across the bindings and sbml folders
kwabenantim c356c43
#3 Update bindings and SBML examples
kwabenantim 138df15
#3 Simplify helper scripts
kwabenantim feb950e
#3 Improve sbml and bindings READMEs
kwabenantim e0b3d1f
#3 Split sbml and bindings in setup
kwabenantim 1845f67
#3 Tweak docs
kwabenantim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| [flake8] | ||
| max_line_length = 120 | ||
|
|
||
| exclude = | ||
| __pycache__, | ||
| .git, | ||
| .github, | ||
| .venv, | ||
| .virtualenv, | ||
| build, | ||
| output, | ||
| venv, | ||
| virtualenv, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: Test Project | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| pull_request: | ||
| branches: ["**"] | ||
|
|
||
| concurrency: | ||
| group: test-project-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test-project: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| container: | ||
| image: chaste/base | ||
| options: --user root | ||
|
|
||
| env: | ||
| CHASTE_SOURCE_DIR: /tmp/Chaste | ||
| CHASTE_BUILD_DIR: /tmp/build | ||
| CHASTE_TEST_OUTPUT: /tmp/testoutput | ||
| PROJECT_DIR: /tmp/myproject | ||
|
|
||
| steps: | ||
| - name: Checkout template | ||
| uses: actions/checkout@v7 | ||
|
|
||
| - name: Checkout Chaste source | ||
| run: | | ||
| git clone --depth 1 --branch develop https://github.com/Chaste/Chaste.git "${CHASTE_SOURCE_DIR}" | ||
| git config --global --add safe.directory "${CHASTE_SOURCE_DIR}" | ||
|
|
||
| - name: Create test project | ||
| run: | | ||
| cp -r . ${{ env.PROJECT_DIR }} | ||
| cd ${{ env.PROJECT_DIR }} | ||
| # Prompt defaults (no components, no Python bindings, no SBML), yes to confirm | ||
| printf '\n\n\n\n\nn\nn\ny\n' | python3 setup_project.py | ||
|
|
||
| - name: Configure | ||
| run: ${{ env.PROJECT_DIR }}/scripts/configure.sh | ||
|
|
||
| - name: Compile | ||
| run: ${{ env.PROJECT_DIR }}/scripts/compile.sh | ||
|
|
||
| - name: Test | ||
| run: ${{ env.PROJECT_DIR }}/scripts/test.sh | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| name: Test Python Project | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| pull_request: | ||
| branches: ["**"] | ||
|
|
||
| concurrency: | ||
| group: test-python-project-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test-python-project: | ||
| # Two configurations: | ||
| # - default-components: the python wrapper template exactly as shipped. | ||
| # - force-example: the bindings/example walkthrough. | ||
| name: ${{ matrix.variant }} | ||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| # Prompt defaults (proceed, no optional components), yes to Python | ||
| # bindings, no to SBML, yes to confirm | ||
| - variant: default-components | ||
| answers: '\n\n\n\n\ny\nn\ny\n' | ||
| # Yes to proceed, yes to cell_based, no to crypt/heart/lung, yes to | ||
| # Python bindings, no to SBML, yes to confirm | ||
| - variant: force-example | ||
| answers: 'y\ny\nn\nn\nn\ny\nn\ny\n' | ||
|
|
||
| container: | ||
| image: chaste/base | ||
| options: --user root | ||
|
|
||
| env: | ||
| CHASTE_SOURCE_DIR: /tmp/Chaste | ||
| CHASTE_BUILD_DIR: /tmp/build | ||
| CHASTE_TEST_OUTPUT: /tmp/testoutput | ||
| PROJECT_DIR: /tmp/myproject | ||
|
Copilot marked this conversation as resolved.
|
||
|
|
||
| steps: | ||
| - name: Checkout template | ||
| uses: actions/checkout@v7 | ||
|
|
||
| - name: Checkout Chaste source | ||
| run: | | ||
| git clone --depth 1 --branch develop https://github.com/Chaste/Chaste.git "${CHASTE_SOURCE_DIR}" | ||
| git config --global --add safe.directory "${CHASTE_SOURCE_DIR}" | ||
|
|
||
| - name: Create test project | ||
| run: | | ||
| cp -r . ${{ env.PROJECT_DIR }} | ||
| cd ${{ env.PROJECT_DIR }} | ||
| printf '%b' '${{ matrix.answers }}' | python3 setup_project.py | ||
|
|
||
| - name: Add MyForce to the project bindings | ||
| if: matrix.variant == 'force-example' | ||
| run: | | ||
| cd ${{ env.PROJECT_DIR }} | ||
| cp bindings/example/MyForce.hpp bindings/example/MyForce.cpp src/ | ||
| sed -i.bak 's/^ classes:$/&\n - name: MyForce/' bindings/config.yaml | ||
| # Import PyChaste's module and declare AbstractForce as an external base | ||
| sed -i.bak 's/^ - name: all$/&\n imports:/' bindings/config.yaml | ||
| sed -i.bak 's/^ imports:$/&\n - chaste._pychaste_all/' bindings/config.yaml | ||
| sed -i.bak 's/^ - chaste._pychaste_all$/&\n external_bases:/' bindings/config.yaml | ||
| sed -i.bak 's/^ external_bases:$/&\n - AbstractForce/' bindings/config.yaml | ||
| # The seds above anchor on the shipped formatting of config.yaml; fail loudly | ||
| # here rather than later with a confusing "MyForce_2 not found" at runtime. | ||
| grep -q '^ - name: MyForce$' bindings/config.yaml | ||
| grep -q '^ - chaste._pychaste_all$' bindings/config.yaml | ||
| grep -q '^ - AbstractForce$' bindings/config.yaml | ||
|
|
||
| - name: Configure | ||
| run: ${{ env.PROJECT_DIR }}/scripts/configure.sh | ||
|
|
||
| - name: Compile | ||
| run: ${{ env.PROJECT_DIR }}/scripts/compile.sh | ||
|
|
||
| - name: Install | ||
| run: ${{ env.PROJECT_DIR }}/bindings/install.sh | ||
|
|
||
| - name: Test Python bindings | ||
| run: | | ||
| ${{ env.PROJECT_DIR }}/.virtualenv/bin/python -c " | ||
| import myproject | ||
| h = myproject.Hello_myproject('Hello from Python!') | ||
| message = h.GetMessage() | ||
| assert message == 'Hello from Python!', f'Expected \"Hello from Python!\" but got \"{message}\"' | ||
| print(f'GetMessage() returned: {message}') | ||
| print('Test passed!') | ||
| " | ||
|
|
||
| - name: Run the MyForce simulation from Python | ||
| if: matrix.variant == 'force-example' | ||
| run: ${{ env.PROJECT_DIR }}/.virtualenv/bin/python ${{ env.PROJECT_DIR }}/bindings/example/run_my_force.py | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| name: Test SBML Project | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| pull_request: | ||
| branches: ["**"] | ||
|
|
||
| concurrency: | ||
| group: test-sbml-project-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test-sbml-project: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| container: | ||
| image: chaste/base | ||
| options: --user root | ||
|
|
||
| env: | ||
| CHASTE_SOURCE_DIR: /tmp/Chaste | ||
| CHASTE_BUILD_DIR: /tmp/build | ||
| CHASTE_TEST_OUTPUT: /tmp/testoutput | ||
| PROJECT_DIR: /tmp/myproject | ||
|
Copilot marked this conversation as resolved.
|
||
|
|
||
| steps: | ||
| - name: Checkout template | ||
| uses: actions/checkout@v7 | ||
|
|
||
| - name: Checkout Chaste source | ||
| run: | | ||
| git clone --depth 1 --branch develop https://github.com/Chaste/Chaste.git "${CHASTE_SOURCE_DIR}" | ||
| git config --global --add safe.directory "${CHASTE_SOURCE_DIR}" | ||
|
|
||
| - name: Install clang-format | ||
| run: apt-get update && apt-get install -y clang-format | ||
|
|
||
| - name: Create test project | ||
| run: | | ||
| cp -r . ${{ env.PROJECT_DIR }} | ||
| cd ${{ env.PROJECT_DIR }} | ||
| # Prompt defaults for proceed/components/no-python-bindings, yes to SBML, yes to confirm | ||
| printf '\n\n\n\n\n\ny\ny\n' | python3 setup_project.py | ||
|
|
||
| - name: Install chaste-sbml | ||
| run: ${{ env.PROJECT_DIR }}/sbml/install.sh | ||
|
|
||
| - name: Import the Goldbeter 1991 model | ||
| run: | | ||
| cd ${{ env.PROJECT_DIR }} | ||
| cp sbml/example/Goldbeter1991.xml . | ||
| .virtualenv/bin/chaste-sbml Goldbeter1991.xml --model-type srn --output-dir src/ | ||
| cp sbml/example/TestGoldbeter1991SbmlSrnModel.hpp test/ | ||
| echo "TestGoldbeter1991SbmlSrnModel.hpp" >> test/ContinuousTestPack.txt | ||
|
|
||
| - name: Configure | ||
| run: ${{ env.PROJECT_DIR }}/scripts/configure.sh | ||
|
|
||
| - name: Compile | ||
| run: ${{ env.PROJECT_DIR }}/scripts/compile.sh | ||
|
|
||
| - name: Test | ||
| run: ${{ env.PROJECT_DIR }}/scripts/test.sh | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,42 @@ | ||
| build/ | ||
| output/ | ||
|
|
||
| .vscode/ | ||
|
|
||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # Python | ||
| __pycache__/ | ||
| *.py[cod] | ||
| *.egg-info/ | ||
| .eggs/ | ||
| .virtualenv/ | ||
| .venv/ | ||
| venv/ | ||
| env/ | ||
| .pytest_cache/ | ||
| .mypy_cache/ | ||
| .ruff_cache/ | ||
|
|
||
| # C++ | ||
| *.o | ||
| *.obj | ||
| *.lo | ||
| *.slo | ||
| *.a | ||
| *.lib | ||
| *.so | ||
| *.dylib | ||
| *.dll | ||
| *.exe | ||
| *.out | ||
| *.gch | ||
| *.pch | ||
|
|
||
| # CMake | ||
| CMakeCache.txt | ||
| CMakeFiles/ | ||
| cmake_install.cmake | ||
| CTestTestfile.cmake | ||
| compile_commands.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.