[TIP] Single source bilingual namespace packages with dependencies

Barry Warsaw barry at python.org
Thu Feb 9 10:41:16 PST 2017


Thanks Marius, I've subscribed to the issues mentioned below, and it sure
seems like they are related to what I'm seeing.  There's something funky going
on with namespace packages and test runners.

On Feb 09, 2017, at 07:38 PM, Marius Gedminas wrote:

>Note that we already have a src/ subdirectory, but the test runner
>(which is part of setuptools in this case -- the setup.py test
>subcommand) helpfully inserts it to the front of sys.path anyway.

That's also interesting because my package was originally using `python
setup.py test` and while changing it to `python -m nose` didn't fix the
problem by itself, it was part of the overall fix.

>We eventually decided something's maybe breaking inside setuptools, or
>we're just doing things we're not supposed to be doing (mixing PEP-420
>namespace packages with old-style namespace packages).

I've had this crazy idea since PEP 420 that it should be possible to include
some magic in a namespace package's __init__.py so that even if it exists,
Python will treat it as nonexistent.  E.g. some kind of NamespacePackageError
or some such.  I know we talked about it during the development of PEP 420,
but I've never done any concrete coding to see if the idea could work.  Even
if it did, it'll probably just make things more complicated. ;)

>I still don't understand why this problem shows up only on Python 3.5 and
>newer, but not on 3.3 or 3.4, which also had PEP-420 namespace packages.

FWIW, this showed up during an Ubuntu test rebuild for a future Python 3.6
transition.  It's possible this is the first time in a year or so that the
package has been rebuilt (usually, it's just binary copied to newer Ubuntu
series) but I'm pretty sure it's been rebuilt since our Python 3.5
transition.  I suspect other tools in the stack have changed here, since
they've changed much more frequently.

>The workaround I personally settled on is using `usedevelop = true` in
>tox.ini.

I thought about trying that but apparently didn't need to.  It's a good clue.

>There's a setuptools bug open about this and Jason is trying valiantly
>to understand what's going on: https://github.com/pypa/setuptools/issues/912

Subscribed!

Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20170209/e2251e07/attachment-0001.pgp>


More information about the testing-in-python mailing list