Skip to content
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

MNT Use mypy --allow-redefinition + config #18313

Merged
merged 1 commit into from Aug 31, 2020
Merged

Conversation

@rth
Copy link
Member

@rth rth commented Aug 31, 2020

Several mypy related changes,

  • Makes mypy a bit less restrictive for variable redefinition to address #16705 (comment) by adding the --allow-redefinition option. For instance, without this flag,
    x = [1, 2, 3]
    x.append(2)
    x = set(x)
    would fail with,
    error: Incompatible types in assignment (expression has type "Set[int]", variable has type "List[int]")
    
    while it doesn't with this flag.
  • moves the required mypy flags to setup.cfg to make usage a bit more user friendly.
  • update to latest mypy version in CI and pre-commit.
@rth rth requested a review from NicolasHug Aug 31, 2020
@github-actions github-actions bot added the Build / CI label Aug 31, 2020
Copy link
Member

@NicolasHug NicolasHug left a comment

can't hurt!
thanks @rth

@@ -17,7 +17,7 @@ jobs:
inputs:
versionSpec: '3.8'
- bash: |
pip install flake8 mypy==0.780
pip install flake8 mypy==0.782

This comment has been minimized.

@NicolasHug

NicolasHug Aug 31, 2020
Member

can you remind me why we hardcode the version? Is it to avoid differences with the pre-commits?

This comment has been minimized.

@rth

rth Aug 31, 2020
Author Member

That and to avoid breaking CI if ever they make a backward incompatible release (not sure if they would, but I guess it's safer).

Copy link
Member

@thomasjpfan thomasjpfan left a comment

LGTM

@thomasjpfan thomasjpfan merged commit ac8760d into scikit-learn:master Aug 31, 2020
22 checks passed
22 checks passed
labeler
Details
LGTM analysis: C/C++ No code changes detected
Details
LGTM analysis: JavaScript No code changes detected
Details
LGTM analysis: Python No new or fixed alerts
Details
ci/circleci: deploy Your tests passed on CircleCI!
Details
ci/circleci: doc Your tests passed on CircleCI!
Details
ci/circleci: doc artifact Link to 0/doc/_changed.html
Details
ci/circleci: doc-min-dependencies Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
codecov/patch 100.00% of diff hit (target 97.18%)
Details
codecov/project 98.16% (+0.98%) compared to c505979
Details
scikit-learn.scikit-learn Build #20200831.71 succeeded
Details
scikit-learn.scikit-learn (Linting) Linting succeeded
Details
scikit-learn.scikit-learn (Linux py36_conda_openblas) Linux py36_conda_openblas succeeded
Details
scikit-learn.scikit-learn (Linux py36_ubuntu_atlas) Linux py36_ubuntu_atlas succeeded
Details
scikit-learn.scikit-learn (Linux pylatest_pip_openblas_pandas) Linux pylatest_pip_openblas_pandas succeeded
Details
scikit-learn.scikit-learn (Linux32 py36_ubuntu_atlas_32bit) Linux32 py36_ubuntu_atlas_32bit succeeded
Details
scikit-learn.scikit-learn (Linux_Runs pylatest_conda_mkl) Linux_Runs pylatest_conda_mkl succeeded
Details
scikit-learn.scikit-learn (Windows py36_pip_openblas_32bit) Windows py36_pip_openblas_32bit succeeded
Details
scikit-learn.scikit-learn (Windows py37_conda_mkl) Windows py37_conda_mkl succeeded
Details
scikit-learn.scikit-learn (macOS pylatest_conda_mkl) macOS pylatest_conda_mkl succeeded
Details
scikit-learn.scikit-learn (macOS pylatest_conda_mkl_no_openmp) macOS pylatest_conda_mkl_no_openmp succeeded
Details
jayzed82 added a commit to jayzed82/scikit-learn that referenced this pull request Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants