Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up
type_checked
tag for internal type hint migration (#7886)
### Problem Per #6742, we will be _incrementally_ adding type hints to Pants. We need some way to mark to our CI that the target should be checked against, to make sure that any gains we make in type hints are actually enforced. ### Solution Introduce a new tag `type_checked`, which indicates to our CI that `./pants mypy` should be ran against that target. Also introduce a helper script `build-support/bin/mypy.py` that runs `./pants mypy` over _all_ eligible targets in Pants. To run over a select few targets, users should instead simply run `./pants mypy path/to:target`. #### Alternative solution considered: centralized whitelist file It was decided that a decentralized system will work better in this particular case, for some of these reasons: 1) There's a convention for keeping it decentralized: the `integration` tag. 2) `BUILD` files are more accessible to modify, e.g. being closer to the source. 3) We want to type check the entire codebase eventually. One centralized file would risk becoming too large and difficult to maintain.
- Loading branch information
1 parent
1048ebc
commit c488456
Showing
3 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
import subprocess | ||
|
||
|
||
def main() -> None: | ||
subprocess.run(["./pants", "--tag=+type_checked", "mypy", "::"], check=True) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters