Skip to content

BC Linter

Ivan Zaitsev edited this page May 5, 2023 · 7 revisions

BC Linter User Guide

Summary

The BC Linter aims to reduce backward compatibility-breaking changes in the PyTorch codebase by detecting BC-breaking changes early (at PR time).

Engineering perspective

This is a linter (similar to black) that is invoked on Github PRs. This linter analyzes changes in function signatures and, if they are backward-incompatible, reports them as inline warnings in Github file view (example).

The linter is designed to identify and report issues such as function deletion, parameter removal, renaming, or reordering, changes in parameter requiredness, and removal of support for variadic parameters.

Suppression

The linter can be suppressed:

  • by adding labels suppress-api-compatibility-check or suppress-bc-linter to the PR;
  • by having #suppress-api-compatibility-check or #suppress-bc-linter in the commit message.

When suppressed, the warnings turn into notifications.

Note: Please don't suppress the linter if you are not absolutely sure that the API you're changing is not used (or that the error is a false positive). Instead, tag the PyTorch Dev Infra team or PyTorch Core engineers for help.