Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

License

NotificationsYou must be signed in to change notification settings

chdb-io/mrbind-pybind11

 
 

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.

Is this production ready?

Yes, sort of! While it still has rough edges, weare using it in production.

How does it work?

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.

How to use?

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

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages

  • C++70.2%
  • Python23.3%
  • CMake6.1%
  • Other0.4%

[8]ページ先頭

©2009-2025 Movatter.jp