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

bug: MyPy compatibility #3119

Open
judahrand opened this issue Oct 19, 2022 · 5 comments
Open

bug: MyPy compatibility #3119

judahrand opened this issue Oct 19, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@judahrand
Copy link
Contributor

Describe the bug

BentoML doesn't play nice with mypy due to this issue: python/mypy#12299

The issue is that a lot of # type: ignore comments in the codebase have additional comments after them (ie. # type: ignore (reason for ignore)). This results in packages that use BentoML and mypy throwing error: Invalid "type: ignore" comment [syntax] for mypy.

To reproduce

No response

Expected behavior

BentoML should work with mypy

Environment

Doesn't really matter.

@judahrand judahrand added the bug Something isn't working label Oct 19, 2022
@aarnphm
Copy link
Contributor

aarnphm commented Oct 19, 2022

We made a conscious decision to use pyright instead of mypy. https://github.com/bentoml/BentoML/blob/main/DEVELOPMENT.md#style-check-auto-formatting-type-checking

We don't currently have intention on supporting two different types of type checker.

@judahrand
Copy link
Contributor Author

judahrand commented Oct 19, 2022

@aarnphm I don't think you're understanding. This isn't about the development of BentoML... It's about using it elsewhere. Any project which uses BentoML can't currently use mypy. You're forcing the choice for others.

@judahrand
Copy link
Contributor Author

I have BentoML installed in a venv and I import and use it in a service.py file which will be included in my Bento, right? What if I want to lint that service.py file with mypy because it is a standard tool in my organization? Currently, it throws errors.

@aarnphm
Copy link
Contributor

aarnphm commented Oct 20, 2022

This is not necessarily a bug. When we decide to use pyright, we have heard about this issue with mypy.

For what its worth, you can always disable mypy rules for bentoml for now:

[mypy-bentoml]
ignore = true

@sauyon
Copy link
Contributor

sauyon commented Oct 20, 2022

While I think this is a mypy bug that should be resolved, since the resolution is just to change the comment style on our type ignores and it would be a relatively easy change I don't see why we shouldn't do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants