-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
[GSoC 2020] Extending PCL for use with Python: Bindings generation using Pybind11 #4366
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
base: master
Are you sure you want to change the base?
Conversation
- add type bounds - comments - named args
`generate.py` changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mark as default till other issues are cleared on your fork?
- name: Format with black | ||
run: | | ||
cd bindings/python | ||
black . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we run black on .dev/scripts too?
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.8" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? Can we have something like "latest" so we don't need to update the version?
@@ -0,0 +1,52 @@ | |||
name: Black Formatting | |||
|
|||
on: [push] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restrict to directories with python files
> | ||
> Here, cloud needs to be a shared_ptr. That can be done in 2 ways | ||
> 1. `cloud = pcl.PointCloud[pcl.PointXYZ]()` and the holder class as shared_ptr | ||
> 2. `cloud = pcl.make_shared[pcl.PointXYZ]()` and holder class as void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cloud = pcl.make_shared[pcl.PointCloud[pcl.PointXYZ]]()
> | ||
> Here, cloud needs to be a shared_ptr. That can be done in 2 ways | ||
> 1. `cloud = pcl.PointCloud[pcl.PointXYZ]()` and the holder class as shared_ptr | ||
> 2. `cloud = pcl.make_shared[pcl.PointXYZ]()` and holder class as void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void
and shared_ptr
(back tick the classes)
@@ -0,0 +1,158 @@ | |||
## Python bindings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this file be included in the PR as is or modified?
bindings/python/README.md
Outdated
``` | ||
|
||
### json/* | ||
- JSON o/p generated by `libclang.py` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
o/p?
bindings/python/README.md
Outdated
- JSON o/p generated by `libclang.py` | ||
|
||
### pybind11/* | ||
- pybind11 cpp o/p generated by `generate_bindings.py` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
o/p?
echo 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main' | sudo tee -a /etc/apt/sources.list | ||
echo 'deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main' | sudo tee -a /etc/apt/sources.list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kunaltyagi can/should these two bionic
references be extrapolated to an outer scope/file now that we're merging with master?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace the name with lsb_release -cs
and install lsb-release
via apt
Class containing functions for generating bindings from AST info. | ||
|
||
How to use: | ||
- to_be_filled_after_updation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean after this merge or even later?
Co-authored-by: aPonza <[email protected]>
|
||
|
||
""" | ||
TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use sphinx supported semantics:
https://www.sphinx-doc.org/en/master/usage/extensions/todo.html
Also, add all TODOs as issues on PCL too (1 per area of interest)
assert delete_constructor["kind"] == "CONSTRUCTOR" | ||
assert delete_constructor["name"] == "aClass" | ||
assert delete_constructor["result_type"] == "void" | ||
# no check available for deleted ctor analogous to `is_default_constructor` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO:
Add test for template instantiation parsing since that's bread and butter for PCL bindings
else: | ||
args = None | ||
|
||
args = parser.parse_args() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use parse_known_args()
in order to compose together several parsers
output_filepath = utils.get_output_path( | ||
source=source, | ||
output_dir=utils.join_path(args.json_output_path, "json"), | ||
split_from="pcl", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
split_from
is another user input. This is technically base_path or something similar
- args: Parsed command line arguments | ||
""" | ||
|
||
if script == "parse": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use add_subparsers
feature of argparse
|
||
### pybind11/* | ||
- pybind11 cpp o/p generated by `generate_bindings.py` | ||
- pybind11 C++ outupt generated by `generate_bindings.py` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo?
How is the state of this PR? The whole projects sounds amazing and looking at the commits it's looks quite promising. Based on the proposed timeline it should be close to completion? I'm starting a new project and wanted to use PCL. I thought I have to use C++, but looking at this, this looks like it could be the first Python binding that works. |
Glad you like this :) Regarding usability: This is a WIP. There are some upstream clang issues (clang doesn't parse You're welcome to contribute to this to make it better, faster 😄 PS: This is product of an awesome GSoC project by @divmadan. |
Thank you for the quick answer. Based on this I think I will have to go ahead with C++. Sadly my knowledge in the area of writing and getting bindings to work is non existent and I don't think I will get time to work on that. |
Marking this as stale due to 30 days of inactivity. Commenting or adding a new commit to the pull request will revert this. |
Is this complete? or are there any works left? |
same question here, should this issue be closed by PointCloudLibrary/clang-bind#1 ? |
Is this still ongoing? 2 years already? |
PR for the project "Extending PCL for use with Python: Bindings generation using Pybind11" during GSoC 2020.