0

I have a Python C extension that contains header files in the include folder. I am currently trying to build wheels and a source distribution. Because wheels are pre-compiled, they don't need to contain header files but the sdist does. According to the Python docs, the following files are included in a sdist:

  1. all Python source files implied by the py_modules and packages options
  2. all C source files mentioned in the ext_modules or libraries options
  3. scripts identified by the scripts option See Installing Scripts.
  4. anything that looks like a test script: test/test*.py (currently, the Distutils don’t do anything with test scripts except include them in source distributions, but in the future there will be a standard for testing Python module distributions)
  5. Any of the standard README files (README, README.txt, or README.rst), setup.py (or whatever you called your setup script), and setup.cfg.
  6. all files that matches the package_data metadata. See Installing Package Data.
  7. all files that matches the data_files metadata. See Installing Additional Files.

These files are also included in the wheels as well. How can I add the header files to a sdist but not a wheel?

GreyHope
  • 102
  • 1
  • 11
  • 1
    Do you use `MANIFEST.in` and/or `package_data`? Use `MANIFEST.in` for sdist and `package_data` for wheels; avoid `include_package_data` to omit files listed in `MANIFEST.in` from wheels. – phd May 03 '22 at 13:58
  • I know that `package_data` is included in both wheel and sdist. Although I don't use `MANIFEST.in`, I thought that the files in `MANIFEST.in` were also included in a wheel. Is that correct? – GreyHope May 03 '22 at 14:04
  • 3
    Files in `MANIFEST.in` are included in wheels only if you use `include_package_data=True`. Otherwise they are only included in sdist. – phd May 03 '22 at 14:13
  • 1
    Maybe this helps: https://stackoverflow.com/a/58050701 or this: https://stackoverflow.com/a/54953494 -- But for C extensions, I would assume that everything is automatically handled by `ext_modules` anyway. – sinoroc May 03 '22 at 15:45

0 Answers0