Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork0
License
chdb-io/mrbind-pybind11
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This is a fork ofpybind11 that builds stable-ABI Python modules
— i.e. the resulting modules can run on multiple different Python versions.
Yes, sort of! While it still has rough edges, weare using it in production.
The version-dependent code was moved to a tiny shared library. You must build a copy of it for each Python version you want to support (3.8, 3.9, etc), and ship all those with your module.
This isn't header-only unlike the upstream Pybind. You must build thepybind11nonlimitedapi_stubs shared library and link your code against it.
Link againstpython3.lib on Windows (as opposed to a version-specificpython3??.lib). On Mac, pass-Xlinker -undefined -Xlinker dynamic_lookup and don't link Python at all (same as you would normally do with upstream Pybind). On Linux don't link Python at all (undefined references are not checked during library linking).
You must also build Npybind11nonlimitedapi_MyLib_3.?? shared libraries, for each Python version you want to support (3.8, 3.9, etc), and distribute them as a part of your wheel. The correct library is selected at runtime.
ReplaceMyLib with the name of your library, using-DPYBIND11_NONLIMITEDAPI_SUFFIX=MyLib CMake flag. Since those libraries are not renamed when building a wheel, we must ensure the name is unique to avoid conflicts between different modules using this library.
Your own code needs be built with-DPy_LIMITED_API=0x030800f0 (or any other value) and-DPYBIND11_NONLIMITEDAPI_LIB_SUFFIX_FOR_MODULE=MyLib (this must match the shim library naming, see above).
Then thepybind11nonlimitedapi_MyLib_3.?? libraries must be distributed in the same directory as the.pyd/.so modules (or you can setPYBIND11_NONLIMITEDAPI_SHIM_PATHS_RELATIVE_TO_LIBRARY_DIR macro to a path relative to the modules, see that macro definition for details).
When baking the modules into a wheel, thepybind11nonlimitedapi_MyLib_3.?? libraries must stay in the same directory as the modules. They don't get their names mangled.
If you usedelvewheel on Windows, don't forget to add--analyze-existing to process thepybind11nonlimitedapi_MyLib_3.?? libraries too.
About
Resources
License
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Languages
- C++70.2%
- Python23.3%
- CMake6.1%
- Other0.4%