apache / pulsar-client-python

Apache Pulsar Python client library
https://pulsar.apache.org/
Apache License 2.0
50 stars 42 forks source link

Migrate from Boost.Python to PyBind11 #54

Closed BewareMyPower closed 1 year ago

BewareMyPower commented 1 year ago

Fixes https://github.com/apache/pulsar-client-python/issues/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 commented 1 year ago

@merlimat @RobertIndie @Demogorgon314 PTAL.

jaysonsantos commented 1 year ago

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 commented 1 year ago

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

BewareMyPower commented 1 year ago

@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.