Skip to content
Open
Show file tree
Hide file tree
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 Jun 16, 2026
f7ed54d
#3 Add convenience scripts
kwabenantim Jun 22, 2026
444e6e8
#3 Update gitignore
kwabenantim Jun 22, 2026
ee9479c
#3 Add setup query about project name
kwabenantim Jun 22, 2026
871bf1e
#3 Summarise chosen options
kwabenantim Jun 22, 2026
16dc0e4
#3 Add docstrings in setup.py
kwabenantim Jun 22, 2026
c8cf2ed
#3 Add linting, update gitignore
kwabenantim Jun 22, 2026
4e27e93
#3 Add safe delete in scripts
kwabenantim Jun 22, 2026
539336f
#3 Update safe delete in scripts
kwabenantim Jun 22, 2026
9eebf7c
#3 Update reset, add setup settings
kwabenantim Jun 22, 2026
abf6caa
#3 Remove complicated reset
kwabenantim Jun 22, 2026
76e0f1b
#3 Add end of setup message
kwabenantim Jun 22, 2026
238ffc7
#3 Check if project is already setup
kwabenantim Jun 22, 2026
23f60a0
#3 Update setup answer defaults
kwabenantim Jun 22, 2026
c3e5bf5
#3 Simplify cmake project substitutions
kwabenantim Jun 22, 2026
fa11860
#3 Verify Chaste source directory exists
kwabenantim Jun 22, 2026
a05b8ce
#3 Add optional Python bindings support
kwabenantim Jun 22, 2026
dc6703e
#3 Fix test workflow
kwabenantim Jun 22, 2026
d257012
#3 Default to checkout v6
kwabenantim Jun 22, 2026
f1b6294
#3 Use privileged test container
kwabenantim Jun 22, 2026
6151fd0
#3 Fix workflow template path
kwabenantim Jun 23, 2026
a79d642
#3 Auto-set chaste source dir
kwabenantim Jun 23, 2026
3ab6d49
#3 Add standard project github workflow
kwabenantim Jun 23, 2026
6075a2a
#3 Add BUILD_PROJECT_PYTHON_BINDINGS script var
kwabenantim Jun 23, 2026
5470b1f
#3 Simplify python bindings build
kwabenantim Jun 23, 2026
f4cb2d7
#3 Update safe_rm
kwabenantim Jun 23, 2026
a1675f0
#3 Simplify python src copy
kwabenantim Jun 23, 2026
efc28ca
#3 Add chaste src dir guard
kwabenantim Jun 23, 2026
48dc02a
#3 Add pybind11 OPT_SIZE flag
kwabenantim Jun 23, 2026
9ba5389
#3 Fail configure if necessary wrappers don't generate
kwabenantim Jun 23, 2026
d53c804
#3 Simplify python cmake
kwabenantim Jun 23, 2026
0b05c0c
#3 Default Chaste provenance to off
kwabenantim Jun 23, 2026
66cb27d
#3 Add common template substitutions to config.yaml
kwabenantim Jun 23, 2026
f892ff6
#3 Add SBML template project
kwabenantim Jun 29, 2026
adaaab4
#3 Add python bindings guide and example
kwabenantim Jun 29, 2026
894f936
#3 Fix pychaste bindings inheritance
kwabenantim Jun 30, 2026
3e90cfb
#3 Update cross-package bindings inheritance
kwabenantim Jun 30, 2026
25b4b89
#3 Use cmake flto setting
kwabenantim Jun 30, 2026
246455e
Merge branch 'pychaste_template' into sbml-template
kwabenantim Jun 30, 2026
4b35e12
#3 Update workflow prompts and dependencies
kwabenantim Jun 30, 2026
061cf3a
#3 Include Goldbeter example
kwabenantim Jun 30, 2026
24c616f
#3 Switch CI to chaste/base
kwabenantim Jun 30, 2026
ce2d655
Merge branch 'pychaste_template' into sbml-template
kwabenantim Jun 30, 2026
a2dc66a
#3 Fix Goldbeter1991 example
kwabenantim Jun 30, 2026
753d18e
#3 Remove wrapper generation guard
kwabenantim Jul 3, 2026
52b0f96
#3 Update wrapping troubleshooting docs
kwabenantim Jul 3, 2026
8f8294a
#3 Update force example
kwabenantim Jul 3, 2026
091e0a7
#3 Update force example
kwabenantim Jul 3, 2026
82b9612
#3 Create virtualenv during python setup
kwabenantim Jul 3, 2026
de3e7ad
Merge branch 'pychaste_template' into sbml-template
kwabenantim Jul 3, 2026
7f2ebac
#3 Add create_venv.sh
kwabenantim Jul 3, 2026
1d578a1
Merge pull request #5 from Chaste/sbml-template
kwabenantim Jul 3, 2026
a13463b
Fix missing CHASTE_SOURCE_DIR env var in workflow files
Copilot Jul 3, 2026
ac1716c
#3 Copy SBML base classes from the chaste-sbml package
kwabenantim Jul 4, 2026
202d8cd
Fix review comments in workflow and manifest
Copilot Jul 4, 2026
15d42b4
Merge branch 'main' into pychaste_template
kwabenantim Sep 15, 2026
ec4ac32
#3 Simplify python config compatible with cppwg 0.5.0
kwabenantim Sep 17, 2026
b93cc0f
Merge branch 'main' into pychaste_template
kwabenantim Sep 17, 2026
0ba29f6
#3 Simplify python project ci tests
kwabenantim Sep 17, 2026
6482f5b
#3 Update sbml project compatible with chaste-sbml 0.0.1
kwabenantim Sep 17, 2026
f6c930d
#3 Fix python_example CI
kwabenantim Sep 17, 2026
7d5cbcd
#3 Fix sbml_example CI
kwabenantim Sep 17, 2026
72ef349
#3 Fix python force example
kwabenantim Sep 18, 2026
257de85
#3 Update sbml example timescale
kwabenantim Sep 18, 2026
611e82f
copyright updates
mirams Sep 21, 2026
b2bdba4
#3 Move bindings and SBML files into top-level folders
kwabenantim Sep 24, 2026
54c1821
#3 Update path references for the bindings and sbml folders
kwabenantim Sep 24, 2026
1744561
#3 Split the README across the bindings and sbml folders
kwabenantim Sep 24, 2026
c356c43
#3 Update bindings and SBML examples
kwabenantim Sep 30, 2026
138df15
#3 Simplify helper scripts
kwabenantim Sep 30, 2026
feb950e
#3 Improve sbml and bindings READMEs
kwabenantim Sep 30, 2026
e0b3d1f
#3 Split sbml and bindings in setup
kwabenantim Sep 30, 2026
1845f67
#3 Tweak docs
kwabenantim Sep 30, 2026
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
13 changes: 13 additions & 0 deletions .flake8
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,
50 changes: 50 additions & 0 deletions .github/workflows/test-project.yml
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
Comment thread
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 }}
# 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
98 changes: 98 additions & 0 deletions .github/workflows/test-python-project.yml
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
Comment thread
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
64 changes: 64 additions & 0 deletions .github/workflows/test-sbml-project.yml
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
Comment thread
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
40 changes: 40 additions & 0 deletions .gitignore
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
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2005-2023, University of Oxford.
# Copyright (c) 2005-2026, University of Oxford.
# All rights reserved.
#
# University of Oxford means the Chancellor, Masters and Scholars of the
Expand Down Expand Up @@ -52,3 +52,7 @@ find_package(Chaste COMPONENTS continuum_mechanics global io linalg mesh ode pde
# Change the project name in the line below to match the folder this file is in,
# i.e. the name of your project.
chaste_do_project(template_project)

if(Chaste_ENABLE_PYCHASTE AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/bindings")
add_subdirectory(bindings)
endif()
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,29 @@ Alternatively, if you aren't a github user, you can download a zip (see Releases

Then see the [User Projects](https://chaste.github.io/docs/user-guides/user-projects/) guide page on the Chaste website for more information.

If you clone this repository, you should make sure to rename the template_project folder with your project name and run the 'setup_project.py' script to avoid conflicts if you have multiple projects.
If you clone this repository, you should make sure to rename the **template_project** folder with your project name and run the `setup_project.py` script to avoid conflicts if you have multiple projects.

## What's in here

| Path | |
| --- | --- |
| `src/`, `test/`, `apps/` | your project's C++ code; only `src/` is compiled into the project library |
| `scripts/` | configure / compile / test helpers |
| `bindings/` | optional PyChaste Python bindings; see [bindings/README.md](bindings/README.md) |
| `sbml/` | optional SBML model import; see [sbml/README.md](sbml/README.md) |

`setup_project.py` asks whether you want each optional capability and removes the
directory if you decline, so a plain C++ project keeps neither.

## Building

There are simple convenience scripts available to help with the build process. From the project directory, with `CHASTE_SOURCE_DIR` pointing at your Chaste source:

```sh
scripts/configure.sh # symlink the project into Chaste/projects and configure the build
scripts/compile.sh # build the project
scripts/test.sh # run the project's tests
```

If you need more detailed control of the build process, see the
[full Chaste build guide](https://chaste.github.io/docs/dev-guides/cmake-build-guide/).
Loading
Loading