python / python/mypy

Separate output tool error and mypy warnings (stderr, stdout, file)

Open
#16,974 1 comment 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

Today I run mypy > mypy.report to let jenkins parse the output log and present it. However then mypy crashes and prints errors, those also go on stdout and into my report file. It would be nice with some way of separating the output.

example on tool error:

$ mypy --no-incremental --disable-error-code import --follow-imports skip . > mypy.report
 Duplicate module named "benchmark" (also at "a/b/1/benchmark.py")
 a/b/2/benchmark.py: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#mapping-file-paths-to-modules for more info
 a/b/2/benchmark.py: note: Common resolutions include: a) using `--exclude` to avoid checking one of them, b) adding `__init__.py` somewhere, c) using `--explicit-package-bases` or adjusting MYPYPATH

Suggestion:

  1. Could these errors be printed to stderr? Should there in that case be an option to do so?
  2. option flag to set output_file for the report, but still output errors to stdout.

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 tracing mypy's current command-line handling of tool errors and report output. Compare the two requested behaviors—sending tool errors to stderr or configuring a report file while retaining stdout—and define which interface should be implemented; done means Jenkins can separate errors from the report reliably.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Feature
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.