Skip to content

[feature] Use pybind11 to eliminate the Boost.Python #24

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

Closed
BewareMyPower opened this issue Oct 27, 2022 · 2 comments · Fixed by #54
Closed

[feature] Use pybind11 to eliminate the Boost.Python #24

BewareMyPower opened this issue Oct 27, 2022 · 2 comments · Fixed by #54
Assignees

Comments

@BewareMyPower
Copy link
Contributor

See https://github.com/pybind/pybind11#readme

The main issue with Boost.Python—and the reason for creating such a similar project—is Boost. Boost is an enormously large and complex suite of utility libraries that works with almost every C++ compiler in existence. This compatibility has its cost: arcane template tricks and workarounds are necessary to support the oldest and buggiest of compiler specimens. Now that C++11-compatible compilers are widely available, this heavy machinery has become an excessively large and unnecessary dependency.

@merlimat
Copy link
Contributor

Main reason why it was not initially used was to support C++ 98, though Pulsar C++ client has since switched to C++ 11 and there's no more a reason not to use it.

@BewareMyPower BewareMyPower self-assigned this Oct 29, 2022
BewareMyPower added a commit to BewareMyPower/pulsar-client-python that referenced this issue Nov 1, 2022
Fixes apache#7

The Python client cannot be built with MSVC.

CMakeLists.txt:
1. Boost.Python cannot be found on Windows. The component of Boost
   cannot be `python3`. It should be a specific version like
   `python310`. Therefore, find all possible components from 3.10 to 3.7
   until the first component is available.
2. For MSVC, link to `pulsarWithDeps.lib` when `LINK_STATIC` is `ON` and
   set the `MSVC_RUNTIME_LIBRARY` target property to `MultiThreaded`.
3. Change the suffix from `.so` to `.pyd` because Python on Windows
   recognizes `*.pyd` as the dynamic library.
4. Link to Python library with MSVC, otherwise the symbos cannot be
   found when linking `boost-python`.

README: tell users how to build Python client on Windows.

Add a workflow to build Python wheels of versions 3.7 to 3.10 on Windows
and verify the build will succeed.

With this PR, Windows users still need to put the related
`boost_python*.dll` under the system path. In future, the `boost-python`
dependency will be removed. See
apache#24.
BewareMyPower added a commit to BewareMyPower/pulsar-client-python that referenced this issue Nov 1, 2022
Fixes apache#7

The Python client cannot be built with MSVC.

CMakeLists.txt:
1. Boost.Python cannot be found on Windows. The component of Boost
   cannot be `python3`. It should be a specific version like
   `python310`. Therefore, find all possible components from 3.10 to 3.7
   until the first component is available.
2. For MSVC, link to `pulsarWithDeps.lib` when `LINK_STATIC` is `ON` and
   set the `MSVC_RUNTIME_LIBRARY` target property to `MultiThreaded`.
3. Change the suffix from `.so` to `.pyd` because Python on Windows
   recognizes `*.pyd` as the dynamic library.
4. Link to Python library with MSVC, otherwise the symbos cannot be
   found when linking `boost-python`.

README: tell users how to build Python client on Windows.

Add a workflow to build Python wheels of versions 3.7 to 3.10 on Windows
and verify the build will succeed.

With this PR, Windows users still need to put the related
`boost_python*.dll` under the system path. In future, the `boost-python`
dependency will be removed. See
apache#24.
BewareMyPower added a commit to BewareMyPower/pulsar-client-python that referenced this issue Nov 1, 2022
Fixes apache#7

The Python client cannot be built with MSVC.

CMakeLists.txt:
1. Boost.Python cannot be found on Windows. The component of Boost
   cannot be `python3`. It should be a specific version like
   `python310`. Therefore, find all possible components from 3.10 to 3.7
   until the first component is available.
2. For MSVC, link to `pulsarWithDeps.lib` when `LINK_STATIC` is `ON` and
   set the `MSVC_RUNTIME_LIBRARY` target property to `MultiThreaded`.
3. Change the suffix from `.so` to `.pyd` because Python on Windows
   recognizes `*.pyd` as the dynamic library.
4. Link to Python library with MSVC, otherwise the symbos cannot be
   found when linking `boost-python`.

README: tell users how to build Python client on Windows.

Add a workflow to build Python wheels of versions 3.7 to 3.10 on Windows
and verify the build will succeed.

With this PR, Windows users still need to put the related
`boost_python*.dll` under the system path. In future, the `boost-python`
dependency will be removed. See
apache#24.
merlimat pushed a commit that referenced this issue Nov 2, 2022
Fixes #7

The Python client cannot be built with MSVC.

CMakeLists.txt:
1. Boost.Python cannot be found on Windows. The component of Boost
   cannot be `python3`. It should be a specific version like
   `python310`. Therefore, find all possible components from 3.10 to 3.7
   until the first component is available.
2. For MSVC, link to `pulsarWithDeps.lib` when `LINK_STATIC` is `ON` and
   set the `MSVC_RUNTIME_LIBRARY` target property to `MultiThreaded`.
3. Change the suffix from `.so` to `.pyd` because Python on Windows
   recognizes `*.pyd` as the dynamic library.
4. Link to Python library with MSVC, otherwise the symbos cannot be
   found when linking `boost-python`.

README: tell users how to build Python client on Windows.

Add a workflow to build Python wheels of versions 3.7 to 3.10 on Windows
and verify the build will succeed.

With this PR, Windows users still need to put the related
`boost_python*.dll` under the system path. In future, the `boost-python`
dependency will be removed. See
#24.
BewareMyPower added a commit to BewareMyPower/pulsar-client-python that referenced this issue Nov 23, 2022
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 added a commit to BewareMyPower/pulsar-client-python that referenced this issue Nov 23, 2022
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 added a commit to BewareMyPower/pulsar-client-python that referenced this issue Nov 23, 2022
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 added a commit to BewareMyPower/pulsar-client-python that referenced this issue Nov 23, 2022
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 added a commit that referenced this issue Nov 29, 2022
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.
@tisonkun
Copy link
Member

Cheers!

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 a pull request may close this issue.

3 participants