python / python/mypy

code-blockwise configuration settings

Open
#15,547 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Feature

In mypy, we can do something like # type: ignore [error-code]

For some developer tools, we can use some blockwise settings, ex:

# fmt: off
blabla
# fmt: on

Momentarily configuring some mypy settings in a similar fashion would be useful

Pitch

A specific reason why I'd like to see this is that I have a codebase where allow-redefinition is False (and this is good). But I have a small region where I have a lot of type narrowing to do and in this case allowing a block of redefinitions is far more convenient. Plus, the control comments would signal to the reader that this is happening.

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

The issue names no files, tests, or entry points. Start by reviewing how mypy handles inline control comments and configuration such as allow-redefinition; done requires an agreed block-scoped configuration syntax and behavior, including how the setting applies within and outside the block.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.