-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: replace mypy and pytype with pyrefly for static type analysis #8868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from 7 commits
ba56a6d
5216b7a
eacd783
c64825f
66b6c17
19cab57
4b8086b
763b7ff
ae31bb2
42ec9b2
6cf89d0
b76fd6e
8c5c242
0b1017e
60723b7
3ec99c8
29a9cdc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -116,6 +116,7 @@ examples/scd_lvsegs.npz | |
| temp/ | ||
| .idea/ | ||
| .dmypy.json | ||
| .ty_cache/ | ||
|
|
||
| *~ | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,7 +50,7 @@ doRuffFix=false | |
| doClangFormat=false | ||
| doCopyRight=false | ||
| doPytypeFormat=false | ||
| doMypyFormat=false | ||
| doTyFormat=false | ||
| doCleanup=false | ||
| doDistTests=false | ||
| doPrecommit=false | ||
|
|
@@ -61,7 +61,7 @@ PY_EXE=${MONAI_PY_EXE:-$(which python)} | |
|
|
||
| function print_usage { | ||
| echo "runtests.sh [--codeformat] [--autofix] [--black] [--isort] [--flake8] [--pylint] [--ruff]" | ||
| echo " [--clangformat] [--precommit] [--pytype] [-j number] [--mypy]" | ||
| echo " [--clangformat] [--precommit] [--pytype] [-j number] [--ty]" | ||
| echo " [--unittests] [--disttests] [--coverage] [--quick] [--min] [--net] [--build] [--list_tests]" | ||
|
Comment on lines
+64
to
65
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep
Suggested fix -f|--codeformat)
doBlackFormat=true
doIsortFormat=true
doFlake8Format=true
# doPylintFormat=true # https://github.com/Project-MONAI/MONAI/issues/7094
doRuffFormat=true
+ doPyreflyFormat=true
doCopyRight=true
;;Also applies to: 90-91, 265-272, 312-313 🤖 Prompt for AI Agents |
||
| echo " [--dryrun] [--copyright] [--clean] [--help] [--version] [--path] [--formatfix]" | ||
| echo "" | ||
|
|
@@ -89,7 +89,7 @@ function print_usage { | |
| echo "Python type check options:" | ||
| echo " --pytype : perform \"pytype\" static type checks" | ||
| echo " -j, --jobs : number of parallel jobs to run \"pytype\" (default $NUM_PARALLEL)" | ||
| echo " --mypy : perform \"mypy\" static type checks" | ||
| echo " --ty : perform \"ty\" static type checks" | ||
| echo "" | ||
| echo "MONAI unit testing options:" | ||
| echo " -u, --unittests : perform unit testing" | ||
|
|
@@ -314,8 +314,8 @@ do | |
| --pytype) | ||
| doPytypeFormat=true | ||
| ;; | ||
| --mypy) | ||
| doMypyFormat=true | ||
| --ty) | ||
| doTyFormat=true | ||
| ;; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| -j|--jobs) | ||
| NUM_PARALLEL=$2 | ||
|
|
@@ -654,26 +654,26 @@ then | |
| fi | ||
|
|
||
|
|
||
| if [ $doMypyFormat = true ] | ||
| if [ $doTyFormat = true ] | ||
| then | ||
| set +e # disable exit on failure so that diagnostics can be given on failure | ||
| echo "${separator}${blue}mypy${noColor}" | ||
| echo "${separator}${blue}ty${noColor}" | ||
|
|
||
| # ensure that the necessary packages for code format testing are installed | ||
| if ! is_pip_installed mypy | ||
| if ! is_pip_installed ty | ||
| then | ||
| install_deps | ||
| fi | ||
| ${cmdPrefix}"${PY_EXE}" -m mypy --version | ||
| ${cmdPrefix}"${PY_EXE}" -m mypy "$homedir" | ||
| ${cmdPrefix}"${PY_EXE}" -m ty --version | ||
| ${cmdPrefix}"${PY_EXE}" -m ty check "$homedir" | ||
|
|
||
| mypy_status=$? | ||
| if [ ${mypy_status} -ne 0 ] | ||
| ty_status=$? | ||
| if [ ${ty_status} -ne 0 ] | ||
| then | ||
| : # mypy output already follows format | ||
| exit ${mypy_status} | ||
| : # ty output already follows format | ||
| exit ${ty_status} | ||
| else | ||
| : # mypy output already follows format | ||
| : # ty output already follows format | ||
| fi | ||
| set -e # enable exit on failure | ||
| fi | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.