python / python/mypy

Apply soft word wrap also to notes when using --pretty

Open
#7,453 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature priority-1-normal topic-usability
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

We only wrap errors, not notes with --pretty. Notes require special care because they contain function signatures (e.g. for overloads and protocols). It would be great to also nicely fit them to terminal width, for example:

        def [T <: SomeBound] meth(self, one_argument: T, other_argument: T) -> List[T]: ...

may become

        def [T <: SomeBound] meth(self,
                                  one_argument: T,
                                  other_argument: T) -> List[T]: ...

This is a follow-up for https://github.com/python/mypy/pull/7440

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 locating the --pretty output path that wraps errors and identify how notes containing function signatures are formatted. Check how terminal width is handled there, then verify that notes wrap without breaking their signature structure and that the example output fits the requested width.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, developer-experience
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.