conda-build
conda-build copied to clipboard
add type annotations created by monkeytype
Description
This PR is for demonstration and discussion, it is unlikely that these changes should be merged as is.
Add type annotations to the conda_build library created by running the test suite with MonkeyType.
This steps used to accomplished this were:
make setup
conda activate conda-build
python -m pip install monkeytype
monkeytype run -m pytest
monkeytype list-modules | grep conda_build > modules
cat modules | while read mod
do
echo "Adding types to $mod"
monkeytype apply --pep_563 $mod
done
Checklist - did you ...
- [ ] Add a file to the
news
directory (using the template) for the next release's release notes? - [ ] Add / update necessary tests?
- [ ] Add / update outdated documentation?
Hi @jjhelmus,
Thanks for submitting this. I just wanted to chime in and give my two cents on this 😄. TLDR: I don't think we should worry about adding type hinting to conda-build. Below are my reasons:
- conda-build has maintainability problems that type hints won't solve. For example there are various examples of terse variable names in the code: https://github.com/conda/conda-build/blob/07a9d43dc24e2bf12b1c61b7d7298582755c5a01/conda_build/build.py#L156 I think we should attempt to fix these first and perhaps add type hints manually at the same time.
- I am of the opinion that for type hints to truly be useful, we should also be using a type checker like
mypy
. I don't think that's feasible for a project like conda-build given its size that the refactor effort involved to reach a sufficient level of coverage. - Adding type hints puts an extra burden on new contributions, and we will need to train reviewers to account for this in their pull request reviews. Not everyone is currently aligned on the need for type hints.
Hope that makes sense. Anyways, thanks for submitting this pull request and starting the conversation. Looking forward to a healthy debate.
Hi there, thank you for your contribution!
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs.
If you would like this pull request to remain open please:
- Rebase and verify the changes still work
- Leave a comment with the current status
NOTE: If this pull request was closed prematurely, please leave a comment.
Thanks!