Skip to content

fix(python): fix OSS Cython bindings build for Linux and macOS#2629

Open
Ade20boss wants to merge 1 commit intofacebook:mainfrom
Ade20boss:fix-python-bindings-setup
Open

fix(python): fix OSS Cython bindings build for Linux and macOS#2629
Ade20boss wants to merge 1 commit intofacebook:mainfrom
Ade20boss:fix-python-bindings-setup

Conversation

@Ade20boss
Copy link
Copy Markdown

Fix OSS CMake build for Python/Cython bindings

Fixes #1703

Summary

The folly/python/setup.py was incomplete, causing the OSS CMake build to fail when -DPYTHON_EXTENSIONS=ON is set. This fix brings the setup in line with what is required to successfully build and import the Cython bindings on both Linux and macOS.

Changes

  • Added platform-aware library_dirs for Linux and macOS (Apple Silicon homebrew path)
  • Added CMAKE_PREFIX_PATH support so the linker finds libraries built by folly's own build system, not just system paths
  • Added missing library dependencies: fmt, double-conversion
  • Added libunwind for Linux only — guarded with sys.platform != 'darwin' since it is not available on macOS
  • Added the missing folly.fiber_manager extension
  • Added missing source files: executor_intf.cpp, iobuf_intf.cpp, error.cpp
  • Added include_dirs so Cython-generated code can locate folly headers
  • Added -std=c++20 compile flag, required for coroutines used in folly
  • Added *.pyi to package_data so type stubs are included in the install

Testing

Tested on Fedora Workstation. Additional testing was based on the investigation carried out in #1703 by @gmarzot and @novitae across Ubuntu 22.04 and macOS (Apple Silicon).

Notes

This work builds on investigation done in #1703 by @gmarzot and @novitae. The folly/python/test/ directory still needs a setup.py and test runner — that can be addressed in a follow-up.

@meta-cla
Copy link
Copy Markdown

meta-cla bot commented Apr 9, 2026

Hi @Ade20boss!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla meta-cla bot added the CLA Signed label Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

folly/python/executor_api.h No such file or directory

1 participant