Search code examples
pythonpackagingsetup.py

Proper Python packaging with external package dependencies


Let's suppose I have a project that depends on packages that should only be installed via the systems package manager (e.g. bindings to C libraries), so that install_requires is not working.

Currently, I try to import said packages in setup.py and call sys.exit() with a positive exit code if the import fails. Is this good practice or are there better ways to accomplish this?


Solution

  • You can create native system packages (deb, rpm, etc.) and describe the dependencies in it (which are the C libraries in your case). You can check the Debian packages packing manual (or packages for some other manager, depending on the system you're using).