Skip to content

pyreverse does not show inheritance relation when using a flat folder #7686

@DudeNr33

Description

@DudeNr33

Bug description

See this SO question.

Foo.py, Bar.py and __init__.py are all located in the same folder.

Foo.py:

class Foo():
    def print_foo(self):
        print("hi")

Bar.py:

from Foo import Foo

class Bar(Foo):
    pass

pyreverse is executed from within the same folder.

Configuration

No response

Command used

pyreverse -ASmy -o png .

Pylint output

The resulting image shows both classes `Foo` and `Bar`, but not the inheritance relationship between them.

Expected behavior

It could be argued that when using an __init__.py and therefore a package relative or absolute imports should be used, the code provided does run fine when just running e.g. python -c "import Bar" from inside the directory.

Therefore pyreverse should pick up the relationships between the two classes as well.

Pylint version

pylint 2.14.5
astroid 2.12.10
Python 3.10.5 (main, Jun  6 2022, 18:49:26) [GCC 12.1.0]

OS / Environment

No response

Additional dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs PRThis issue is accepted, sufficiently specified and now needs an implementationpyreverseRelated to pyreverse component

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions