Skip to content

Migrate from Boost.Python to PyBind11 #54

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

Merged
merged 3 commits into from
Nov 29, 2022

Conversation

BewareMyPower
Copy link
Contributor

Fixes #24

Motivation

Remove the Boost.Python dependency so that on Windows there will be no DLL dependencies because PyBind11 is header only.

Modifications

Since PyBind11 can perform type conversions between C++ types (STL, function, etc.) and Python types (list, dict, lambda, etc.), some wrapper classes are replaced with the classes in the Pulsar C++ library.

The only API changes are related to the _pulsar module, which should not be used directly. The authentication related classes were wrapper classes with constructors before, now they are created by the static create methods from Pulsar C++ API.

Fix the CMakeLists.txt and the workflows to build Python wheels on Linux, macOS and Windows. Finally add a workflow to build Windows wheels during a release.

Fixes apache#24

### Motivation

Remove the Boost.Python dependency so that on Windows there will be no
DLL dependencies because PyBind11 is header only.

### Modifications

Since PyBind11 can perform type conversions between C++ types (STL,
function, etc.) and Python types (list, dict, lambda, etc.), some
wrapper classes are replaced with the classes in the Pulsar C++ library.

The only API changes are related to the `_pulsar` module, which should
not be used directly. The authentication related classes were wrapper
classes with constructors before, now they are created by the static
`create` methods from Pulsar C++ API.

Fix the CMakeLists.txt and the workflows to build Python wheels on
Linux, macOS and Windows. Finally add a workflow to build Windows wheels
during a release.
@BewareMyPower
Copy link
Contributor Author

@merlimat @RobertIndie @Demogorgon314 PTAL.

@BewareMyPower BewareMyPower merged commit c69cf1f into apache:main Nov 29, 2022
@jaysonsantos
Copy link
Contributor

This seems to have been a good solution, the previous version would break if you had any code that used opentelemetry-instrument's automatic instrumentation and with a build from master using pybind11 fixes this kind of issue.
👏

@jaysonsantos
Copy link
Contributor

Any chance we get an alpha version of this in pypi? Or is it better to upload to private repositories?

@BewareMyPower BewareMyPower deleted the bewaremypower/pybind branch December 2, 2022 17:11
@BewareMyPower
Copy link
Contributor Author

@jaysonsantos The official release will start soon. Just waiting for the latest C++ client release because it has Windows artifacts now. You can try these wheels built in my local repo with the same commit id with the current master.

@BewareMyPower BewareMyPower added this to the 3.0.0 milestone Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature] Use pybind11 to eliminate the Boost.Python
3 participants