fix: Limit inputs to action#141
Conversation
In our codebase, we have a long chain of C++ compilation that ends up getting fed to our Python targets and, by extension, these mypy actions. Since mypy doesn't actually import anything, these compiled artifacts are unnecessary. This uses a different method to grab the things that mypy _will_ look at, those being transitive .py and .pyi files.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 249bd89a12
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if RulesPythonPyInfo in dep: | ||
| depsets.append(dep[RulesPythonPyInfo].transitive_sources) | ||
| depsets.append(dep[RulesPythonPyInfo].transitive_pyi_files) |
There was a problem hiding this comment.
Preserve py_type_library directories as inputs
When users configure types=... in mypy(), this loop also visits the generated py_type_library targets from additional_types; those targets provide PyTypeLibraryInfo, not RulesPythonPyInfo, so this replacement stops adding their declared stub directory to the action inputs. The code still puts dep[PyTypeLibraryInfo].directory.path + "/site-packages" on MYPYPATH below, so in sandboxed or remote execution that path is missing and mypy cannot load the mapped stub package, breaking the advertised types mapping.
Useful? React with 👍 / 👎.
In our codebase, we have a long chain of C++ compilation that ends up getting fed to our Python targets and, by extension, these mypy actions. Since mypy doesn't actually import anything, these compiled artifacts are unnecessary.
This uses a different method to grab the things that mypy will look at, those being transitive .py and .pyi files.