question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding the `--strict` option to mypy

See original GitHub issue

Overview

This is the second part of the discussion from #10065 (review).

Description

I have been working on converting the type hint commentaries into proper annotations (#10004, #10018, #10065, #10074). But I had a simple mistake on #10065 by annotating this:

        download_dir: str = None

when it must be annotated like this:

        download_dir: Optional[str] = None

We expected that Mypy was going to fail, but it just passed by. Then, we saw that Mypy accepts implicit optional annotations, until we use --no-implicit-optional.

What we want

We want Mypy to use --no-implicit-optional on its checks, to make a better diagnosis. View the PR review where the original discussion is for more information.

Code of Conduct

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:24 (24 by maintainers)

github_iconTop GitHub Comments

1reaction
uranusjrcommented, Jul 25, 2021

Assigned

1reaction
pradyunsgcommented, Jun 18, 2021

Yea, we have to enable a bunch of mypy’s strictness flags (this is probably the highest impact among those).

The ideal goal would be to get to a point where we can run mypy --strict . and have everything pass.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The mypy command line - mypy 0.991 documentation
This flag disables strict checking of Optional types and None values. With this option, mypy doesn't generally check the use of None values...
Read more >
`--strict` is too strict to be useful · Issue #7767 · python/mypy
I like the idea of making --strict only strict enough that we can reasonably use it in mypy. We could also support an...
Read more >
mypy command line option stricter than --strict - Stack Overflow
I have the following code in test.py x = 1. Does there exist an option in mypy to force definition of type hints...
Read more >
Professional-grade mypy configuration - Wolt Blog
By default, mypy doesn't require any type hints, i.e. it has disallow_untyped_defs = False by default. If you want to enforce the usage...
Read more >
Mypy Documentation - Read the Docs
Adding type hints for mypy does not interfere with the way your ... Mypy has a strict mode that enables a number of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found