Simple Python tool to convert Pyright JSON output to GitLab Code Quality report format.
Zero runtime dependencies - Pure Python implementation using only the standard library.
You can install the package from PyPI using pip:
pip install pyright-to-gitlabOr make it available globally:
- via
pipx:pipx install pyright-to-gitlab
- via
uv:uv tool install pyright-to-gitlab
As a one-time use, you can also run it directly with uvx:
uvx pyright-to-gitlab --helpOr download the single source file and run it with Python:
wget https://raw.githubusercontent.com/schollm/pyright-to-gitlab/refs/heads/main/src/pyright_to_gitlab.py -O pyright_to_gitlab.py
python pyright_to_gitlab.py --helppyright-to-gitlab --helpOutput:
usage: pyright-to-gitlab [-h] [-i INPUT] [-o OUTPUT] [--prefix PATH_PREFIX] [--version]
Convert Pyright JSON output to a GitLab Code Quality report.
Input defaults to stdin and output defaults to stdout.
Use '-' explicitly for stdin/stdout when mixing with file paths.
options:
-h, --help show this help message and exit
-i, --input INPUT Path to Pyright JSON input (default: -). Use - to read from stdin.
-o, --output OUTPUT Path for GitLab Code Quality JSON (default: -). Use - to write to stdout.
--prefix PATH_PREFIX Prefix added to each reported file path, e.g. 'backend/' for monorepos.
--version show program's version number and exit
Examples:
pyright . --outputjson | pyright-to-gitlab > gl-code-quality.json
pyright-to-gitlab -i pyright.json -o gl-code-quality.json
pyright-to-gitlab --prefix backend/ -i pyright.json -o -
pyright-to-gitlab -i pyright.json
Convert from stdin to stdout (typical pipeline):
pyright . --outputjson | pyright-to-gitlab > code-quality.jsonConvert from file to file:
pyright-to-gitlab -i pyright.json -o code-quality.jsonRun as a module:
pyright . --outputjson | python -m pyright_to_gitlab > code-quality.jsonThe --prefix option adds a custom prefix path to the file paths in the output. This is
useful for mono-repos, where the paths in the pyright output are not the repository root.
pyright . --outputjson | pyright-to-gitlab --prefix my-app > code-quality.jsonTo run the tests, execute
uv run poe check