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

[WIP] Add Python bindings to manif #179

Closed
wants to merge 67 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
3dcbf3a
fix == constness
artivis Dec 7, 2020
43d59ae
fix tan constants
artivis Dec 7, 2020
0048e59
wip python bindings
artivis Dec 7, 2020
ed78690
add bindings Rn & SE_2_3
artivis Dec 8, 2020
3d6e879
cosmetic
artivis Dec 8, 2020
995db64
CI install pybind11 & pytest
artivis Dec 8, 2020
b96f002
fix CMake
artivis Dec 8, 2020
7f09a44
rm python cache
artivis Dec 8, 2020
37bd450
isolate python tests
artivis Dec 11, 2020
99e55f3
add GHA CI python
artivis Dec 11, 2020
85a3d6f
fix pybind ci
artivis Dec 12, 2020
6f124b8
use EIGEN_DEFAULT_TO_ROW_MAJOR
artivis Dec 16, 2020
6a08872
more API bindings & more tests
artivis Dec 16, 2020
fcf73e3
fix Jac*Tan
artivis Dec 17, 2020
6a6418c
add more test and rename py pkg
artivis Dec 17, 2020
882ee05
some more tests
artivis Dec 17, 2020
2077ab5
add rjac/ljac
artivis Dec 17, 2020
3847589
fix act
artivis Dec 17, 2020
1c06463
uniformise a little arg naming
artivis Dec 19, 2020
ab9798a
lt::optional fix missing return value
artivis Jan 10, 2021
de15a30
add Eigen::Quaternion bindings
artivis Jan 10, 2021
9dfddbf
rename python tests for pytest
artivis Jan 10, 2021
64a730d
add a couple quaternion pytest
artivis Jan 10, 2021
93c5c22
add python packaging
artivis Jan 10, 2021
487dcbc
update readme for python installation
artivis Jan 10, 2021
a5061e5
add pytest.ini
artivis Jan 10, 2021
3f99f2b
plain python CI job
artivis Jan 10, 2021
fe0d59b
fixing python CI
artivis Jan 10, 2021
6311dfb
fixing python CI
artivis Jan 10, 2021
6b5b2f6
fixing python CI
artivis Jan 11, 2021
cf3d386
fixing python CI
artivis Jan 11, 2021
5e1acb1
CI on macOS too
artivis Jan 11, 2021
f2a1e37
fix QuaternionBase bindings
artivis Jan 11, 2021
d808409
fix quat.setId
artivis Jan 12, 2021
f27892c
add seN_localization.py
artivis Jan 13, 2021
1416eb9
some flake8 fixes
artivis Jan 14, 2021
75b484c
learning python the hard way
artivis Jan 15, 2021
828dd9e
bind SE3.translation()
artivis Jan 15, 2021
36fb571
add se2/3_sam.py
artivis Jan 15, 2021
a581deb
remove some useless cast
artivis Jan 17, 2021
6c55144
seed rand in examples
artivis Jan 17, 2021
f65c23c
readme update
artivis Jan 17, 2021
a4f232d
some more gitignore
artivis Jan 18, 2021
dd31ebb
fix
artivis Jan 18, 2021
1c4700d
add se3_sam_selfcalib.py
artivis Jan 23, 2021
285af77
add se_2_3_localization.py
artivis Jan 23, 2021
580dc7f
add some gitignore
artivis Jan 23, 2021
40e21ab
disable macos-11 in CI for now
artivis Jan 23, 2021
2af4d8f
bind tangent innerWeights
artivis Jan 23, 2021
bfebc32
ex: seed random gen & reduce noise
artivis Jan 23, 2021
d996595
rm eigen Quaternion bindings
artivis Jan 23, 2021
04a7cf1
update gitignore
artivis Jan 23, 2021
c448b1f
update README
artivis Jan 23, 2021
d8f2824
migrating wiki to doc
artivis Jan 23, 2021
c24d04c
doc -> docs
artivis Jan 23, 2021
7804f76
no more quat bindings
artivis Jan 24, 2021
8ba3972
reorganize bindings declaration
artivis Jan 24, 2021
249de02
no more quat bindings
artivis Jan 24, 2021
1791686
wip new doc website
artivis Jan 24, 2021
4170520
~private Python base classes & add documentation
artivis Jan 25, 2021
53aa9ec
wip doc website
artivis Jan 25, 2021
a236573
wip CI docs
artivis Jan 25, 2021
06575cc
wip doc website
artivis Jan 25, 2021
466c6c4
wip CI docs
artivis Jan 25, 2021
fe5d025
wip doc website
artivis Jan 26, 2021
de0c9ca
python test fixes
artivis Jan 26, 2021
a76ae35
wip doc website
artivis Jan 30, 2021
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
2 changes: 1 addition & 1 deletion .codedocs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
DOXYFILE=.doxygen.txt
DOXYFILE=docs/Doxyfile
41 changes: 40 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
- devel
workflow_dispatch:

env:
CTEST_OUTPUT_ON_FAILURE: 1

jobs:

build-ubuntu:
Expand Down Expand Up @@ -55,7 +58,9 @@ jobs:
strategy:
matrix:
# Xcode 10.3 & Xcode 12.2
os: [macos-10.15, macos-11.0]
# removing macos-11.0 for now, see
#https://github.com/actions/virtual-environments/issues/841
os: [macos-10.15]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -167,6 +172,40 @@ jobs:
working-directory: ${{runner.workspace}}/build
run: make test

pybind11:
needs: [build-ubuntu, build-mac]
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest] #windows-latest,
# python-version: [3.5, 3.6, 3.7, 3.8]
python-version: [3.6]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Setup apt
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y libeigen3-dev
- name: Setup brew
if: runner.os == 'macOS'
run: brew install eigen
- name: Setup
run: |
python -m pip install --upgrade pip
pip install pytest "pybind11[global]"
pip install -r requirements.txt
- name: Build
run: pip install .
- name: Test
run: pytest

# arm64:
# needs: [build-ubuntu]
# runs-on: ubuntu-latest
Expand Down
82 changes: 82 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: documentation
on:
push:
branches: devel
workflow_dispatch:

jobs:

# There is no way as of now to move artifacts around jobs and
# across workflows. So we build the Python bindings here too.
build:
runs-on: ubuntu-20.04
steps:

# Build manifpy

- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Setup apt
run: |
sudo apt update
sudo apt install -y libeigen3-dev
- name: Setup
run: |
python -m pip install --upgrade pip
pip install pytest "pybind11[global]"
pip install -r requirements.txt
- name: Build
run: pip install .

# build:
# runs-on: ubuntu-20.04
# needs: [pybind11]
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Set up Python
# uses: actions/setup-python@v2

# Build documentation website

- name: Fetch apt deps
run: |
sudo apt update
sudo apt install -y libeigen3-dev flex bison doxygen graphicsmagick-imagemagick-compat
- name: Fetch Python deps
run: python -m pip install jinja2 Pygments
- name: Fetch m.css
working-directory: ${{runner.workspace}}
run: git clone git://github.com/mosra/m.css

- name: Build Python docs
run: python3 ${{runner.workspace}}/m.css/documentation/python.py conf_python.py
- name: Build C++ docs
run: python3 ${{runner.workspace}}/m.css/documentation/doxygen.py conf_cpp.py
- name: Build site
run: python3 ${{runner.workspace}}/m.css/documentation/doxygen.py conf.py

- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: site
path: docs/site

deploy:
runs-on: ubuntu-20.04
needs: [build]
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: site
- name: Deploy
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: docs/site
13 changes: 11 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,14 @@
.settings
.tags
build
doc
doxygen_warnings.txt
docs/xml
docs/html
docs/site
docs/m.css
*doxygen_warnings.txt
*.cache
.vscode
*.egg-info
*.so
*__pycache__
.pytest_cache
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,26 @@ matrix:
- make -j2
- make test

#
# Python bindings
#
- os: linux
env:
- TEST="G++ 9"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- pybind11-dev
- python3-pytest
packages:
- gcc-9
- g++-9
script:
- cmake -DCMAKE_CXX_COMPILER="g++-9" -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=ON -DBUILD_PYTHON_BINDINGS=ON..
- make
- make test

allow_failures:
- os: linux
env:
Expand Down
16 changes: 15 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ endif()
find_package(Eigen3 QUIET)

if(NOT EIGEN3_FOUND)
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
find_package(Eigen3 REQUIRED)
endif()

Expand Down Expand Up @@ -54,6 +54,13 @@ endif()
option(BUILD_TESTING "Build all tests." OFF)
option(ENABLE_CPPCHECK "Enable cppcheck." OFF)
option(BUILD_EXAMPLES "Build all examples." OFF)
option(BUILD_PYTHON_BINDINGS "Build Python bindings with pybind11." OFF)
option(BUILD_TESTING_PYTHON "Build Python tests only." OFF)

if (BUILD_PYTHON_BINDINGS)
find_package(pybind11 REQUIRED)
add_subdirectory(python)
endif()

###########
## Build ##
Expand Down Expand Up @@ -263,3 +270,10 @@ if(BUILD_TESTING)
add_subdirectory(test)

endif(BUILD_TESTING)

if(BUILD_PYTHON_BINDINGS AND (BUILD_TESTING OR BUILD_TESTING_PYTHON))

enable_testing()
add_subdirectory(test/python)

endif()
73 changes: 73 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Contributing

## General guidelines

**manif** is developed according to Vincent Driessen's [Gitflow Workflow][git-workflow].
This means,

- the `master` branch is for releases only.
- development is done on feature branches.
- finished features are integrated via PullRequests into the branch `devel`.

For a PullRequest to get merged into `devel`, it must pass

- Review by one of the maintainers.
- Are the changes introduced in scope of **manif**?
- Is the documentation updated?
- Are enough reasonable tests added?
- Will these changes break the API?
- Do the new changes follow the current style of naming?
- Compile / Test / Run on all target environments.

Note: The test suite detailed below is run in CI for many targets environments including,

- Ubuntu 16.04/18.04/20.04
- MacOS 10.15
- Visual Studio 15

## Development environment

We will detail here how to set up a development environment.
It is recommended to use containers if you do not want to install the dependencies on your host.
You may refer to [this blog post](lxd-post) to set up a LXD container.

First let us clone the **manif** repo,

```terminal
git clone https://github.com/artivis/manif.git
cd manif
```

Let's install all dependencies for development and testing,

```terminal
apt install libeigen3-dev
python3 -m pip install "pybind11[global]" pytest
python3 -m pip install -r requirements
```

We can now build **manif**, its Python wrappers and all tests,

```terminal
mkdir build && cd build
cmake -DBUILD_TESTING=ON -DBUILD_EXAMPLES=ON -DBUILD_PYTHON_BINDINGS=ON -DBUILD_EXAMPLES=ON ..
make
```

To run the C++ tests execute the following,

```terminal
ctest --output-on-failure
```

To run the Python tests,

```terminal
cd manif
pytest
```

[//]: # (URLs)

[git-workflow]: http://nvie.com/posts/a-successful-git-branching-model
[lxd-post]: https://artivis.github.io/post/2020/lxc
Loading