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 Add non-strict mypy to CI and fix errors #62

Merged
merged 5 commits into from
Jul 28, 2022
Merged

MNT Add non-strict mypy to CI and fix errors #62

merged 5 commits into from
Jul 28, 2022

Conversation

BenjaminBossan
Copy link
Collaborator

This accompanies PR #61 to contrast the difference between strict and
non-strict mypy usage.

This accompanies PR #61 to contrast the difference between strict and
non-strict mypy usage.
Copy link
Member

@adrinjalali adrinjalali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks much more reasonable to me.

Should also add it to pre-commit hooks.

@@ -112,7 +114,7 @@ def init(*, model: Union[str, Path], requirements: List[str], dst: Union[str, Pa
None
"""
dst = Path(dst)
if dst.exists() and next(dst.iterdir(), None):
if dst.exists() and bool(next(dst.iterdir(), None)):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aha? why do we need explicit bool here? This is proper python:

>>> if 3 or None:
...     print(1)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error is:

skops/hub_utils/_hf_hub.py:117: error: Argument 1 to "next" has incompatible type "Generator[Path, None, None]"; expected "SupportsNext[bool]"
skops/hub_utils/_hf_hub.py:117: error: Argument 2 to "next" has incompatible type "None"; expected "bool"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's very silly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

Copy link
Member

@adrinjalali adrinjalali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you add the pre-commit hook here, I'm happy to merge this as a first step, and re-visit in the future.

@@ -112,7 +114,7 @@ def init(*, model: Union[str, Path], requirements: List[str], dst: Union[str, Pa
None
"""
dst = Path(dst)
if dst.exists() and next(dst.iterdir(), None):
if dst.exists() and bool(next(dst.iterdir(), None)):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's very silly.

E.g. def(foo: str = None)
They're not necessary to pass mypy but still useful to have.
@BenjaminBossan BenjaminBossan marked this pull request as ready for review July 28, 2022 12:04
@@ -16,7 +16,8 @@
"pytest": (PYTEST_MIN_VERSION, "tests", None),
"pytest-cov": ("2.9.0", "tests", None),
"flake8": ("3.8.2", "tests", None),
"mypy": ("0.770", "tests", None),
"mypy": ("0.971", "tests", None),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mypy isn't really a test dependency. It probably makes more sense to have it explicitly installed in CI the same as black and isort.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, mypy was already there before, but sure, I'll remove it. I thought the idea of having it here is to have a single source of truth for all dependencies, so it made sense to me.

Copy link
Member

@adrinjalali adrinjalali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge and see how it goes.

@adrinjalali adrinjalali changed the title Add non-strict mypy to CI and fix errors MNT Add non-strict mypy to CI and fix errors Jul 28, 2022
@adrinjalali adrinjalali merged commit 9d1274e into skops-dev:main Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants