[Python-Dev] On breaking modules into packages Was: [issue10199] Move Demo/turtle under Lib/ (original) (raw)

Benjamin Peterson benjamin at python.org
Wed Nov 3 00:08:51 CET 2010


2010/11/2 Raymond Hettinger <raymond.hettinger at gmail.com>:

On Nov 1, 2010, at 7:35 PM, Brett Cannon wrote:

I think the issue here is that the file structure of the code no longer matches the public API documented by unittest. Personally I, like most people it seems, prefer source files to be structured in a way to match the public API. In the case of unittest Michael didn't. He did ask python-dev if it was okay to do what he did, we all kept quiet, and now we have realized that most of us prefer to have files that mirror the API; lesson learned. But Python 2.7 shipped with this file layout so we have to stick with it lest we break any imports out there that use the package-like file structure Michael went with (which we could actually document and use if we wanted now that Michael has already broken things up). Reversing the trend by sticking all the code into unittest/init.py and then sticking import shims into the existing modules would be a stupid waste of time, especially considering the head maintainer of the package likes it the way it is. I'm not sure I follow where we're stuck with the current package. AFAICT, the module is still used with "import unittest". The file splitting was done badly, so I don't think there any of the components are usable directly, i.e. "from unitest.case import SkipTest". Also, I don't think the package structure was documented or announced. This is in contrast to the logging module which does have a clean separation of components and where it isn't unusual to import just part of the package.

See http://docs.python.org/whatsnew/2.7.html#updated-module-unittest

-- Regards, Benjamin



More information about the Python-Dev mailing list