Skip to content

Decide what to do with get_additional_deps() plugin hook #21323

@ilevkivskyi

Description

@ilevkivskyi

This hook is called in the coordinator with the parsed tree, but we don't want to deserialize trees in coordinator. It is currently used by mypyc, but it only accesses fullname on it. I recently recommended his hook in #17410 so it may be used by some plugins.

This hook is also used by the old NumPy plugin (in a somewhat controversial way). However, it looks like it can be fixed (in the sense that it will not immediately crash) by simply doing tree.defs = tree.imports.copy() before calling the hook.

I propose to make something like this documented behavior: i.e. explicitly say in the docs that the hook will be given partially parsed tree where only imports are available, the caller may then add extra dependencies judging from those imports.

It would be unfortunate to break plugins, but I don't see other options yet.

cc @JukkaL

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions