No Python source warning for namespace modules

Issue #572 resolved
Christian Heimes created an issue

setuptools no longer installs a for namespace packages. Now I'm getting a warning warning: Module custudia has no Python source. for a namespace package called custodia. You can easily reproduce the issue with a git checkout of


$ git clone
$ cd custodia
$ tox -e py27
=================================================================================== 101 passed in 11.23 seconds ==================================================================================== warning: Module custodia has no Python source.
_____________________________________________________________________________________________ summary ______________________________________________________________________________________________
  py27: commands succeeded
  congratulations :)

On both Python 2 and 3, a namespace module has a __path__ attribute but no __file__ attribute. May I suggest that you omit the warning when a module has no __file__ but a __path__?

$ cd /tmp
$ mkdir nsexample
$ touch nsexample/
$ python3
>>> import nsexample
>>> import nsexample.module
>>> dir(nsexample)
['__doc__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'module']
>>> dir(nsexample.module)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__']

Comments (4)

  1. Ned Batchelder repo owner

    When I try the custodia example, I get different output, without that warning. Can you provide a runnable example that produces that exact warning?

  2. Christian Heimes reporter is a minimal reproducer for the problem

    GLOB sdist-make: .../covns/
    py27 inst-nodeps: .../covns/.tox/dist/
    py27 installed: appdirs==1.4.3,coverage==4.3.4,covns==0.1,packaging==16.8,py==1.4.33,pyparsing==2.2.0,pytest==3.0.7,six==1.10.0
    py27 runtests: PYTHONHASHSEED='388494413'
    py27 runtests: commands[0] | .../covns/.tox/py27/bin/python -m coverage run --parallel -m pytest --capture=no --strict
    =============================================================== test session starts ===============================================================
    platform linux2 -- Python 2.7.13, pytest-3.0.7, py-1.4.33, pluggy-0.4.0
    rootdir: .../covns, inifile: tox.ini
    collected 1 items  .
    ============================================================ 1 passed in 0.02 seconds ============================================================= warning: Module covns has no Python source.
    _____________________________________________________________________ summary _____________________________________________________________________
      py27: commands succeeded
      congratulations :)
  3. Log in to comment