Packaging a python library with C++ distutils extension?

I’m trying to package the ffcv python library. I have a draft PR that almost works. It’s just getting hung up trying to import the C++ extension in tests:

E   ModuleNotFoundError: No module named 'ffcv._libffcv'

Does anyone have any idea what could be going on here? Why isn’t the extension automatically included in PYTHONPATH?

Two updates:

  • It seems to work perfectly fine if I just skip the test suite, so there’s some divergence between the test environment and the built package.
  • The built .so appears to live in build/lib.linux-x86_64-3.9/ffcv/ Why is that not in PYTHONPATH when running tests?

I would assume that during the tests all the modules are found through . (i.e. nobody’s adding anything special to PYTHONPATH)?

That seems to be the case… But I figured that using distutils would be common enough that it would be handled by buildPythonPackage