Skip to content
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

Typecaster examples #63

Merged
merged 31 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6e4bd48
#20 Remove mesh from shapes example
kwabenantim Oct 16, 2024
64d6158
#20 Add cells example
kwabenantim Oct 16, 2024
81a886e
#20 Add Potts to cells example
kwabenantim Oct 16, 2024
c4fd42a
#20 Build cells example correctly
kwabenantim Oct 28, 2024
e5c5ff7
#20 Simplify cells example build
kwabenantim Oct 28, 2024
5d3e53a
#20 Add Scene to cells example
kwabenantim Oct 29, 2024
5577aa9
#20 Add vtk typecaster to cell example
kwabenantim Oct 30, 2024
aa3ea5a
#20 Test cells example
kwabenantim Oct 30, 2024
986d91c
#20 Add PETSc utils to cell example
kwabenantim Oct 31, 2024
dc71eb8
#20 Add PETSc typecaster to cell example
kwabenantim Oct 31, 2024
d6fc9c7
#20 Test PETSc typecaster
kwabenantim Oct 31, 2024
e7a3e2a
#20 Add thirdparty caster_petsc
kwabenantim Oct 31, 2024
e56e4b0
#20 Fix test errors
kwabenantim Oct 31, 2024
49386fb
#20 Use skbuild
kwabenantim Nov 1, 2024
909ad01
#20 Split main and wrapper libs in cells example
kwabenantim Nov 1, 2024
9f5aa68
#20 Add cells target for making wrappers
kwabenantim Nov 1, 2024
0d8f6af
#20 Update example tests
kwabenantim Nov 3, 2024
f7ecccb
#20 Fix conda testing
kwabenantim Nov 3, 2024
9ae603b
#20 Fix vtk conda test
kwabenantim Nov 3, 2024
1470175
#20 Allow conda activation in tests
kwabenantim Nov 3, 2024
2e8484f
#20 Set config paths for conda tests
kwabenantim Nov 3, 2024
254430a
#20 Fix conda test issues
kwabenantim Nov 3, 2024
c7172ff
#20 Fix cells cmake
kwabenantim Nov 3, 2024
e6e82c8
#20 Add conda recipe
kwabenantim Nov 4, 2024
7bff31e
#20 Rework cells example tests
kwabenantim Nov 5, 2024
1e82dc2
#20 Switch to scikit-build-core
kwabenantim Nov 6, 2024
659fca1
#20 Add conda variants for cells example
kwabenantim Nov 6, 2024
83d1b18
#20 Update conda build example for python 3.13
kwabenantim Nov 6, 2024
71ae425
#20 Remove missing conda-build for python 3.13 from CI
kwabenantim Nov 6, 2024
471b701
#20 Remove cells setup.py
kwabenantim Nov 7, 2024
5f507f7
#20 Add ublas typecaster to cells
kwabenantim Nov 7, 2024
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
3 changes: 2 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ exclude =
.git,
.github,
build,
cppwg/templates,
doc,
examples,
cppwg/templates,
_skbuild,
tests,
venv,

Expand Down
76 changes: 0 additions & 76 deletions .github/workflows/build-and-test.yml

This file was deleted.

91 changes: 91 additions & 0 deletions .github/workflows/test-cells-conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: test-cells-conda

on:
workflow_dispatch:
pull_request:
branches:
- "**"

jobs:
test-cells-conda:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

concurrency:
group: test-cells-conda-${{ github.ref }}-${{ matrix.python-version }}
cancel-in-progress: true

defaults:
run:
shell: bash -el {0} # -l needed to activate conda

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install cmake git

- name: Setup Miniconda Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
use-mamba: true
miniforge-version: latest
python-version: ${{ matrix.python-version }}
channels: conda-forge

- name: Install cppwg
run: |
python -m pip install --upgrade pip
python -m pip install .

- name: Install requirements
run: mamba install --yes --file conda/requirements.txt
working-directory: examples/cells

- name: Set config paths
run: |
echo "CMAKE_PREFIX_PATH=$CONDA_PREFIX;$CMAKE_PREFIX_PATH" >> $GITHUB_ENV
echo "PETSC_DIR=$CONDA_PREFIX" >> $GITHUB_ENV
echo "PETSC_ARCH=" >> $GITHUB_ENV
echo "VTK_DIR=$CONDA_PREFIX" >> $GITHUB_ENV

- name: Configure
run: |
mkdir build && cd build
cmake ..
working-directory: examples/cells

- name: Regenerate wrappers
run: |
rm -rf dynamic/wrappers
cd build
make pycells_wrappers
working-directory: examples/cells

- name: Check for changes
run: |
git diff --exit-code dynamic/wrappers
grep "Unknown class" build/cppwg.log
working-directory: examples/cells

- name: Install conda-build tools
run: mamba install boa conda-build conda-verify

- name: Build
run: conda mambabuild recipe -m variants/python${{ matrix.python-version }}.yaml
working-directory: examples/cells/conda

- name: Install
run: mamba install --use-local pycells

- name: Test
run: python -m unittest discover tests
working-directory: examples/cells
69 changes: 69 additions & 0 deletions .github/workflows/test-cells-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: test-cells-ubuntu

on:
workflow_dispatch:
pull_request:
branches:
- "**"

concurrency:
group: test-cells-ubuntu-${{ github.ref }}
cancel-in-progress: true

jobs:
test-cells-ubuntu:
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install \
cmake \
git \
libboost-all-dev \
libpetsc-real3.15 \
libpetsc-real3.15-dbg \
libpetsc-real3.15-dev \
libvtk9-dev \
mpi-default-bin \
mpi-default-dev \
python3-mpi4py \
python3-petsc4py-real3.15 \
python3-vtk9 \
vtk9

- name: Install cppwg
run: |
python -m pip install --upgrade pip
python -m pip install .

- name: Configure
run: |
mkdir build && cd build
cmake ..
working-directory: examples/cells

- name: Regenerate wrappers
run: |
rm -rf dynamic/wrappers
cd build
make pycells_wrappers
working-directory: examples/cells

- name: Check for changes
run: |
git diff --exit-code dynamic/wrappers
grep "Unknown class" build/cppwg.log
working-directory: examples/cells

- name: Build
run: python -m pip install -v .
working-directory: examples/cells

- name: Test
run: python -m unittest discover tests
working-directory: examples/cells
72 changes: 72 additions & 0 deletions .github/workflows/test-shapes-pip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: test-shapes-pip

on:
workflow_dispatch:
pull_request:
branches:
- "**"

jobs:
test-shapes-pip:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

concurrency:
group: test-shapes-pip-${{ github.ref }}-${{ matrix.python-version }}
cancel-in-progress: true

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install cmake git

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install cppwg
run: |
python -m pip install --upgrade pip
python -m pip install .

- name: Regenerate wrappers
run: |
rm -rf wrapper/*/
cppwg src/cpp \
--wrapper_root wrapper/ \
--package_info wrapper/package_info.yaml \
--includes src/cpp/*/ \
--std c++17 \
--logfile cppwg.log
working-directory: examples/shapes

- name: Check for changes
run: |
git diff --exit-code wrapper
grep "Unknown class" cppwg.log
working-directory: examples/shapes

- name: Configure
run: |
mkdir build && cd build
cmake ..
working-directory: examples/shapes

- name: Build
run: make -j $(nproc)
working-directory: examples/shapes/build

- name: Test
run: |
python -m unittest test_functions.py
python -m unittest test_classes.py
working-directory: examples/shapes/build
34 changes: 34 additions & 0 deletions .github/workflows/test-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: test-style

on:
workflow_dispatch:
pull_request:
branches:
- "**"

concurrency:
group: test-style-${{ github.ref }}
cancel-in-progress: true

jobs:
test-style:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update && \
sudo apt-get install cmake

- name: Install cppwg
run: |
python -m pip install --upgrade pip
python -m pip install .[dev]

- name: Lint
run: |
python -m flake8 --version
python -m flake8 .
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ __pycache__/
.Python
env/
build/
_skbuild/
develop-eggs/
dist/
downloads/
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
![build](https://github.com/Chaste/cppwg/actions/workflows/build-and-test.yml/badge.svg)
![pip](https://github.com/Chaste/cppwg/actions/workflows/test-shapes-pip.yml/badge.svg)
![ubuntu](https://github.com/Chaste/cppwg/actions/workflows/test-cells-ubuntu.yml/badge.svg)
![conda](https://github.com/Chaste/cppwg/actions/workflows/test-cells-conda.yml/badge.svg)

# cppwg

Expand Down Expand Up @@ -89,7 +91,7 @@ cd examples/shapes
cppwg src/cpp \
--wrapper_root wrapper \
--package_info wrapper/package_info.yaml \
--includes src/cpp/geometry src/cpp/math_funcs src/cpp/mesh src/cpp/primitives extern/meshgen
--includes src/cpp/geometry src/cpp/math_funcs src/cpp/mesh src/cpp/primitives
```

For the `Rectangle` class, this creates two files in
Expand Down
1 change: 0 additions & 1 deletion cppwg/info/base_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ def __init__(self, name: str, info_config: Optional[Dict[str, Any]] = None) -> N
"unsigned int": "Unsigned",
"Unsigned int": "Unsigned",
"unsigned": "Unsigned",
"double": "Double",
"std::vector": "Vector",
"std::pair": "Pair",
"std::map": "Map",
Expand Down
Loading
Loading