python / python/mypy

0.800: Unable to configure subdirectories

Open
#10,045 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

In Mypy 0.800, it now checks files in subdirectories without __init__.py files.

The problem is that the config still only works on modules containing __init__.py, meaning there is no way to change the config for these subdirectories.

e.g.
untyped-def errors have started appearing in test/foo/bar.py

Adding this to config has no effect:

[mypy-tests.*]
disallow_untyped_defs = False

This only works if tests/__init__.py and tests/foo/__init__.py are created.

Expected behaviour is that the above config will ignore the errors, or an alternative syntax is available to do so (e.g. [mypy-tests/*].

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

Reproduce the issue with tests/foo/bar.py and a [mypy-tests.*] configuration containing disallow_untyped_defs = False. Trace how configuration sections match subdirectories without init.py files; done when the existing syntax applies or an alternative syntax is supported and verified against this example.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.