Registry /
testing / mypy-gitlab-code-quality
Install & Compatibility
Where this runs
tested against v1.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
mypy-gitlab-code-quality
✓ This library is primarily used as a command-line tool, typically invoked directly in shell scripts (e.g., in GitLab CI) rather than imported as a Python module for its core functionality.
The common usage pattern involves piping Mypy's output to the `mypy-gitlab-code-quality` executable.
This example demonstrates how to integrate `mypy-gitlab-code-quality` into a GitLab CI/CD pipeline. It installs `mypy` and `mypy-gitlab-code-quality`, runs `mypy` on `program.py` (ensuring JSON output), then pipes that output to `mypy-gitlab-code-quality` to generate `codequality.json`. This JSON file is declared as a `codequality` artifact for GitLab to parse and display in merge requests. The `allow_failure: true` setting is recommended for code quality jobs.
image: python:alpine
codequality:
script:
- pip install mypy mypy-gitlab-code-quality
# Run mypy and capture its JSON output to a temporary file
- mypy program.py --output=json > mypy-out.json || true # '|| true' prevents job failure if mypy finds errors
# Process mypy output into GitLab Code Quality format and redirect to 'codequality.json'
- mypy-gitlab-code-quality < mypy-out.json > codequality.json
artifacts:
when: always
reports:
codequality: codequality.json
allow_failure: true # Recommended for code quality jobs to not block pipelines
mypy-gitlab-code-quality --version
Debug
Known issues
gotchaWhile `mypy-gitlab-code-quality` supports both JSON and plain text output from `mypy`, JSON output is strongly recommended for more robust and consistent parsing. Relying on plain text output might lead to unexpected behavior if `mypy`'s output format changes in future versions.fixAlways configure `mypy` to output JSON using the `--output=json` flag when generating input for `mypy-gitlab-code-quality`.
affects: All versions
gotchaGitLab Code Quality reports expect file paths to be relative to the project root. If the `mypy` output contains absolute paths or paths that are not correctly relative to the project's root directory, code quality issues might not be displayed or linked correctly in GitLab merge requests.fixEnsure `mypy` is run from the project's root directory or configure `mypy` to output relative paths. Verify the paths in the generated `codequality.json`.
affects: All versions
gotchaThe `mypy-gitlab-code-quality` script outputs the generated GitLab Code Quality JSON directly to `STDOUT`. For GitLab CI to properly collect and display this as a code quality artifact, the `STDOUT` must be redirected to a file (e.g., `codequality.json`). Failure to redirect will result in no report being generated or displayed by GitLab.fixIn your CI/CD script, ensure you redirect the output: `mypy-gitlab-code-quality < mypy-out.json > codequality.json`.
affects: All versions
gotchaGitLab recommends setting `allow_failure: true` for Code Quality jobs. This practice prevents the entire CI/CD pipeline from failing due to detected quality issues, allowing other pipeline stages (like tests) to complete. It also ensures a full overview of quality findings is available without blocking merge requests unnecessarily.fixAdd `allow_failure: true` to your `codequality` job definition in your `.gitlab-ci.yml` file.
affects: All versions
deprecatedThe official GitLab Code Quality component based on CodeClimate scanning is deprecated and planned for removal in GitLab version 19.0 (around May 2026). While `mypy-gitlab-code-quality` is used by a separate, community-supported GitLab component (`codequality-os-scanners-integration`) for conversion to CodeClimate format, users should be aware of the broader deprecation of the built-in CodeClimate engine.fixMonitor GitLab documentation for updates on Code Quality integration, especially with GitLab 19.0 and beyond, to understand any necessary adjustments to the Code Climate format or integration methods.
affects: GitLab versions leading up to 19.0
gotchaThe functionality of `mypy-gitlab-code-quality` depends on the output format of `mypy`. Major versions of `mypy` may introduce breaking changes to their output, drop support for older Python versions (e.g., Mypy 1.20 dropped Python 3.9 support), or change default behaviors (e.g., `--local-partial-types` in Mypy 2.0). Ensure compatibility between your installed `mypy` version and `mypy-gitlab-code-quality`, and your project's Python version.fixRegularly check the release notes for both `mypy` and `mypy-gitlab-code-quality` for compatibility information. It is advisable to pin specific versions of `mypy` and `mypy-gitlab-code-quality` in your CI/CD environment to prevent unexpected breaks.
affects: All versions of `mypy-gitlab-code-quality` when used with varying `mypy` versions.
Upgrade
Version history
1.3.0latest on PyPI · released Mar 31, 2025
Audit
Dependencies
mypyrequiredThis library processes the output generated by Mypy.