Skip to content

Replace pyright with mypy #7

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

Merged
merged 1 commit into from
Feb 21, 2023
Merged

Replace pyright with mypy #7

merged 1 commit into from
Feb 21, 2023

Conversation

code-yeongyu
Copy link
Owner

@code-yeongyu code-yeongyu commented Feb 21, 2023

Context

Type Checker Philosophies

  1. No errors when type can be inferable
  2. If type cannot be inferable, type hints should be added
  3. Using of external modules that are not typed should be no error
  4. faster the better

mypy

mypy cannot satisfy philosophy 1

The following code cannot be passed by mypy while the return type can be inferable.

def greeting(name: str):
    print(f"hello {name}")

this can be ignored by setting no-untyped-def=false.

but that code violates 2.

def greeting(name):
    print(f"hello {name}")

and it's slow.

pyright

pyright satisfies the philosophy, with these options in this PR.

... and it's way faster than mypy and easy to integrate with vscode's pylance.

Changes

  • Replace pyright with mypy

@code-yeongyu code-yeongyu marked this pull request as ready for review February 21, 2023 08:15
@code-yeongyu code-yeongyu merged commit 2ee908f into master Feb 21, 2023
@code-yeongyu code-yeongyu deleted the feature/pyright branch February 21, 2023 08:46
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.

1 participant