pyright-to-gitlab 1.0.1__tar.gz → 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyright_to_gitlab-1.0.1 → pyright_to_gitlab-1.1.0}/.github/workflows/python.yml +4 -5
- pyright_to_gitlab-1.1.0/CHANGELOG.md +22 -0
- pyright_to_gitlab-1.1.0/PKG-INFO +59 -0
- {pyright_to_gitlab-1.0.1 → pyright_to_gitlab-1.1.0}/README.md +2 -1
- {pyright_to_gitlab-1.0.1 → pyright_to_gitlab-1.1.0}/pyproject.toml +27 -4
- {pyright_to_gitlab-1.0.1 → pyright_to_gitlab-1.1.0}/src/pyright_to_gitlab.py +33 -7
- {pyright_to_gitlab-1.0.1 → pyright_to_gitlab-1.1.0}/tests/test_main.py +35 -0
- {pyright_to_gitlab-1.0.1 → pyright_to_gitlab-1.1.0}/uv.lock +1 -1
- pyright_to_gitlab-1.0.1/CHANGELOG.md +0 -11
- pyright_to_gitlab-1.0.1/PKG-INFO +0 -59
- {pyright_to_gitlab-1.0.1 → pyright_to_gitlab-1.1.0}/.github/workflows/testing.yml +0 -0
- {pyright_to_gitlab-1.0.1 → pyright_to_gitlab-1.1.0}/.gitignore +0 -0
- {pyright_to_gitlab-1.0.1 → pyright_to_gitlab-1.1.0}/LICENSE +0 -0
- {pyright_to_gitlab-1.0.1 → pyright_to_gitlab-1.1.0}/tests/__init__.py +0 -0
|
@@ -4,11 +4,11 @@ on: [push]
|
|
|
4
4
|
|
|
5
5
|
jobs:
|
|
6
6
|
testing:
|
|
7
|
-
name:
|
|
7
|
+
name: 🧪
|
|
8
8
|
uses: ./.github/workflows/testing.yml
|
|
9
9
|
|
|
10
10
|
build:
|
|
11
|
-
name: Build
|
|
11
|
+
name: Build 🐍📦
|
|
12
12
|
runs-on: ubuntu-latest
|
|
13
13
|
steps:
|
|
14
14
|
- uses: actions/checkout@v4
|
|
@@ -28,7 +28,7 @@ jobs:
|
|
|
28
28
|
|
|
29
29
|
publish-to-pypi:
|
|
30
30
|
name: >-
|
|
31
|
-
|
|
31
|
+
🐍📦 to PyPI
|
|
32
32
|
needs: [testing]
|
|
33
33
|
if: success() && startsWith(github.ref, 'refs/tags/v')
|
|
34
34
|
runs-on: ubuntu-latest
|
|
@@ -49,8 +49,7 @@ jobs:
|
|
|
49
49
|
|
|
50
50
|
github-release:
|
|
51
51
|
name: >-
|
|
52
|
-
Sign
|
|
53
|
-
and upload them to GitHub Release
|
|
52
|
+
Sign 🐍📦 with Sigstore and upload them to GitHub Release
|
|
54
53
|
needs: [testing]
|
|
55
54
|
if: success() && startsWith(github.ref, 'refs/tags/v')
|
|
56
55
|
runs-on: ubuntu-latest
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## [Upcoming]
|
|
9
|
+
## [1.1.0] - 2025-06-03
|
|
10
|
+
### Added
|
|
11
|
+
- Support for -i/--input and -o/--output options to specify input and output files.
|
|
12
|
+
|
|
13
|
+
## [1.0.2] - 2025-06-02
|
|
14
|
+
### Added
|
|
15
|
+
- URLs and topics to pyproject.toml for PyPI metadata.
|
|
16
|
+
- Advertise the no-dependency in the README.md.
|
|
17
|
+
|
|
18
|
+
## [1.0.1] - 2025-06-02
|
|
19
|
+
- Support for custom path prefix with the `--prefix` option.
|
|
20
|
+
## [1.0.0] - 2025-06-02
|
|
21
|
+
Initial release.
|
|
22
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyright-to-gitlab
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Convert Pyright JSON output to GitLab CI/CD format
|
|
5
|
+
Project-URL: homepage, https://github.com/schollm/pyright-to-gitlab/
|
|
6
|
+
Project-URL: repository, https://github.com/schollm/pyright-to-gitlab/
|
|
7
|
+
Project-URL: pypi, https://pypi.org/project/pyright-to-gitlab
|
|
8
|
+
Author: Micha Schöll
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ci/cd,gitlab,pyright
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: Software Development
|
|
24
|
+
Classifier: Topic :: Software Development :: Testing
|
|
25
|
+
Classifier: Topic :: Utilities
|
|
26
|
+
Classifier: Typing :: Typed
|
|
27
|
+
Requires-Python: >=3.6
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# pyright to gitlab
|
|
31
|
+
Simple zero-dependency Python script to convert a pyright --outputjson to a gitlab
|
|
32
|
+
code-quality report.
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
Run the script with the path to the pyright output file:
|
|
36
|
+
```shell
|
|
37
|
+
$ pip install pyright-to-gitlab
|
|
38
|
+
$ pyright . --outputjson | pyright-to-gitlab > code-quality.json
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Alternatively, the module can be called:
|
|
42
|
+
```shell
|
|
43
|
+
$ pip install pyright-to-gitlab
|
|
44
|
+
$ pyright . --outputjson | python -m pyright_to_gitlab > code-quality.json
|
|
45
|
+
```
|
|
46
|
+
### Custom path prefix
|
|
47
|
+
The `--prefix` option adds a custom prefix to the file paths in the output. This is
|
|
48
|
+
useful if the paths in the pyright output are not relative to the root of the repository.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
```shell
|
|
52
|
+
$ pyright . --outputjson | pyright-to-gitlab --prefix my-app/ > code-quality.json
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Testing
|
|
56
|
+
To run the tests, execute
|
|
57
|
+
```shell
|
|
58
|
+
$ uv run pytest tests/
|
|
59
|
+
```
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# pyright to gitlab
|
|
2
|
-
Simple Python script to convert a pyright --outputjson to a gitlab
|
|
2
|
+
Simple zero-dependency Python script to convert a pyright --outputjson to a gitlab
|
|
3
|
+
code-quality report.
|
|
3
4
|
|
|
4
5
|
## Usage
|
|
5
6
|
Run the script with the path to the pyright output file:
|
|
@@ -1,13 +1,36 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pyright-to-gitlab"
|
|
3
|
-
version = "1.0
|
|
3
|
+
version = "1.1.0"
|
|
4
4
|
description = "Convert Pyright JSON output to GitLab CI/CD format"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.6"
|
|
7
|
-
authors = [
|
|
8
|
-
|
|
7
|
+
authors = [{ name = "Micha Schöll", email = "" }]
|
|
8
|
+
license = "MIT"
|
|
9
|
+
license-files = ["LICENSE"]
|
|
10
|
+
keywords = [ "ci/cd", "pyright", 'gitlab' ]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 5 - Production/Stable",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Programming Language :: Python :: 3.7",
|
|
16
|
+
"Programming Language :: Python :: 3.8",
|
|
17
|
+
"Programming Language :: Python :: 3.9",
|
|
18
|
+
"Programming Language :: Python :: 3.10",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Programming Language :: Python :: 3.14",
|
|
23
|
+
"Topic :: Software Development :: Testing",
|
|
24
|
+
"Topic :: Software Development",
|
|
25
|
+
"Topic :: Utilities",
|
|
26
|
+
"Typing :: Typed",
|
|
9
27
|
]
|
|
10
|
-
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
homepage = "https://github.com/schollm/pyright-to-gitlab/"
|
|
31
|
+
repository = "https://github.com/schollm/pyright-to-gitlab/"
|
|
32
|
+
pypi = "https://pypi.org/project/pyright-to-gitlab"
|
|
33
|
+
|
|
11
34
|
[project.scripts]
|
|
12
35
|
pyrigh-to-gitlab = 'pyright_to_gitlab:main'
|
|
13
36
|
|
|
@@ -4,10 +4,11 @@ import argparse
|
|
|
4
4
|
import hashlib
|
|
5
5
|
import json
|
|
6
6
|
import sys
|
|
7
|
-
|
|
7
|
+
import textwrap
|
|
8
|
+
from typing import TextIO, cast
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
def _pyright_to_gitlab(prefix: str = "") -> str:
|
|
11
|
+
def _pyright_to_gitlab(input_: TextIO, prefix: str = "") -> str:
|
|
11
12
|
"""Convert pyright.json output to GitLab Code Quality report format.
|
|
12
13
|
|
|
13
14
|
:arg prefix: A string to prepend to each file path in the output.
|
|
@@ -17,7 +18,7 @@ def _pyright_to_gitlab(prefix: str = "") -> str:
|
|
|
17
18
|
Pyright format at https://github.com/microsoft/pyright/blob/main/docs/command-line.md
|
|
18
19
|
Gitlab format at https://docs.gitlab.com/ci/testing/code_quality/#code-quality-report-format
|
|
19
20
|
"""
|
|
20
|
-
data = cast("dict", json.load(
|
|
21
|
+
data = cast("dict", json.load(input_))
|
|
21
22
|
|
|
22
23
|
issues = []
|
|
23
24
|
for issue in data.get("generalDiagnostics", []):
|
|
@@ -49,17 +50,42 @@ def _pyright_to_gitlab(prefix: str = "") -> str:
|
|
|
49
50
|
def main() -> None:
|
|
50
51
|
"""Parse arguments and call the conversion function."""
|
|
51
52
|
parser = argparse.ArgumentParser(
|
|
52
|
-
description=
|
|
53
|
+
description=textwrap.dedent("""
|
|
54
|
+
Convert pyright.json to GitLab Code Quality report.
|
|
55
|
+
By default, reads from stdin and writes to stdout."""),
|
|
56
|
+
epilog=textwrap.dedent(
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
Example usage:
|
|
60
|
+
> python pyright . --outputjson | pyright-to-gitlab > gitlab_code_quality.json
|
|
61
|
+
> pyright-to-gitlab -i pyright.json -o gitlab_code_quality.json
|
|
62
|
+
"""
|
|
63
|
+
),
|
|
64
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
65
|
+
)
|
|
66
|
+
parser.add_argument(
|
|
67
|
+
"-i",
|
|
68
|
+
"--input",
|
|
69
|
+
type=argparse.FileType("r"),
|
|
70
|
+
default=sys.stdin,
|
|
71
|
+
help="Input file (default: stdin)",
|
|
72
|
+
)
|
|
73
|
+
parser.add_argument(
|
|
74
|
+
"-o",
|
|
75
|
+
"--output",
|
|
76
|
+
type=argparse.FileType("w"),
|
|
77
|
+
default=sys.stdout,
|
|
78
|
+
help="Output file (default: stdout)",
|
|
53
79
|
)
|
|
54
80
|
parser.add_argument(
|
|
55
81
|
"--prefix",
|
|
56
82
|
type=str,
|
|
57
83
|
default="",
|
|
58
|
-
help="Prefix to add to each file
|
|
84
|
+
help="Prefix to add to each file entry. This can be used if pyright is run"
|
|
85
|
+
" from a subdirectory of the repository. (default: empty string)",
|
|
59
86
|
)
|
|
60
87
|
args = parser.parse_args()
|
|
61
|
-
|
|
62
|
-
print(_pyright_to_gitlab(prefix=args.prefix)) # noqa: T201
|
|
88
|
+
args.output.write(_pyright_to_gitlab(input_=args.input, prefix=args.prefix))
|
|
63
89
|
|
|
64
90
|
|
|
65
91
|
if __name__ == "__main__": # pragma: no cover
|
|
@@ -4,6 +4,10 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import io
|
|
6
6
|
import json
|
|
7
|
+
from typing import TYPE_CHECKING
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from pathlib import Path
|
|
7
11
|
|
|
8
12
|
import pytest
|
|
9
13
|
|
|
@@ -93,6 +97,37 @@ def test(
|
|
|
93
97
|
assert json.loads(captured.out) == gitlab
|
|
94
98
|
|
|
95
99
|
|
|
100
|
+
@pytest.mark.parametrize(
|
|
101
|
+
("pyright", "gitlab"),
|
|
102
|
+
[
|
|
103
|
+
({}, []), # Empty input should yield empty output
|
|
104
|
+
(PYRIGHT, GITLAB),
|
|
105
|
+
],
|
|
106
|
+
)
|
|
107
|
+
def test_input_output_file(
|
|
108
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
109
|
+
tmp_path: Path,
|
|
110
|
+
pyright: dict,
|
|
111
|
+
gitlab: list[dict],
|
|
112
|
+
) -> None:
|
|
113
|
+
"""Test that the pyright.json is converted to GitLab Code Quality report format."""
|
|
114
|
+
input_file = tmp_path / "pyright.json"
|
|
115
|
+
input_file.write_text(json.dumps(pyright))
|
|
116
|
+
output_file = tmp_path / "gitlab.json"
|
|
117
|
+
monkeypatch.setattr(
|
|
118
|
+
"sys.argv",
|
|
119
|
+
[
|
|
120
|
+
"pyright_to_gitlab.py",
|
|
121
|
+
"-i",
|
|
122
|
+
input_file.as_posix(),
|
|
123
|
+
"-o",
|
|
124
|
+
output_file.as_posix(),
|
|
125
|
+
],
|
|
126
|
+
)
|
|
127
|
+
main()
|
|
128
|
+
assert json.loads(output_file.read_text("utf-8")) == gitlab
|
|
129
|
+
|
|
130
|
+
|
|
96
131
|
@pytest.mark.parametrize(
|
|
97
132
|
("pyright", "gitlab"),
|
|
98
133
|
[
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
All notable changes to this project will be documented in this file.
|
|
3
|
-
|
|
4
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
5
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## [Upcoming]
|
|
9
|
-
|
|
10
|
-
## [1.0.0] - 2025-06-02
|
|
11
|
-
Initial release.
|
pyright_to_gitlab-1.0.1/PKG-INFO
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: pyright-to-gitlab
|
|
3
|
-
Version: 1.0.1
|
|
4
|
-
Summary: Convert Pyright JSON output to GitLab CI/CD format
|
|
5
|
-
Author: Micha Schöll
|
|
6
|
-
License: MIT License
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2025 Micha Schöll
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
|
18
|
-
copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
-
SOFTWARE.
|
|
27
|
-
License-File: LICENSE
|
|
28
|
-
Requires-Python: >=3.6
|
|
29
|
-
Description-Content-Type: text/markdown
|
|
30
|
-
|
|
31
|
-
# pyright to gitlab
|
|
32
|
-
Simple Python script to convert a pyright --outputjson to a gitlab code-quality report.
|
|
33
|
-
|
|
34
|
-
## Usage
|
|
35
|
-
Run the script with the path to the pyright output file:
|
|
36
|
-
```shell
|
|
37
|
-
$ pip install pyright-to-gitlab
|
|
38
|
-
$ pyright . --outputjson | pyright-to-gitlab > code-quality.json
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Alternatively, the module can be called:
|
|
42
|
-
```shell
|
|
43
|
-
$ pip install pyright-to-gitlab
|
|
44
|
-
$ pyright . --outputjson | python -m pyright_to_gitlab > code-quality.json
|
|
45
|
-
```
|
|
46
|
-
### Custom path prefix
|
|
47
|
-
The `--prefix` option adds a custom prefix to the file paths in the output. This is
|
|
48
|
-
useful if the paths in the pyright output are not relative to the root of the repository.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
```shell
|
|
52
|
-
$ pyright . --outputjson | pyright-to-gitlab --prefix my-app/ > code-quality.json
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## Testing
|
|
56
|
-
To run the tests, execute
|
|
57
|
-
```shell
|
|
58
|
-
$ uv run pytest tests/
|
|
59
|
-
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|