Skip to content
This repository was archived by the owner on Jul 17, 2026. It is now read-only.
This repository was archived by the owner on Jul 17, 2026. It is now read-only.

Codegen struggling to recognize module atrtribute access as a usage #242

Open

Description

@gautum

When using codegen to remove dead code, it incorrectly identifies functions accessed via module attribute notation as unused.

Example:

file: example.py

from a.b import module

module.some_func() # this usage is not detected

In the dead code script:

some_func.usages # Returns []
some_func.call_sites # Returns []
some_func.symbol_usages # Returns []

As a result, some_func is incorrectly identified as dead code and removed, despite being actively used through module attribute access.

Expected Behavior:

  • some_func should show usage when accessed via module.some_func()

Activity

  1. jayhack commented on Feb 3, 2025

    @jayhack
    Contributor

    Thanks for the report, @gautum . This is a bug - it should be supported. Can you point us towards a specific repository that exhibits this issue? Or can you provide a minimal code example where the issue appears?

  2. codegen-team commented on Feb 3, 2025

    @codegen-team
    Contributor

    #251 - we added a basic test case, but it's passing. +1 on the minimal reproduction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions