[Distutils] Python module for use in ‘setup.py’ but not to install

Ben Finney ben+python at benfinney.id.au
Sun Jan 18 01:47:11 CET 2015

Howdy all,

How can I specify to Distutils (Setuptools) that module ‘foo’ needs to
be available for use by ‘setup.py’, but should not be installed with the
binary distribution?

In the ‘python-daemon’ distribution, I have refactored a bunch of
functionality to a separate top-level module (‘version’). That module is
required to perform Setuptools actions – the ‘egg_info.writers’ entry
point specifically – but is not needed at all by the resulting
installation and should not be installed.

So it's not clear how to specify this dependency. I have a
‘packages=find_packages(exclude=["test"])’ specification; but that
module isn't a package and so should not (?) be collected. I have the
file included in ‘MANIFEST.in’; but that only specifies what to include
in the source distribution, and should not add any files to the binary.

As it stands (‘python-daemon’ [0] version 2.0.3), the ‘version.py’ file
is correctly included in the source distribution, correctly used by the
‘egg_info.writers’ entry point; but then ends up incorrectly installed
to the run-time packages library. This causes problems for subsequent
import of unrelated modules that happen to share the same name.

How can I specify to Setuptools that the file is needed in the source
distribution, is needed by the entry points for Setuptools, but should
not be installed along with the binary distribution?

[0] <URL:https://pypi.python.org/pypi/python-daemon/>; version 2.0.3 at

 \          “The entertainment industry calls DRM "security" software, |
  `\         because it makes them secure from their customers.” —Cory |
_o__)                                             Doctorow, 2014-02-05 |
Ben Finney

More information about the Distutils-SIG mailing list