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

Donald Stufft donald at stufft.io
Mon Jan 19 02:18:52 CET 2015

> On Jan 18, 2015, at 8:01 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On 19 January 2015 at 06:35, Ben Finney <ben+python at benfinney.id.au> wrote:
>> Donald Stufft <donald at stufft.io> writes:
>>>> On Jan 17, 2015, at 7:47 PM, Ben Finney <ben+python at benfinney.id.au> wrote:
>>>> 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?
>>> setup_requires?
>> Did you want to say anything else about that, for instance, how it
>> applies to the question or what specifically you suggest I do?
>> As it stands, I can only quote the documentation:
>>    setup_requires
>>    A string or list of strings specifying what other distributions need
>>    to be present in order for the setup script to run. […]
>>    <URL:https://setuptools.pypa.io/en/latest/setuptools.html>
>> The module in question is part of the same code base, and is not an
>> “other distribution”. So I don't know why you suggest this option.
> If you have a build/install time only dependency that you want to
> distribute, you *have* to separate it out into a separate component if
> you don't want it to also be present at runtime. We do not, and will
> not, support selective installation of subcomponents, as it's too hard
> to audit later. Instead, such components need to be separated out into
> distinct packages so that the segmentation of functionality and
> availability is clear to both the automated tools and to other humans.
> "Extras" work the same way - they select whether or not to install
> optional *dependencies*, but deliberately can't be used to selectively
> install pieces of the package itself (the affected subcomponents are
> instead expected to do runtime checks to see if the optional
> dependencies are present and provide a useful error message if they're
> missing).

I’m confused what this actually is.

If it’s just a file you don’t want installed… then don’t specify it in your
setup.py’s setup() function in either the py_modules or the packages keyword.

Donald Stufft
PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

More information about the Distutils-SIG mailing list