Skip to content

Commit 7b9928d

Browse files
committed
Merging 'master' into 'wrap'
2 parents 17842dc + 4c410fc commit 7b9928d

37 files changed

+1267
-1539
lines changed

wrap/.github/workflows/linux-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
13+
python-version: [3.6, 3.7, 3.8, 3.9]
1414

1515
steps:
1616
- name: Checkout

wrap/.github/workflows/macos-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
13+
python-version: [3.6, 3.7, 3.8, 3.9]
1414

1515
steps:
1616
- name: Checkout

wrap/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ __pycache__/
88
# Files related to code coverage stats
99
**/.coverage
1010

11-
gtwrap/matlab_wrapper.tpl
11+
gtwrap/matlab_wrapper/matlab_wrapper.tpl

wrap/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ if(NOT DEFINED GTWRAP_INCLUDE_NAME)
5858
endif()
5959

6060
configure_file(${PROJECT_SOURCE_DIR}/templates/matlab_wrapper.tpl.in
61-
${PROJECT_SOURCE_DIR}/gtwrap/matlab_wrapper.tpl)
61+
${PROJECT_SOURCE_DIR}/gtwrap/matlab_wrapper/matlab_wrapper.tpl)
6262

6363
# Install the gtwrap python package as a directory so it can be found by CMake
6464
# for wrapping.

wrap/DOCS.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,14 @@ The python wrapper supports keyword arguments for functions/methods. Hence, the
192192

193193
- **DO NOT** re-define an overriden function already declared in the external (forward-declared) base class. This will cause an ambiguity problem in the Pybind header file.
194194

195+
- Splitting wrapper over multiple files
196+
- The Pybind11 wrapper supports splitting the wrapping code over multiple files.
197+
- To be able to use classes from another module, simply import the C++ header file in that wrapper file.
198+
- Unfortunately, this means that aliases can no longer be used.
199+
- Similarly, there can be multiple `preamble.h` and `specializations.h` files. Each of these should match the module file name.
195200

196201
### TODO
197-
- Default values for arguments.
198-
- WORKAROUND: make multiple versions of the same function for different configurations of default arguments.
199202
- Handle `gtsam::Rot3M` conversions to quaternions.
200203
- Parse return of const ref arguments.
201204
- Parse `std::string` variants and convert directly to special string.
202-
- Add enum support.
203205
- Add generalized serialization support via `boost.serialization` with hooks to MATLAB save/load.

wrap/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ Using `wrap` in your project is straightforward from here. In your `CMakeLists.t
2929
```cmake
3030
find_package(gtwrap)
3131
32+
set(interface_files ${PROJECT_SOURCE_DIR}/cpp/${PROJECT_NAME}.h)
33+
3234
pybind_wrap(${PROJECT_NAME}_py # target
33-
${PROJECT_SOURCE_DIR}/cpp/${PROJECT_NAME}.h # interface header file
35+
"${interface_files}" # list of interface header files
3436
"${PROJECT_NAME}.cpp" # the generated cpp
3537
"${PROJECT_NAME}" # module_name
3638
"${PROJECT_MODULE_NAME}" # top namespace in the cpp file e.g. gtsam

wrap/gtwrap/interface_parser/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import sys
1414

15-
import pyparsing
15+
import pyparsing # type: ignore
1616

1717
from .classes import *
1818
from .declaration import *

wrap/gtwrap/interface_parser/classes.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from typing import Iterable, List, Union
1414

15-
from pyparsing import Literal, Optional, ZeroOrMore
15+
from pyparsing import Literal, Optional, ZeroOrMore # type: ignore
1616

1717
from .enum import Enum
1818
from .function import ArgumentList, ReturnType
@@ -233,7 +233,7 @@ def __init__(self,
233233
self.static_methods = []
234234
self.properties = []
235235
self.operators = []
236-
self.enums = []
236+
self.enums: List[Enum] = []
237237
for m in members:
238238
if isinstance(m, Constructor):
239239
self.ctors.append(m)
@@ -274,7 +274,7 @@ def __init__(self,
274274

275275
def __init__(
276276
self,
277-
template: Template,
277+
template: Union[Template, None],
278278
is_virtual: str,
279279
name: str,
280280
parent_class: list,
@@ -292,16 +292,16 @@ def __init__(
292292
if parent_class:
293293
# If it is in an iterable, extract the parent class.
294294
if isinstance(parent_class, Iterable):
295-
parent_class = parent_class[0]
295+
parent_class = parent_class[0] # type: ignore
296296

297297
# If the base class is a TemplatedType,
298298
# we want the instantiated Typename
299299
if isinstance(parent_class, TemplatedType):
300-
parent_class = parent_class.typename
300+
parent_class = parent_class.typename # type: ignore
301301

302302
self.parent_class = parent_class
303303
else:
304-
self.parent_class = ''
304+
self.parent_class = '' # type: ignore
305305

306306
self.ctors = ctors
307307
self.methods = methods

wrap/gtwrap/interface_parser/declaration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Author: Duy Nguyen Ta, Fan Jiang, Matthew Sklar, Varun Agrawal, and Frank Dellaert
1111
"""
1212

13-
from pyparsing import CharsNotIn, Optional
13+
from pyparsing import CharsNotIn, Optional # type: ignore
1414

1515
from .tokens import (CLASS, COLON, INCLUDE, LOPBRACK, ROPBRACK, SEMI_COLON,
1616
VIRTUAL)

wrap/gtwrap/interface_parser/enum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Author: Varun Agrawal
1111
"""
1212

13-
from pyparsing import delimitedList
13+
from pyparsing import delimitedList # type: ignore
1414

1515
from .tokens import ENUM, IDENT, LBRACE, RBRACE, SEMI_COLON
1616
from .type import Typename

0 commit comments

Comments
 (0)