Skip to content

[BUG] unused submodule imports not removed #257

@peterchenadded

Description

@peterchenadded

Describe the bug

Seems pycln is not able to remove submodule imports that are not used even with the --all flag.

To Reproduce

  1. Take this code snippet:
# test_api/a.py
value = 1
# test_api/b.py
value = 2
# test_api/__init__.py
# test.py
import test_api.a
import test_api.b

print(test_api.a.value)
  1. Run this Pycln command:

    pycln --all test.py
  2. Error traceback or unexpected output (if present):

    No imports are removed

Expected behavior:

  1. Description:

Would expect import test_api.b to be removed

  1. Expected output (if present):

1 test_api.b should be removed

Environment:

  • Python Version: 3.10.6
  • Pycln Version: 2.5.0
  • OS Type: mac0S m1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions