flake8-junit-report

raw JSON →
2.1.0 verified Fri May 01 auth: no python

Simple tool that converts flake8 output to JUnit XML format for integration with CI/CD systems like Jenkins. Version 2.1.0 is the latest; actively maintained with a pip install.

pip install flake8-junit-report
error ModuleNotFoundError: No module named 'flake8-junit-report'
cause Using hyphens in import statement instead of underscores.
fix
Change import to 'from flake8_junit_report import ...'
error ValueError: Input is not valid flake8 output
cause Input file contains JSON or other unsupported format.
fix
Ensure flake8 output is plain text with lines like 'file.py:line:col: code message'.
gotcha Input must be flake8 plain text output, not JSON or other formats.
fix Use flake8 with default output format (e.g., flake8 > flake8_output.txt).
gotcha Installing with hyphens in package name (e.g., flake8-junit-report) works, but imports use underscores.
fix Use import flake8_junit_report.

Parse flake8 output and generate JUnit XML.

from flake8_junit_report import Flake8JunitReport

# Example: parse flake8 output from file
with open('flake8_output.txt', 'r') as f:
    report = Flake8JunitReport.from_flake8_output(f.read())

# Write JUnit XML
with open('junit.xml', 'w') as f:
    f.write(report.to_xml())