Creating "missing" files is wrong

Create issue
Issue #194 new
Fred Drake created an issue

When installing zope.testrunner using zc.buildout with distribute 0.6.15, I noticed this surprising message in the output:

{{{ Getting distribution for 'zope.testrunner'. package init file 'src/zope/testrunner/testrunner-ex/' not found (or not a regular file) Creating missing for zope.testrunner.testrunner-ex Got zope.testrunner 4.0.3. }}}

This is a wrong thing to do. The fact that there's a hyphen in the supposed package name makes that a little more obvious, and may be why I noticed it this time, but it's wrong for distribute to determine for me that a directory nested inside a package is a package as well, even if it includes .py files.

Python determines that a directory is a package based on the presence of the file; if the developer didn't put one there, he shouldn't expect that directory to be treated as code. In a case like this, the directory most likely contains data, either to be loaded by the code during operation, or during tests. Adding that file during installation means that the directory is likely to be handled differently during development/testing and production use. Though it's unlikely to be a serious practical problem, when it is a problem it will be difficult to diagnose ("expensive").

Comments (4)

  1. Zooko O'Whielacronx

    The Twisted plugin mechanism relies on a directory named "twisted/plugin/" which contains .py files but does not contain a file. If you add an file to it, this would break the plugin finder mechanism.

  2. Tarek Ziadé repo owner

    Agreed, we should remove this behavior. I don't think this change would be harmful for the existing projects

  3. Former user Account Deleted
  4. Log in to comment