
Enables the import-error pylint check on //testing. Most errors are fixed by updating the PYTHONPATH used by pylint to include the necessary directories, although some import errors are simply suppressed (most commonly for vpython-provided modules). Also takes this opportunity to add comments about where each block of non-standard imports comes from. This was already present in a number of places, but not everywhere. Bug: 353942917 Change-Id: I506d35e5a6ae56471618e6b4af57dd2ecb64dd7b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6092016 Commit-Queue: Brian Sheedy <bsheedy@chromium.org> Reviewed-by: Ben Pastene <bpastene@chromium.org> Reviewed-by: Paul Semel <paulsemel@chromium.org> Cr-Commit-Position: refs/heads/main@{#1396194}
This directory contains Python code for running pytype (a Python 3 type hinting analyzer) on Chromium Python code. pytype can infer types from un-annotated code, so it is not necessary to have type hinting added for all analyzed code and its dependencies. However, it is still recommended to do so eventually to ensure that the type hinting is as accurate as possible and to ensure that humans have up-to-date information about what functions take and return.
To run pytype, simply import pytype_runner.py
and call its run_pytype
function with the correct arguments as specified in its docstring.
It is recommended to NOT run this as part of presubmit, as depending on how many dependencies your code has, it can end up analyzing many files and taking multiple minutes. This time goes down dramatically once pytype has a cache built, but there is currently no way to ensure bots have a warm cache, so it should not be relied on.