Packaging a Python library with a small C dependency —

Posted by Emergency-Rough-6372@reddit | Python | View on Reddit | 45 comments

how do you handle install reliability?

Title: Packaging a Python library with a small C dependency — how do you handle install reliability?

Hey folks,

I’ve run into a bit of a packaging dilemma and wanted to get some opinions from people who’ve dealt with similar situations.

I’m working on a Python library that includes a vendored C component. Nothing huge, but it does need to be compiled into a shared object (.so / .pyd) during installation. Now I’m trying to figure out the cleanest way to ship this without making installation painful for users.

Here’s where I’m stuck:

There is a fallback option I’ve considered:

But the issue is that the C component doesn’t really have a true Python equivalent — the fallback would be a weaker, approximation-based approach (probably regex-based), which feels like a compromise in correctness/security.

So I’m trying to balance:

Questions:

  1. In 2026, is it basically expected to ship prebuilt wheels for all major platforms if you include any C code?
  2. Would you accept a degraded Python fallback, or just fail hard if the extension doesn’t compile?
  3. Any strong opinions on cffi vs ctypes for this kind of use case?
  4. How much effort is “normal” to invest in multi-platform wheel builds for a small but critical C dependency?

Would love to hear how others approach this tradeoff in real-world libraries.

Thanks!