Skip to content

Implicit namespace package is not linted if it is inside a regular package #3944

@cl0ne

Description

@cl0ne

Steps to reproduce

  1. Create implicit namespace package inside regular package, for example:
    $ tree package_with_namespace package_with_namespace ├── __init__.py └── namespace  └── module.py 1 directory, 2 files
  2. Create similar hierarchy when a top-level namespace package contains a regular package with its own namespace package inside, for example:
    $ tree namespace namespace ├── outer_module.py └── package  ├── __init__.py  ├── innerspace  │ ├── inner_module.py  │ └── inner_package  │ └── __init__.py  └── package_module.py 3 directories, 5 files
  3. Put show_warning = True (or something similar) into .py files just to get some warnings.
  4. Run pylint on package_with_namespace, package_with_namespace.namespace and package_with_namespace.namespace.module
  5. Run pylint on namespace

Current behavior

$ pylint package_with_namespace ************* Module package_with_namespace package_with_namespace/__init__.py:1:0: C0114: Missing module docstring (missing-module-docstring) package_with_namespace/__init__.py:1:0: C0103: Constant name "show_warning" doesn't conform to UPPER_CASE naming style (invalid-name) ------------------------------------- Your code has been rated at -10.00/10 $ pylint package_with_namespace.namespace $ pylint package_with_namespace.namespace.module ************* Module package_with_namespace.namespace.module package_with_namespace/namespace/module.py:1:0: C0114: Missing module docstring (missing-module-docstring) package_with_namespace/namespace/module.py:1:0: C0103: Constant name "show_warning" doesn't conform to UPPER_CASE naming style (invalid-name) ------------------------------------- Your code has been rated at -10.00/10
$ pylint namespace ************* Module namespace.outer_module namespace/outer_module.py:1:0: C0114: Missing module docstring (missing-module-docstring) namespace/outer_module.py:1:0: C0103: Constant name "show_warning" doesn't conform to UPPER_CASE naming style (invalid-name) ************* Module namespace.package.package_module namespace/package/package_module.py:1:0: C0114: Missing module docstring (missing-module-docstring) namespace/package/package_module.py:1:0: C0103: Constant name "show_warning" doesn't conform to UPPER_CASE naming style (invalid-name) ************* Module namespace.package namespace/package/__init__.py:1:0: C0114: Missing module docstring (missing-module-docstring) namespace/package/__init__.py:1:0: C0103: Constant name "show_warning" doesn't conform to UPPER_CASE naming style (invalid-name) ************* Module namespace.package.innerspace.inner_module namespace/package/innerspace/inner_module.py:1:0: C0114: Missing module docstring (missing-module-docstring) namespace/package/innerspace/inner_module.py:1:0: C0103: Constant name "show_warning" doesn't conform to UPPER_CASE naming style (invalid-name) ************* Module namespace.package.innerspace.inner_package namespace/package/innerspace/inner_package/__init__.py:1:0: C0114: Missing module docstring (missing-module-docstring) namespace/package/innerspace/inner_package/__init__.py:1:0: C0103: Constant name "show_warning" doesn't conform to UPPER_CASE naming style (invalid-name) ------------------------------------- Your code has been rated at -10.00/10

Expected behavior

Output from pylint package_with_namespace and pylint package_with_namespace.namespace should contain output from pylint package_with_namespace.namespace.module just like with pylint namespace.

pylint --version output

pylint 2.6.0 astroid 2.4.2 Python 3.8.6 (default, Sep 30 2020, 04:00:38) [GCC 10.2.0] 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions