python / python/mypy

Explicit Variables Warning Issue

Open
#18,927 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Describe the bug
Coverage shows me explicit warning when being used with mypy on this:
console: Console = Console()

I don't see the problem with having an explicit type set
Why does it warn against this, can I disable it globally

Also, doing console = Console() doesn't seem to solve the problem as well

To Reproduce
How can we reproduce the problem? Please be specific. Don't link to a failing CI job. Answer the questions be

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
Add any other context about the problem here.
Python 3.13
Mypy and Coverage
mypy src --html-report test
(Or any report)
Same result when I do coverage run mypy src

For reference I've opened a similar issue in the pycoverage repository and they told me it might be a mypy thing

https://github.com/nedbat/coveragepy/issues/1947

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report with mypy src --html-report test and coverage run mypy src, using the Python 3.13 context from the issue. Compare the warning from direct mypy execution with the coverage invocation and read the linked coveragepy issue for context. Done means identifying which tool emits the warning and documenting the applicable configuration or expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.