python / python/mypy

Type `mypy/config_parser.py` without `Any`

Open
#19,566 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

We could try to get all the Anys out of mypy/config_parser.py, which would prevent other configuration-file type-error crashes. (We will presumably still error, but could emit a friendlier message, as in https://github.com/python/mypy/pull/19494 and its GitHub issue.) You know... static typing :)

Semi-related: https://github.com/hukkin/tomli/issues/261

Originally posted by @wyattscarpenter in https://github.com/python/mypy/pull/19494#discussion_r2249050998

This might be very easy if the ini parser knows/declares what types it gives us (primarily strings?)... could be prohibitively difficult otherwise, or perhaps best addressed in typeshed stubs. I haven't looked into it much yet; I imagine it will be easiest to investigate with an IDE that does type inference and display, and I'm on a bus right now (the opposite situation).

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

Read mypy/config_parser.py and the behavior discussed in pull request #19494. Investigate which types the INI parser provides, including whether typeshed stubs are relevant. Done means removing the applicable Any types while preserving configuration-error handling and preventing type-error crashes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Refactor
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.