python-ort 0.1.1__py3-none-any.whl
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.
Potentially problematic release.
This version of python-ort might be problematic. Click here for more details.
- ort/__init__.py +18 -0
- ort/models/__init__.py +0 -0
- ort/models/analyzer_configurations.py +43 -0
- ort/models/ort_configuration.py +324 -0
- ort/models/package_manager_configurations.py +21 -0
- ort/models/package_managers.py +34 -0
- ort/models/repository_configuration.py +391 -0
- ort/models/resolutions.py +100 -0
- python_ort-0.1.1.dist-info/METADATA +22 -0
- python_ort-0.1.1.dist-info/RECORD +12 -0
- python_ort-0.1.1.dist-info/WHEEL +4 -0
- python_ort-0.1.1.dist-info/licenses/LICENSE +21 -0
ort/__init__.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
from ort.models.analyzer_configurations import OrtAnalyzerConfigurations
|
|
6
|
+
from ort.models.ort_configuration import OrtConfiguration, Scanner, Severity, Storages
|
|
7
|
+
from ort.models.package_manager_configurations import OrtPackageManagerConfigurations
|
|
8
|
+
from ort.models.package_managers import OrtPackageManagers
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"OrtAnalyzerConfigurations",
|
|
12
|
+
"OrtPackageManagerConfigurations",
|
|
13
|
+
"OrtPackageManagers",
|
|
14
|
+
"OrtConfiguration",
|
|
15
|
+
"Scanner",
|
|
16
|
+
"Severity",
|
|
17
|
+
"Storages",
|
|
18
|
+
]
|
ort/models/__init__.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from pydantic import AnyUrl, BaseModel, ConfigDict, Field
|
|
8
|
+
|
|
9
|
+
from .package_manager_configurations import OrtPackageManagerConfigurations
|
|
10
|
+
from .package_managers import OrtPackageManagers
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class PackageManagerConfigs(BaseModel):
|
|
14
|
+
model_config = ConfigDict(
|
|
15
|
+
extra="forbid",
|
|
16
|
+
)
|
|
17
|
+
must_run_after: list[OrtPackageManagers] | None = Field(None, alias="mustRunAfter")
|
|
18
|
+
options: Any | None = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class Sw360Configuration(BaseModel):
|
|
22
|
+
model_config = ConfigDict(
|
|
23
|
+
extra="forbid",
|
|
24
|
+
)
|
|
25
|
+
rest_url: AnyUrl = Field(..., alias="restUrl")
|
|
26
|
+
auth_url: AnyUrl = Field(..., alias="authUrl")
|
|
27
|
+
username: str
|
|
28
|
+
password: str | None = None
|
|
29
|
+
client_id: str = Field(..., alias="clientId")
|
|
30
|
+
client_password: str | None = Field(None, alias="clientPassword")
|
|
31
|
+
token: str | None = None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class OrtAnalyzerConfigurations(BaseModel):
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
extra="forbid",
|
|
37
|
+
)
|
|
38
|
+
allow_dynamic_versions: bool | None = Field(None, alias="allowDynamicVersions")
|
|
39
|
+
enabled_package_managers: list[OrtPackageManagers] | None = Field(None, alias="enabledPackageManagers")
|
|
40
|
+
disabled_package_managers: list[OrtPackageManagers] | None = Field(None, alias="disabledPackageManagers")
|
|
41
|
+
package_managers: OrtPackageManagerConfigurations | None = Field(None, alias="packageManagers")
|
|
42
|
+
sw360_configuration: Sw360Configuration | None = Field(None, alias="sw360Configuration")
|
|
43
|
+
skip_excluded: bool | None = Field(None, alias="skipExcluded")
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from enum import Enum
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Annotated, Any
|
|
9
|
+
|
|
10
|
+
import yaml
|
|
11
|
+
import yaml.parser
|
|
12
|
+
from pydantic import AnyUrl, BaseModel, ConfigDict, Field, RootModel
|
|
13
|
+
|
|
14
|
+
from .package_manager_configurations import OrtPackageManagerConfigurations
|
|
15
|
+
from .package_managers import OrtPackageManagers
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class AdvisorConfig(RootModel[dict[str, dict[str, Any]] | None]):
|
|
19
|
+
root: dict[str, dict[str, Any]] | None = None
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Sw360Configuration(BaseModel):
|
|
23
|
+
model_config = ConfigDict(
|
|
24
|
+
extra="forbid",
|
|
25
|
+
)
|
|
26
|
+
rest_url: Annotated[AnyUrl, Field(alias="restUrl")]
|
|
27
|
+
auth_url: Annotated[AnyUrl, Field(alias="authUrl")]
|
|
28
|
+
username: str
|
|
29
|
+
password: str | None = None
|
|
30
|
+
client_id: Annotated[str, Field(alias="clientId")]
|
|
31
|
+
client_password: Annotated[str | None, Field(alias="clientPassword")] = None
|
|
32
|
+
token: str | None = None
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class LicenseFilePatterns(BaseModel):
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
extra="forbid",
|
|
38
|
+
)
|
|
39
|
+
license_filenames: Annotated[list[str] | None, Field(alias="licenseFilenames")] = None
|
|
40
|
+
patent_filenames: Annotated[list[str] | None, Field(alias="patentFilenames")] = None
|
|
41
|
+
other_license_filenames: Annotated[list[str] | None, Field(alias="otherLicenseFilenames")] = None
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class Jira(BaseModel):
|
|
45
|
+
model_config = ConfigDict(
|
|
46
|
+
extra="forbid",
|
|
47
|
+
)
|
|
48
|
+
host: str | None = None
|
|
49
|
+
username: str | None = None
|
|
50
|
+
password: str | None = None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class Mail(BaseModel):
|
|
54
|
+
model_config = ConfigDict(
|
|
55
|
+
extra="forbid",
|
|
56
|
+
)
|
|
57
|
+
host_name: Annotated[str | None, Field(alias="hostName")] = None
|
|
58
|
+
username: str | None = None
|
|
59
|
+
password: str | None = None
|
|
60
|
+
port: int | None = None
|
|
61
|
+
use_ssl: Annotated[bool | None, Field(alias="useSsl")] = None
|
|
62
|
+
from_address: Annotated[str | None, Field(alias="fromAddress")] = None
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class ReporterOptions(AdvisorConfig):
|
|
66
|
+
pass
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class LocalFileStorage(BaseModel):
|
|
70
|
+
model_config = ConfigDict(
|
|
71
|
+
extra="forbid",
|
|
72
|
+
)
|
|
73
|
+
directory: str
|
|
74
|
+
compression: bool | None = None
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class S3FileStorage(BaseModel):
|
|
78
|
+
model_config = ConfigDict(
|
|
79
|
+
extra="forbid",
|
|
80
|
+
)
|
|
81
|
+
access_key_id: Annotated[str | None, Field(alias="accessKeyId")] = None
|
|
82
|
+
aws_region: Annotated[str | None, Field(alias="awsRegion")] = None
|
|
83
|
+
bucket_name: Annotated[str, Field(alias="bucketName")]
|
|
84
|
+
compression: bool | None = None
|
|
85
|
+
custom_endpoint: Annotated[str | None, Field(alias="customEndpoint")] = None
|
|
86
|
+
secret_access_key: Annotated[str | None, Field(alias="secretAccessKey")] = None
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class Connection(BaseModel):
|
|
90
|
+
model_config = ConfigDict(
|
|
91
|
+
extra="forbid",
|
|
92
|
+
)
|
|
93
|
+
url: str
|
|
94
|
+
schema_: Annotated[str | None, Field(alias="schema")] = None
|
|
95
|
+
username: str
|
|
96
|
+
password: str | None = None
|
|
97
|
+
sslmode: str | None = None
|
|
98
|
+
sslcert: str | None = None
|
|
99
|
+
sslkey: str | None = None
|
|
100
|
+
sslrootcert: str | None = None
|
|
101
|
+
connection_timeout: Annotated[int | None, Field(alias="connectionTimeout")] = None
|
|
102
|
+
idle_timeout: Annotated[int | None, Field(alias="idleTimeout")] = None
|
|
103
|
+
keepalive_time: Annotated[int | None, Field(alias="keepaliveTime")] = None
|
|
104
|
+
max_lifetime: Annotated[int | None, Field(alias="maxLifetime")] = None
|
|
105
|
+
maximum_pool_size: Annotated[int | None, Field(alias="maximumPoolSize")] = None
|
|
106
|
+
minimum_idle: Annotated[int | None, Field(alias="minimumIdle")] = None
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class DetectedLicenseMapping(RootModel[dict[str, str] | None]):
|
|
110
|
+
root: dict[str, str] | None = None
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class ScannerConfig(AdvisorConfig):
|
|
114
|
+
pass
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
class Storages(AdvisorConfig):
|
|
118
|
+
pass
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class Severity(Enum):
|
|
122
|
+
HINT = "HINT"
|
|
123
|
+
WARNING = "WARNING"
|
|
124
|
+
ERROR = "ERROR"
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class SourceCodeOrigins(Enum):
|
|
128
|
+
ARTIFACT = "ARTIFACT"
|
|
129
|
+
VCS = "VCS"
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
class StorageTypes(Enum):
|
|
133
|
+
AWS = "aws"
|
|
134
|
+
CLEARLY_DEFINED = "clearlyDefined"
|
|
135
|
+
HTTP = "http"
|
|
136
|
+
LOCAL = "local"
|
|
137
|
+
POSTGRES = "postgres"
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
class Headers(RootModel[dict[str, bool | float | str] | None]):
|
|
141
|
+
root: dict[str, bool | float | str] | None = None
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
class Advisor(BaseModel):
|
|
145
|
+
model_config = ConfigDict(
|
|
146
|
+
extra="forbid",
|
|
147
|
+
)
|
|
148
|
+
skip_excluded: Annotated[bool | None, Field(alias="skipExcluded")] = None
|
|
149
|
+
config: AdvisorConfig | None = None
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
class Downloader(BaseModel):
|
|
153
|
+
model_config = ConfigDict(
|
|
154
|
+
extra="forbid",
|
|
155
|
+
)
|
|
156
|
+
allow_moving_revisions: Annotated[bool | None, Field(alias="allowMovingRevisions")] = None
|
|
157
|
+
included_license_categories: Annotated[list[str] | None, Field(alias="includedLicenseCategories")] = None
|
|
158
|
+
skip_excluded: Annotated[bool | None, Field(alias="skipExcluded")] = None
|
|
159
|
+
source_code_origins: Annotated[list[SourceCodeOrigins] | None, Field(alias="sourceCodeOrigins")] = None
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
class Notifier(BaseModel):
|
|
163
|
+
model_config = ConfigDict(
|
|
164
|
+
extra="forbid",
|
|
165
|
+
)
|
|
166
|
+
mail: Mail | None = None
|
|
167
|
+
jira: Jira | None = None
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
class Reporter(BaseModel):
|
|
171
|
+
model_config = ConfigDict(
|
|
172
|
+
extra="forbid",
|
|
173
|
+
)
|
|
174
|
+
config: ReporterOptions
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
class HttpFileStorage(BaseModel):
|
|
178
|
+
model_config = ConfigDict(
|
|
179
|
+
extra="forbid",
|
|
180
|
+
)
|
|
181
|
+
url: AnyUrl
|
|
182
|
+
query: str | None = None
|
|
183
|
+
headers: Headers | None = None
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
class PostgresConfig(BaseModel):
|
|
187
|
+
model_config = ConfigDict(
|
|
188
|
+
extra="forbid",
|
|
189
|
+
)
|
|
190
|
+
connection: Connection
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
class AnalyzerConfigurationSchema(BaseModel):
|
|
194
|
+
"""
|
|
195
|
+
Configurations for package managers used by the The OSS-Review-Toolkit (ORT).
|
|
196
|
+
A full list of all available options can be found at
|
|
197
|
+
https://github.com/oss-review-toolkit/ort/blob/main/model/src/main/kotlin/config/AnalyzerConfiguration.kt.
|
|
198
|
+
"""
|
|
199
|
+
|
|
200
|
+
model_config = ConfigDict(
|
|
201
|
+
extra="forbid",
|
|
202
|
+
)
|
|
203
|
+
allow_dynamic_versions: Annotated[bool | None, Field(alias="allowDynamicVersions")] = None
|
|
204
|
+
enabled_package_managers: Annotated[list[OrtPackageManagers] | None, Field(alias="enabledPackageManagers")] = None
|
|
205
|
+
disabled_package_managers: Annotated[list[OrtPackageManagers] | None, Field(alias="disabledPackageManagers")] = None
|
|
206
|
+
package_managers: Annotated[OrtPackageManagerConfigurations | None, Field(alias="packageManagers")] = None
|
|
207
|
+
sw360_configuration: Annotated[Sw360Configuration | None, Field(alias="sw360Configuration")] = None
|
|
208
|
+
skip_excluded: Annotated[bool | None, Field(alias="skipExcluded")] = None
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
class FileStorage1(BaseModel):
|
|
212
|
+
model_config = ConfigDict(
|
|
213
|
+
extra="forbid",
|
|
214
|
+
)
|
|
215
|
+
local_file_storage: Annotated[LocalFileStorage, Field(alias="localFileStorage")]
|
|
216
|
+
http_file_storage: Annotated[HttpFileStorage | None, Field(alias="httpFileStorage")] = None
|
|
217
|
+
s3_file_storage: Annotated[S3FileStorage | None, Field(alias="s3FileStorage")] = None
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
class FileStorage2(BaseModel):
|
|
221
|
+
model_config = ConfigDict(
|
|
222
|
+
extra="forbid",
|
|
223
|
+
)
|
|
224
|
+
local_file_storage: Annotated[LocalFileStorage | None, Field(alias="localFileStorage")] = None
|
|
225
|
+
http_file_storage: Annotated[HttpFileStorage, Field(alias="httpFileStorage")]
|
|
226
|
+
s3_file_storage: Annotated[S3FileStorage | None, Field(alias="s3FileStorage")] = None
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
class FileStorage3(BaseModel):
|
|
230
|
+
model_config = ConfigDict(
|
|
231
|
+
extra="forbid",
|
|
232
|
+
)
|
|
233
|
+
local_file_storage: Annotated[LocalFileStorage | None, Field(alias="localFileStorage")] = None
|
|
234
|
+
http_file_storage: Annotated[HttpFileStorage | None, Field(alias="httpFileStorage")] = None
|
|
235
|
+
s3_file_storage: Annotated[S3FileStorage, Field(alias="s3FileStorage")]
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
class FileStorage(RootModel[FileStorage1 | FileStorage2 | FileStorage3]):
|
|
239
|
+
root: FileStorage1 | FileStorage2 | FileStorage3
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
class ProvenanceStorage(BaseModel):
|
|
243
|
+
model_config = ConfigDict(
|
|
244
|
+
extra="forbid",
|
|
245
|
+
)
|
|
246
|
+
file_storage: Annotated[FileStorage | None, Field(alias="fileStorage")] = None
|
|
247
|
+
postgres_storage: Annotated[PostgresConfig | None, Field(alias="postgresStorage")] = None
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
class Analyzer(RootModel[AnalyzerConfigurationSchema]):
|
|
251
|
+
root: AnalyzerConfigurationSchema
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
class Archive(BaseModel):
|
|
255
|
+
model_config = ConfigDict(
|
|
256
|
+
extra="forbid",
|
|
257
|
+
)
|
|
258
|
+
enabled: bool | None = None
|
|
259
|
+
file_storage: Annotated[FileStorage | None, Field(alias="fileStorage")] = None
|
|
260
|
+
postgres_storage: Annotated[PostgresConfig | None, Field(alias="postgresStorage")] = None
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
class FileListStorage(ProvenanceStorage):
|
|
264
|
+
pass
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
class Scanner(BaseModel):
|
|
268
|
+
model_config = ConfigDict(
|
|
269
|
+
extra="forbid",
|
|
270
|
+
)
|
|
271
|
+
skip_concluded: Annotated[bool | None, Field(alias="skipConcluded")] = None
|
|
272
|
+
skip_excluded: Annotated[bool | None, Field(alias="skipExcluded")] = None
|
|
273
|
+
archive: Archive | None = None
|
|
274
|
+
detected_license_mapping: Annotated[DetectedLicenseMapping | None, Field(alias="detectedLicenseMapping")] = None
|
|
275
|
+
file_list_storage: Annotated[FileListStorage | None, Field(alias="fileListStorage")] = None
|
|
276
|
+
config: ScannerConfig | None = None
|
|
277
|
+
storages: Storages | None = None
|
|
278
|
+
storage_readers: Annotated[list[StorageTypes] | None, Field(alias="storageReaders")] = None
|
|
279
|
+
storage_writers: Annotated[list[StorageTypes] | None, Field(alias="storageWriters")] = None
|
|
280
|
+
ignore_patterns: Annotated[list[str] | None, Field(alias="ignorePatterns")] = None
|
|
281
|
+
provenance_storage: Annotated[ProvenanceStorage | None, Field(alias="provenanceStorage")] = None
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
class Ort(BaseModel):
|
|
285
|
+
license_file_patterns: Annotated[LicenseFilePatterns | None, Field(alias="licenseFilePatterns")] = None
|
|
286
|
+
severe_issue_threshold: Annotated[Severity | None, Field(alias="severeIssueThreshold")] = None
|
|
287
|
+
severe_rule_violation_threshold: Annotated[Severity | None, Field(alias="severeRuleViolationThreshold")] = None
|
|
288
|
+
enable_repository_package_curations: Annotated[bool | None, Field(alias="enableRepositoryPackageCurations")] = None
|
|
289
|
+
enable_repository_package_configurations: Annotated[
|
|
290
|
+
bool | None, Field(alias="enableRepositoryPackageConfigurations")
|
|
291
|
+
] = None
|
|
292
|
+
analyzer: Analyzer | None = None
|
|
293
|
+
advisor: Advisor | None = None
|
|
294
|
+
downloader: Downloader | None = None
|
|
295
|
+
scanner: Scanner | None = None
|
|
296
|
+
reporter: Reporter | None = None
|
|
297
|
+
notifier: Notifier | None = None
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
class OrtConfiguration(BaseModel):
|
|
301
|
+
"""
|
|
302
|
+
The main configuration file for the OSS-Review-Toolkit (ORT).
|
|
303
|
+
A full list of all available options can be found at
|
|
304
|
+
https://github.com/oss-review-toolkit/ort/blob/main/model/src/main/resources/reference.yml.
|
|
305
|
+
"""
|
|
306
|
+
|
|
307
|
+
ort: Ort
|
|
308
|
+
|
|
309
|
+
def __init__(self, ort_file: str | Path | None = None, **data: dict[str, Any]) -> None:
|
|
310
|
+
if ort_file:
|
|
311
|
+
if isinstance(ort_file, str):
|
|
312
|
+
ort_file = Path(ort_file)
|
|
313
|
+
try:
|
|
314
|
+
with ort_file.open() as fp:
|
|
315
|
+
model = yaml.safe_load(fp)
|
|
316
|
+
data.update(model)
|
|
317
|
+
except FileNotFoundError as e:
|
|
318
|
+
raise ValueError(e)
|
|
319
|
+
except yaml.parser.ParserError as e:
|
|
320
|
+
print(f"Error decoding YAML from {ort_file}")
|
|
321
|
+
raise ValueError(e)
|
|
322
|
+
except Exception as e:
|
|
323
|
+
raise ValueError(e)
|
|
324
|
+
super().__init__(**data)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from pydantic import BaseModel, ConfigDict, Field, RootModel
|
|
8
|
+
|
|
9
|
+
from .package_managers import OrtPackageManagers
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class PackageManagerConfigs(BaseModel):
|
|
13
|
+
model_config = ConfigDict(
|
|
14
|
+
extra="forbid",
|
|
15
|
+
)
|
|
16
|
+
must_run_after: list[OrtPackageManagers] | None = Field(None, alias="mustRunAfter")
|
|
17
|
+
options: Any | None = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class OrtPackageManagerConfigurations(RootModel[dict[str, PackageManagerConfigs]]):
|
|
21
|
+
root: dict[str, PackageManagerConfigs]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
from enum import Enum
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class OrtPackageManagers(Enum):
|
|
9
|
+
bazel = "Bazel"
|
|
10
|
+
bower = "Bower"
|
|
11
|
+
bundler = "Bundler"
|
|
12
|
+
cargo = "Cargo"
|
|
13
|
+
carthage = "Carthage"
|
|
14
|
+
cocoa_pods = "CocoaPods"
|
|
15
|
+
composer = "Composer"
|
|
16
|
+
conan = "Conan"
|
|
17
|
+
go_mod = "GoMod"
|
|
18
|
+
gradle = "Gradle"
|
|
19
|
+
gradle_inspector = "GradleInspector"
|
|
20
|
+
maven = "Maven"
|
|
21
|
+
npm = "NPM"
|
|
22
|
+
nu_get = "NuGet"
|
|
23
|
+
pip = "PIP"
|
|
24
|
+
pipenv = "Pipenv"
|
|
25
|
+
pnpm = "PNPM"
|
|
26
|
+
poetry = "Poetry"
|
|
27
|
+
pub = "Pub"
|
|
28
|
+
sbt = "SBT"
|
|
29
|
+
spdx_document_file = "SpdxDocumentFile"
|
|
30
|
+
stack = "Stack"
|
|
31
|
+
swift_pm = "SwiftPM"
|
|
32
|
+
unmanaged = "Unmanaged"
|
|
33
|
+
yarn = "Yarn"
|
|
34
|
+
yarn2 = "Yarn2"
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
from enum import Enum
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from pydantic import BaseModel, ConfigDict, Field, RootModel
|
|
9
|
+
|
|
10
|
+
from .analyzer_configurations import OrtAnalyzerConfigurations
|
|
11
|
+
from .package_manager_configurations import OrtPackageManagerConfigurations
|
|
12
|
+
from .package_managers import OrtPackageManagers
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class OrtRepositoryConfigurationLicenseChoicesPackageLicenseChoiceLicenseChoice(BaseModel):
|
|
16
|
+
given: str | None = None
|
|
17
|
+
choice: str
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class OrtRepositoryConfigurationLicenseChoicesPackageLicenseChoice(BaseModel):
|
|
21
|
+
package_id: str
|
|
22
|
+
license_choices: list[OrtRepositoryConfigurationLicenseChoicesPackageLicenseChoiceLicenseChoice]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class OrtRepositoryConfigurationLicenseChoices(BaseModel):
|
|
26
|
+
package_license_choices: list[OrtRepositoryConfigurationLicenseChoicesPackageLicenseChoice] | None = None
|
|
27
|
+
repository_license_choices: list[Any] | None = None
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class OrtRepositoryConfigurationSnippetChoiceProvenance(BaseModel):
|
|
31
|
+
url: str
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class OrtRepositoryConfigurationSnippetChoiceChoiceGivenSourceLocation(BaseModel):
|
|
35
|
+
path: str
|
|
36
|
+
start_line: int
|
|
37
|
+
end_line: int
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class OrtRepositoryConfigurationSnippetChoiceChoiceGiven(BaseModel):
|
|
41
|
+
source_location: OrtRepositoryConfigurationSnippetChoiceChoiceGivenSourceLocation | None = None
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class PackageManagerConfigs(BaseModel):
|
|
45
|
+
model_config = ConfigDict(
|
|
46
|
+
extra="forbid",
|
|
47
|
+
)
|
|
48
|
+
must_run_after: list[OrtPackageManagers] | None = None
|
|
49
|
+
options: Any | None = None
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class IssueResolutionReason(Enum):
|
|
53
|
+
build_tool_issue = "BUILD_TOOL_ISSUE"
|
|
54
|
+
cant_fix_issue = "CANT_FIX_ISSUE"
|
|
55
|
+
scanner_issue = "SCANNER_ISSUE"
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class RuleViolationResolutionReason(Enum):
|
|
59
|
+
cant_fix_exception = "CANT_FIX_EXCEPTION"
|
|
60
|
+
dynamic_linkage_exception = "DYNAMIC_LINKAGE_EXCEPTION"
|
|
61
|
+
example_of_exception = "EXAMPLE_OF_EXCEPTION"
|
|
62
|
+
license_acquired_exception = "LICENSE_ACQUIRED_EXCEPTION"
|
|
63
|
+
not_modified_exception = "NOT_MODIFIED_EXCEPTION"
|
|
64
|
+
patent_grant_exception = "PATENT_GRANT_EXCEPTION"
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class VulnerabilityResolutionReason(Enum):
|
|
68
|
+
cant_fix_vulnerability = "CANT_FIX_VULNERABILITY"
|
|
69
|
+
ineffective_vulnerability = "INEFFECTIVE_VULNERABILITY"
|
|
70
|
+
invalid_match_vulnerability = "INVALID_MATCH_VULNERABILITY"
|
|
71
|
+
mitigated_vulnerability = "MITIGATED_VULNERABILITY"
|
|
72
|
+
not_a_vulnerability = "NOT_A_VULNERABILITY"
|
|
73
|
+
will_not_fix_vulnerability = "WILL_NOT_FIX_VULNERABILITY"
|
|
74
|
+
workaround_for_vulnerability = "WORKAROUND_FOR_VULNERABILITY"
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class VcsMatcherVcsMatcher(BaseModel):
|
|
78
|
+
path: str | None = None
|
|
79
|
+
revision: str | None = None
|
|
80
|
+
type: str
|
|
81
|
+
url: str | None = None
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class VcsMatcherVcsMatcher1(BaseModel):
|
|
85
|
+
path: str | None = None
|
|
86
|
+
revision: str | None = None
|
|
87
|
+
type: str | None = None
|
|
88
|
+
url: str
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class VcsMatcherVcsMatcher2(BaseModel):
|
|
92
|
+
path: str | None = None
|
|
93
|
+
revision: str
|
|
94
|
+
type: str | None = None
|
|
95
|
+
url: str | None = None
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class VcsMatcherVcsMatcher3(BaseModel):
|
|
99
|
+
path: str
|
|
100
|
+
revision: str | None = None
|
|
101
|
+
type: str | None = None
|
|
102
|
+
url: str | None = None
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class VcsMatcher(
|
|
106
|
+
RootModel[VcsMatcherVcsMatcher | VcsMatcherVcsMatcher1 | VcsMatcherVcsMatcher2 | VcsMatcherVcsMatcher3]
|
|
107
|
+
):
|
|
108
|
+
root: VcsMatcherVcsMatcher | VcsMatcherVcsMatcher1 | VcsMatcherVcsMatcher2 | VcsMatcherVcsMatcher3
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
class Hash(BaseModel):
|
|
112
|
+
value: str
|
|
113
|
+
algorithm: str
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class PackageConfigurationSchemaSourceCodeOrigin(Enum):
|
|
117
|
+
vcs = "VCS"
|
|
118
|
+
artifact = "ARTIFACT"
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class PackageConfigurationSchemaLicenseFindingCurationReason(Enum):
|
|
122
|
+
code = "CODE"
|
|
123
|
+
data_of = "DATA_OF"
|
|
124
|
+
documentation_of = "DOCUMENTATION_OF"
|
|
125
|
+
incorrect = "INCORRECT"
|
|
126
|
+
not_detected = "NOT_DETECTED"
|
|
127
|
+
reference = "REFERENCE"
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
class LicenseFindingCurations(BaseModel):
|
|
131
|
+
comment: str | None = None
|
|
132
|
+
concluded_license: str
|
|
133
|
+
detected_license: str | None = None
|
|
134
|
+
line_count: int | None = None
|
|
135
|
+
path: str
|
|
136
|
+
reason: PackageConfigurationSchemaLicenseFindingCurationReason
|
|
137
|
+
start_lines: int | str | None = None
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
class PathExcludeReason(Enum):
|
|
141
|
+
build_tool_of = "BUILD_TOOL_OF"
|
|
142
|
+
data_file_of = "DATA_FILE_OF"
|
|
143
|
+
documentation_of = "DOCUMENTATION_OF"
|
|
144
|
+
example_of = "EXAMPLE_OF"
|
|
145
|
+
optional_component_of = "OPTIONAL_COMPONENT_OF"
|
|
146
|
+
other = "OTHER"
|
|
147
|
+
provided_by = "PROVIDED_BY"
|
|
148
|
+
test_of = "TEST_OF"
|
|
149
|
+
test_tool_of = "TEST_TOOL_OF"
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
VcsMatcherVcsMatcher4 = VcsMatcherVcsMatcher
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
VcsMatcherVcsMatcher5 = VcsMatcherVcsMatcher1
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
VcsMatcherVcsMatcher6 = VcsMatcherVcsMatcher2
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
VcsMatcherVcsMatcher7 = VcsMatcherVcsMatcher3
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class VcsMatcherModel(
|
|
165
|
+
RootModel[VcsMatcherVcsMatcher4 | VcsMatcherVcsMatcher5 | VcsMatcherVcsMatcher6 | VcsMatcherVcsMatcher7]
|
|
166
|
+
):
|
|
167
|
+
root: VcsMatcherVcsMatcher4 | VcsMatcherVcsMatcher5 | VcsMatcherVcsMatcher6 | VcsMatcherVcsMatcher7
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
class PathIncludeReason(Enum):
|
|
171
|
+
source_of = "SOURCE_OF"
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
class ScopeExcludeReason(Enum):
|
|
175
|
+
build_dependency_of = "BUILD_DEPENDENCY_OF"
|
|
176
|
+
dev_dependency_of = "DEV_DEPENDENCY_OF"
|
|
177
|
+
documentation_dependency_of = "DOCUMENTATION_DEPENDENCY_OF"
|
|
178
|
+
provided_dependency_of = "PROVIDED_DEPENDENCY_OF"
|
|
179
|
+
test_dependency_of = "TEST_DEPENDENCY_OF"
|
|
180
|
+
runtime_dependency_of = "RUNTIME_DEPENDENCY_OF"
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
class SnippetChoiceReason(Enum):
|
|
184
|
+
no_relevant_finding = "NO_RELEVANT_FINDING"
|
|
185
|
+
original_finding = "ORIGINAL_FINDING"
|
|
186
|
+
other = "OTHER"
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
class OrtRepositoryConfigurationIncludesPath(BaseModel):
|
|
190
|
+
pattern: str = Field(
|
|
191
|
+
...,
|
|
192
|
+
description="A glob to match the path of the project definition file, relative to the root of the repository.",
|
|
193
|
+
)
|
|
194
|
+
reason: PathIncludeReason
|
|
195
|
+
comment: str | None = None
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
class OrtRepositoryConfigurationIncludes(BaseModel):
|
|
199
|
+
paths: list[OrtRepositoryConfigurationIncludesPath] | None = None
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
class OrtRepositoryConfigurationExcludesPath(BaseModel):
|
|
203
|
+
pattern: str = Field(
|
|
204
|
+
...,
|
|
205
|
+
description="A glob to match the path of the project definition file, relative to the root of the repository.",
|
|
206
|
+
)
|
|
207
|
+
reason: PathExcludeReason
|
|
208
|
+
comment: str | None = None
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
class OrtRepositoryConfigurationExcludesScope(BaseModel):
|
|
212
|
+
pattern: str
|
|
213
|
+
reason: ScopeExcludeReason
|
|
214
|
+
comment: str | None = None
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
class OrtRepositoryConfigurationExcludes(BaseModel):
|
|
218
|
+
paths: list[OrtRepositoryConfigurationExcludesPath] | None = None
|
|
219
|
+
scopes: list[OrtRepositoryConfigurationExcludesScope] | None = None
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
class OrtRepositoryConfigurationSnippetChoiceChoiceChoice(BaseModel):
|
|
223
|
+
purl: str | None = None
|
|
224
|
+
reason: SnippetChoiceReason
|
|
225
|
+
comment: str | None = None
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
class OrtRepositoryConfigurationSnippetChoiceChoice(BaseModel):
|
|
229
|
+
given: OrtRepositoryConfigurationSnippetChoiceChoiceGiven
|
|
230
|
+
choice: OrtRepositoryConfigurationSnippetChoiceChoiceChoice
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
class OrtRepositoryConfigurationSnippetChoice(BaseModel):
|
|
234
|
+
provenance: OrtRepositoryConfigurationSnippetChoiceProvenance
|
|
235
|
+
choices: list[OrtRepositoryConfigurationSnippetChoiceChoice]
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
class PackageManagerConfigurationSchema(RootModel[dict[str, PackageManagerConfigs]]):
|
|
239
|
+
root: dict[str, PackageManagerConfigs]
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
class ResolutionsSchemaResolutionsSchemaIssue(BaseModel):
|
|
243
|
+
message: str
|
|
244
|
+
reason: IssueResolutionReason
|
|
245
|
+
comment: str | None = None
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
class ResolutionsSchemaResolutionsSchemaRuleViolation(BaseModel):
|
|
249
|
+
message: str
|
|
250
|
+
reason: RuleViolationResolutionReason
|
|
251
|
+
comment: str | None = None
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
class ResolutionsSchemaResolutionsSchemaVulnerability(BaseModel):
|
|
255
|
+
id: str
|
|
256
|
+
reason: VulnerabilityResolutionReason
|
|
257
|
+
comment: str | None = None
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
class ResolutionsSchemaResolutionsSchema(BaseModel):
|
|
261
|
+
issues: list[ResolutionsSchemaResolutionsSchemaIssue]
|
|
262
|
+
rule_violations: list[ResolutionsSchemaResolutionsSchemaRuleViolation] | None = None
|
|
263
|
+
vulnerabilities: list[ResolutionsSchemaResolutionsSchemaVulnerability] | None = None
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
ResolutionsSchemaResolutionsSchema1Issue = ResolutionsSchemaResolutionsSchemaIssue
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
ResolutionsSchemaResolutionsSchema1RuleViolation = ResolutionsSchemaResolutionsSchemaRuleViolation
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
ResolutionsSchemaResolutionsSchema1Vulnerability = ResolutionsSchemaResolutionsSchemaVulnerability
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
class ResolutionsSchemaResolutionsSchema1(BaseModel):
|
|
276
|
+
issues: list[ResolutionsSchemaResolutionsSchema1Issue] | None = None
|
|
277
|
+
rule_violations: list[ResolutionsSchemaResolutionsSchema1RuleViolation]
|
|
278
|
+
vulnerabilities: list[ResolutionsSchemaResolutionsSchema1Vulnerability] | None = None
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
ResolutionsSchemaResolutionsSchema2Issue = ResolutionsSchemaResolutionsSchemaIssue
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
ResolutionsSchemaResolutionsSchema2RuleViolation = ResolutionsSchemaResolutionsSchemaRuleViolation
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
ResolutionsSchemaResolutionsSchema2Vulnerability = ResolutionsSchemaResolutionsSchemaVulnerability
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
class ResolutionsSchemaResolutionsSchema2(BaseModel):
|
|
291
|
+
issues: list[ResolutionsSchemaResolutionsSchema2Issue] | None = None
|
|
292
|
+
rule_violations: list[ResolutionsSchemaResolutionsSchema2RuleViolation] | None = None
|
|
293
|
+
vulnerabilities: list[ResolutionsSchemaResolutionsSchema2Vulnerability]
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
class ResolutionsSchema(
|
|
297
|
+
RootModel[
|
|
298
|
+
ResolutionsSchemaResolutionsSchema | ResolutionsSchemaResolutionsSchema1 | ResolutionsSchemaResolutionsSchema2
|
|
299
|
+
]
|
|
300
|
+
):
|
|
301
|
+
root: (
|
|
302
|
+
ResolutionsSchemaResolutionsSchema | ResolutionsSchemaResolutionsSchema1 | ResolutionsSchemaResolutionsSchema2
|
|
303
|
+
) = Field(
|
|
304
|
+
...,
|
|
305
|
+
description="The OSS-Review-Toolkit (ORT) provides a possibility to resolve issues, rule violations and"
|
|
306
|
+
"security vulnerabilities in a resolutions file. A full list of all available options can be found at"
|
|
307
|
+
"https://oss-review-toolkit.org/ort/docs/configuration/resolutions.",
|
|
308
|
+
title="ORT resolutions",
|
|
309
|
+
)
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
class CurationsSchemaCurationsSchemaItemCurationsBinaryArtifact(BaseModel):
|
|
313
|
+
url: str
|
|
314
|
+
hash: Hash
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
CurationsSchemaCurationsSchemaItemCurationsSourceArtifact = CurationsSchemaCurationsSchemaItemCurationsBinaryArtifact
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
class CurationsSchemaCurationsSchemaItemCurations(BaseModel):
|
|
321
|
+
comment: str | None = None
|
|
322
|
+
authors: list[str] | None = None
|
|
323
|
+
concluded_license: str | None = None
|
|
324
|
+
cpe: str | None = None
|
|
325
|
+
declared_license_mapping: dict[str, Any] | None = None
|
|
326
|
+
description: str | None = None
|
|
327
|
+
homepage_url: str | None = None
|
|
328
|
+
purl: str | None = None
|
|
329
|
+
binary_artifact: CurationsSchemaCurationsSchemaItemCurationsBinaryArtifact | None = None
|
|
330
|
+
source_artifact: CurationsSchemaCurationsSchemaItemCurationsSourceArtifact | None = None
|
|
331
|
+
vcs: VcsMatcher | None = None
|
|
332
|
+
is_metadata_only: bool | None = None
|
|
333
|
+
is_modified: bool | None = None
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
class CurationsSchemaCurationsSchemaItem(BaseModel):
|
|
337
|
+
id: str
|
|
338
|
+
curations: CurationsSchemaCurationsSchemaItemCurations
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
class CurationsSchema(RootModel[list[CurationsSchemaCurationsSchemaItem]]):
|
|
342
|
+
root: list[CurationsSchemaCurationsSchemaItem] = Field(
|
|
343
|
+
...,
|
|
344
|
+
description="The OSS-Review-Toolkit (ORT) provides a possibility to correct metadata and set"
|
|
345
|
+
"the concluded license for a specific packages (dependencies) in curation files. A full list of all available"
|
|
346
|
+
"options can be found at https://oss-review-toolkit.org/ort/docs/configuration/package-curations.",
|
|
347
|
+
title="ORT curations",
|
|
348
|
+
)
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
class LicenseFindingCurationsModel(BaseModel):
|
|
352
|
+
path: str
|
|
353
|
+
start_lines: int | str | None = None
|
|
354
|
+
line_count: int | None = None
|
|
355
|
+
detected_license: str | None = None
|
|
356
|
+
concluded_license: str
|
|
357
|
+
reason: PackageConfigurationSchemaLicenseFindingCurationReason
|
|
358
|
+
comment: str | None = None
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
class OrtRepositoryConfigurationCurations(BaseModel):
|
|
362
|
+
license_findings: list[LicenseFindingCurationsModel]
|
|
363
|
+
packages: CurationsSchema | None = None
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
class OrtRepositoryConfigurationCurations1(BaseModel):
|
|
367
|
+
license_findings: list[LicenseFindingCurationsModel] | None = None
|
|
368
|
+
packages: CurationsSchema
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
class OrtRepositoryConfiguration(BaseModel):
|
|
372
|
+
analyzer: OrtAnalyzerConfigurations | None = None
|
|
373
|
+
includes: OrtRepositoryConfigurationIncludes | None = Field(
|
|
374
|
+
None, description="Defines which parts of a repository should be included."
|
|
375
|
+
)
|
|
376
|
+
excludes: OrtRepositoryConfigurationExcludes | None = Field(
|
|
377
|
+
None, description="Defines which parts of a repository should be excluded."
|
|
378
|
+
)
|
|
379
|
+
resolutions: ResolutionsSchema | None = None
|
|
380
|
+
curations: OrtRepositoryConfigurationCurations | OrtRepositoryConfigurationCurations1 | None = Field(
|
|
381
|
+
None, description="Curations for artifacts in a repository."
|
|
382
|
+
)
|
|
383
|
+
package_configurations: list[OrtPackageManagerConfigurations] | None = Field(
|
|
384
|
+
None, description="A configuration for a specific package and provenance."
|
|
385
|
+
)
|
|
386
|
+
license_choices: OrtRepositoryConfigurationLicenseChoices | None = Field(
|
|
387
|
+
None, description="A configuration to select a license from a multi-licensed package."
|
|
388
|
+
)
|
|
389
|
+
snippet_choices: list[OrtRepositoryConfigurationSnippetChoice] | None = Field(
|
|
390
|
+
None, description="A configuration to select a snippet from a package with multiple snippet findings."
|
|
391
|
+
)
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from enum import Enum
|
|
7
|
+
from typing import Annotated
|
|
8
|
+
|
|
9
|
+
from pydantic import BaseModel, Field, RootModel
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class IssueResolutionReason(Enum):
|
|
13
|
+
BUILD_TOOL_ISSUE = "BUILD_TOOL_ISSUE"
|
|
14
|
+
CANT_FIX_ISSUE = "CANT_FIX_ISSUE"
|
|
15
|
+
SCANNER_ISSUE = "SCANNER_ISSUE"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class RuleViolationResolutionReason(Enum):
|
|
19
|
+
CANT_FIX_EXCEPTION = "CANT_FIX_EXCEPTION"
|
|
20
|
+
DYNAMIC_LINKAGE_EXCEPTION = "DYNAMIC_LINKAGE_EXCEPTION"
|
|
21
|
+
EXAMPLE_OF_EXCEPTION = "EXAMPLE_OF_EXCEPTION"
|
|
22
|
+
LICENSE_ACQUIRED_EXCEPTION = "LICENSE_ACQUIRED_EXCEPTION"
|
|
23
|
+
NOT_MODIFIED_EXCEPTION = "NOT_MODIFIED_EXCEPTION"
|
|
24
|
+
PATENT_GRANT_EXCEPTION = "PATENT_GRANT_EXCEPTION"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class VulnerabilityResolutionReason(Enum):
|
|
28
|
+
CANT_FIX_VULNERABILITY = "CANT_FIX_VULNERABILITY"
|
|
29
|
+
INEFFECTIVE_VULNERABILITY = "INEFFECTIVE_VULNERABILITY"
|
|
30
|
+
INVALID_MATCH_VULNERABILITY = "INVALID_MATCH_VULNERABILITY"
|
|
31
|
+
MITIGATED_VULNERABILITY = "MITIGATED_VULNERABILITY"
|
|
32
|
+
NOT_A_VULNERABILITY = "NOT_A_VULNERABILITY"
|
|
33
|
+
WILL_NOT_FIX_VULNERABILITY = "WILL_NOT_FIX_VULNERABILITY"
|
|
34
|
+
WORKAROUND_FOR_VULNERABILITY = "WORKAROUND_FOR_VULNERABILITY"
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class Issue(BaseModel):
|
|
38
|
+
message: str
|
|
39
|
+
reason: IssueResolutionReason
|
|
40
|
+
comment: str | None = None
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class RuleViolation(BaseModel):
|
|
44
|
+
message: str
|
|
45
|
+
reason: RuleViolationResolutionReason
|
|
46
|
+
comment: str | None = None
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class Vulnerability(BaseModel):
|
|
50
|
+
id: str
|
|
51
|
+
reason: VulnerabilityResolutionReason
|
|
52
|
+
comment: str | None = None
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class OrtResolutions1(BaseModel):
|
|
56
|
+
"""
|
|
57
|
+
The OSS-Review-Toolkit (ORT) provides a possibility to resolve issues, rule violations and security
|
|
58
|
+
vulnerabilities in a resolutions file. A full list of all available options can be found at
|
|
59
|
+
https://oss-review-toolkit.org/ort/docs/configuration/resolutions.
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
issues: list[Issue]
|
|
63
|
+
rule_violations: list[RuleViolation] | None = None
|
|
64
|
+
vulnerabilities: list[Vulnerability] | None = None
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class OrtResolutions2(BaseModel):
|
|
68
|
+
"""
|
|
69
|
+
The OSS-Review-Toolkit (ORT) provides a possibility to resolve issues, rule violations and
|
|
70
|
+
security vulnerabilities in a resolutions file. A full list of all available options can be
|
|
71
|
+
found at https://oss-review-toolkit.org/ort/docs/configuration/resolutions.
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
issues: list[Issue] | None = None
|
|
75
|
+
rule_violations: list[RuleViolation]
|
|
76
|
+
vulnerabilities: list[Vulnerability] | None = None
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class OrtResolutions3(BaseModel):
|
|
80
|
+
"""
|
|
81
|
+
The OSS-Review-Toolkit (ORT) provides a possibility to resolve issues, rule violations and
|
|
82
|
+
security vulnerabilities in a resolutions file. A full list of all available options can be
|
|
83
|
+
found at https://oss-review-toolkit.org/ort/docs/configuration/resolutions.
|
|
84
|
+
"""
|
|
85
|
+
|
|
86
|
+
issues: list[Issue] | None = None
|
|
87
|
+
rule_violations: list[RuleViolation] | None = None
|
|
88
|
+
vulnerabilities: list[Vulnerability]
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class OrtResolutions(RootModel[OrtResolutions1 | OrtResolutions2 | OrtResolutions3]):
|
|
92
|
+
root: Annotated[
|
|
93
|
+
OrtResolutions1 | OrtResolutions2 | OrtResolutions3,
|
|
94
|
+
Field(title="ORT resolutions"),
|
|
95
|
+
]
|
|
96
|
+
"""
|
|
97
|
+
The OSS-Review-Toolkit (ORT) provides a possibility to resolve issues, rule violations and
|
|
98
|
+
security vulnerabilities in a resolutions file. A full list of all available options can be
|
|
99
|
+
found at https://oss-review-toolkit.org/ort/docs/configuration/resolutions.
|
|
100
|
+
"""
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python-ort
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: A Python Ort model serialization library
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
15
|
+
Requires-Dist: pydantic>=2.11.10
|
|
16
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# Python-Ort
|
|
21
|
+
|
|
22
|
+
Python-Ort is a pydantic based library to serialize OSS Review Toolkit generated reports using the default models.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
ort/__init__.py,sha256=pnZYJbTJPJtRzKlcnMy9YfdR46yaRDj9rsAcB1F06yY,603
|
|
2
|
+
ort/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
ort/models/analyzer_configurations.py,sha256=f0oZrvTj9oCScR2-5INVGQt9AdJBexYLWmpF181_3WE,1613
|
|
4
|
+
ort/models/ort_configuration.py,sha256=n_-PPHm0sveQuq7gOUpEjjrisO_VCrlFNoM67ZaqIfM,11018
|
|
5
|
+
ort/models/package_manager_configurations.py,sha256=-XI5wYuorcJp1NrS4y48jK0aU0wDpGmwpLHYWes9ZPc,599
|
|
6
|
+
ort/models/package_managers.py,sha256=JNfuWP5c5_0sOnJEt1YjZeSo9PePSm80yDwb89nkL94,760
|
|
7
|
+
ort/models/repository_configuration.py,sha256=Z9gRgTyhokpdmx7OGz2-Y3wlmUep0jy-V-1_aRPGymw,12982
|
|
8
|
+
ort/models/resolutions.py,sha256=3OuCC9yYMu5Ovt2UD04ms9zJuWBXtBDjof-8fRzErlw,3423
|
|
9
|
+
python_ort-0.1.1.dist-info/licenses/LICENSE,sha256=koFhbHMglt1BNVuMKdBBlrQcgQsWLgo4pZW6cCtyGvA,1081
|
|
10
|
+
python_ort-0.1.1.dist-info/WHEEL,sha256=n2u5OFBbdZvCiUKAmfnY1Po2j3FB_NWfuUlt5WiAjrk,79
|
|
11
|
+
python_ort-0.1.1.dist-info/METADATA,sha256=-eNIPiytKVhR0IWSw8YkMn451Adm0F_aRhoonjeJ_Mw,830
|
|
12
|
+
python_ort-0.1.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Helio Chissini de Castro
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|