这是indexloc提供的服务,不要输入任何密码
Skip to content

Intended behavior of analyze re missing third party dependencies #21426

@gwdekker

Description

@gwdekker

Question

Take this example:

import requests
import pandas

def main():
    print("Hello from try-analyze-broken-imports!")


if __name__ == "__main__":
    main()
    print(requests.__version__)
    print(pandas.__version__)

The output of ruff analyze graph --python .venv/bin/python on this code depends on the state of the python interpreter. If I have installed requests there, it lists requests in the graph. It ignores the pandas import statement fully without error. Is this by design, what is the reasoning behind it? My naive expectation would have been that an import that can not be understood given the state of the python environment and the code base would throw an error, but instead it silently gets ignored.

Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionAsking for support or clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions