python-ort 0.3.1__tar.gz → 0.4.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.
Files changed (33) hide show
  1. {python_ort-0.3.1 → python_ort-0.4.0}/PKG-INFO +1 -1
  2. {python_ort-0.3.1 → python_ort-0.4.0}/pyproject.toml +1 -1
  3. python_ort-0.4.0/src/ort/__init__.py +9 -0
  4. python_ort-0.4.0/src/ort/models/config/analyzer_configuration.py +77 -0
  5. {python_ort-0.3.1 → python_ort-0.4.0}/src/ort/models/config/license_finding_curation.py +17 -1
  6. python_ort-0.4.0/src/ort/models/config/package_configuration.py +68 -0
  7. python_ort-0.4.0/src/ort/models/config/package_manager_configuration.py +26 -0
  8. python_ort-0.4.0/src/ort/models/config/path_exclude.py +32 -0
  9. python_ort-0.4.0/src/ort/models/config/path_exclude_reason.py +73 -0
  10. python_ort-0.4.0/src/ort/models/config/path_include_reason.py +2 -0
  11. python_ort-0.4.0/src/ort/models/config/repository_analyzer_configuration.py +48 -0
  12. python_ort-0.4.0/src/ort/models/config/vcsmatcher.py +38 -0
  13. python_ort-0.4.0/src/ort/models/identifier.py +63 -0
  14. {python_ort-0.3.1 → python_ort-0.4.0}/src/ort/models/ort_configuration.py +4 -5
  15. python_ort-0.4.0/src/ort/models/package_curation_data.py +57 -0
  16. {python_ort-0.3.1 → python_ort-0.4.0}/src/ort/models/repository_configuration.py +5 -9
  17. python_ort-0.3.1/src/ort/__init__.py +0 -19
  18. python_ort-0.3.1/src/ort/models/analyzer_configurations.py +0 -32
  19. python_ort-0.3.1/src/ort/models/package_curation_data.py +0 -36
  20. python_ort-0.3.1/src/ort/models/package_managers.py +0 -55
  21. {python_ort-0.3.1 → python_ort-0.4.0}/LICENSE +0 -0
  22. {python_ort-0.3.1 → python_ort-0.4.0}/README.md +0 -0
  23. {python_ort-0.3.1 → python_ort-0.4.0}/src/ort/models/__init__.py +0 -0
  24. {python_ort-0.3.1 → python_ort-0.4.0}/src/ort/models/config/curations.py +0 -0
  25. {python_ort-0.3.1 → python_ort-0.4.0}/src/ort/models/config/license_finding_curation_reason.py +0 -0
  26. {python_ort-0.3.1 → python_ort-0.4.0}/src/ort/models/hash.py +0 -0
  27. {python_ort-0.3.1 → python_ort-0.4.0}/src/ort/models/hash_algorithm.py +0 -0
  28. {python_ort-0.3.1 → python_ort-0.4.0}/src/ort/models/package_curation.py +0 -0
  29. {python_ort-0.3.1 → python_ort-0.4.0}/src/ort/models/resolutions.py +0 -0
  30. {python_ort-0.3.1 → python_ort-0.4.0}/src/ort/models/source_code_origin.py +0 -0
  31. {python_ort-0.3.1 → python_ort-0.4.0}/src/ort/models/vcsinfo.py +0 -0
  32. {python_ort-0.3.1 → python_ort-0.4.0}/src/ort/models/vcsinfo_curation_data.py +0 -0
  33. {python_ort-0.3.1 → python_ort-0.4.0}/src/ort/models/vcstype.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-ort
3
- Version: 0.3.1
3
+ Version: 0.4.0
4
4
  Summary: A Python Ort model serialization library
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "python-ort"
7
- version = "0.3.1"
7
+ version = "0.4.0"
8
8
  description = "A Python Ort model serialization library"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -0,0 +1,9 @@
1
+ # SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ from ort.models.repository_configuration import OrtRepositoryConfiguration
6
+
7
+ __all__ = [
8
+ "OrtRepositoryConfiguration",
9
+ ]
@@ -0,0 +1,77 @@
1
+ # SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
2
+ # SPDX-License-Identifier: MIT
3
+
4
+
5
+ from pydantic import BaseModel, ConfigDict, Field
6
+
7
+ from ort.models.config.package_manager_configuration import PackageManagerConfiguration
8
+
9
+ _package_managers: list[str] = [
10
+ "Bazel",
11
+ "Bower",
12
+ "Bundler",
13
+ "Cargo",
14
+ "Carthage",
15
+ "CocoaPods",
16
+ "Composer",
17
+ "Conan",
18
+ "GoMod",
19
+ "GradleInspector",
20
+ "Maven",
21
+ "NPM",
22
+ "NuGet",
23
+ "PIP",
24
+ "Pipenv",
25
+ "PNPM",
26
+ "Poetry",
27
+ "Pub",
28
+ "SBT",
29
+ "SpdxDocumentFile",
30
+ "Stack",
31
+ "SwiftPM",
32
+ "Tycho",
33
+ "Unmanaged",
34
+ "Yarn",
35
+ "Yarn2",
36
+ ]
37
+
38
+
39
+ class AnalyzerConfiguration(BaseModel):
40
+ """
41
+ Enable the analysis of projects that use version ranges to declare their dependencies. If set to true,
42
+ dependencies of exactly the same project might change with another scan done at a later time if any of the
43
+ (transitive) dependencies are declared using version ranges and a new version of such a dependency was
44
+ published in the meantime. If set to false, analysis of projects that use version ranges will fail. Defaults to
45
+ false.
46
+ """
47
+
48
+ model_config = ConfigDict(
49
+ extra="forbid",
50
+ )
51
+ allow_dynamic_versions: bool = Field(
52
+ default=False,
53
+ description="Enable the analysis of projects that use version ranges to declare their dependencies."
54
+ "If set to true, dependencies of exactly the same project might change with another scan done at a later time"
55
+ "if any of the (transitive) dependencies are declared using version ranges and a new version of such a"
56
+ "dependency was published in the meantime. If set to false, analysis of projects that use version ranges will"
57
+ "fail. Defaults to false.",
58
+ )
59
+ enabled_package_managers: list[str] = Field(
60
+ default=_package_managers,
61
+ description="A list of the case-insensitive names of package managers that are enabled."
62
+ "Disabling a package manager in [disabledPackageManagers] overrides enabling it here.",
63
+ )
64
+ disabled_package_managers: list[str] | None = Field(
65
+ default=None,
66
+ description="A list of the case-insensitive names of package managers that are disabled."
67
+ "Disabling a package manager in this list overrides [enabledPackageManagers].",
68
+ )
69
+ package_managers: dict[str, PackageManagerConfiguration] | None = Field(
70
+ default=None,
71
+ description="Get a [PackageManagerConfiguration] from [packageManagers]. The difference to accessing the map"
72
+ "directly is that [packageManager] can be case-insensitive.",
73
+ )
74
+ skip_excluded: bool = Field(
75
+ default=False,
76
+ description="A flag to control whether excluded scopes and paths should be skipped during the analysis.",
77
+ )
@@ -2,7 +2,9 @@
2
2
  # SPDX-License-Identifier: MIT
3
3
 
4
4
 
5
- from pydantic import BaseModel, ConfigDict, Field
5
+ from typing import Any
6
+
7
+ from pydantic import BaseModel, ConfigDict, Field, field_validator
6
8
 
7
9
  from ort.models.config.license_finding_curation_reason import LicenseFindingCurationReason
8
10
 
@@ -59,3 +61,17 @@ class LicenseFindingCuration(BaseModel):
59
61
  default=None,
60
62
  description="A comment explaining this [LicenseFindingCuration].",
61
63
  )
64
+
65
+ @field_validator("start_lines", mode="before")
66
+ @classmethod
67
+ def parse_start_lines(cls, value: Any) -> list[int] | None:
68
+ if value is None or value == "":
69
+ return None
70
+ if isinstance(value, str):
71
+ # CSV style split
72
+ return [int(x.strip()) for x in value.split(",") if x.strip()]
73
+ if isinstance(value, list):
74
+ return [int(x) for x in value]
75
+ if isinstance(value, int):
76
+ return [value]
77
+ raise ValueError("start_lines must be a comma-separated string or a list of integers")
@@ -0,0 +1,68 @@
1
+ # SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
2
+ # SPDX-License-Identifier: MIT
3
+
4
+
5
+ from pydantic import BaseModel, ConfigDict, Field
6
+
7
+ from ort.models.config.license_finding_curation import LicenseFindingCuration
8
+ from ort.models.config.path_exclude import PathExclude
9
+ from ort.models.config.vcsmatcher import VcsMatcher
10
+ from ort.models.identifier import Identifier
11
+ from ort.models.source_code_origin import SourceCodeOrigin
12
+
13
+
14
+ class PackageConfiguration(BaseModel):
15
+ """
16
+ A class used in the [OrtConfiguration] to configure [PathExclude]s and [LicenseFindingCuration]s for a specific
17
+ [Package]'s [Identifier] (and [Provenance]).
18
+ Note that [PathExclude]s and [LicenseFindingCuration]s for [Project]s are configured by a
19
+ [RepositoryConfiguration]'s excludes and curations properties instead.
20
+
21
+ Attributes:
22
+ id (Identifier): The [Identifier] which must match with the identifier of the package in
23
+ order for this package curation to apply. The [version][Identifier.version] can be
24
+ either a plain version string matched for equality, or an Ivy-style version matchers.
25
+ * The other components of the [identifier][id] are matched by equality.
26
+ source_artifact_url (str | None): The source artifact this configuration applies to.
27
+ vcs (VcsMatcher | None): The vcs and revision this configuration applies to.
28
+ source_code_origin (SourceCodeOrigin | None): The source code origin this configuration
29
+ applies to.
30
+ path_excludes (list[PathExclude]): Path excludes.
31
+ license_finding_curations (list[LicenseFindingCuration]): License finding curations.
32
+ """
33
+
34
+ model_config = ConfigDict(
35
+ extra="forbid",
36
+ )
37
+
38
+ id: Identifier = Field(
39
+ description="The [Identifier] which must match with the identifier of the package in order for this package"
40
+ "curation to apply. The [version][Identifier.version] can be either a plain version string matched for"
41
+ "equality, or an Ivy-style version matchers."
42
+ "* The other components of the [identifier][id] are matched by equality.",
43
+ )
44
+
45
+ source_artifact_url: str | None = Field(
46
+ default=None,
47
+ description="The source artifact this configuration applies to.",
48
+ )
49
+
50
+ vcs: VcsMatcher | None = Field(
51
+ default=None,
52
+ description="The vcs and revision this configuration applies to.",
53
+ )
54
+
55
+ source_code_origin: SourceCodeOrigin | None = Field(
56
+ default=None,
57
+ description="The source code origin this configuration applies to.",
58
+ )
59
+
60
+ path_excludes: list[PathExclude] = Field(
61
+ default_factory=list,
62
+ description="Path excludes.",
63
+ )
64
+
65
+ license_finding_curations: list[LicenseFindingCuration] = Field(
66
+ default_factory=list,
67
+ description="License finding curations.",
68
+ )
@@ -0,0 +1,26 @@
1
+ # SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
2
+ # SPDX-License-Identifier: MIT
3
+
4
+
5
+ from pydantic import BaseModel, ConfigDict, Field
6
+
7
+
8
+ class PackageManagerConfiguration(BaseModel):
9
+ model_config = ConfigDict(
10
+ extra="forbid",
11
+ )
12
+
13
+ must_run_after: list[str] | None = Field(
14
+ default=None,
15
+ description="The configuration model for a package manager. This class is (de-)serialized in the following"
16
+ "places:"
17
+ "- Deserialized from config.yml as part of [OrtConfiguration] (via Hoplite)."
18
+ "- Deserialized from .ort.yml as part of [RepositoryAnalyzerConfiguration] (via Jackson)"
19
+ "- (De-)Serialized as part of [org.ossreviewtoolkit.model.OrtResult] (via Jackson).",
20
+ )
21
+
22
+ options: dict[str, str] | None = Field(
23
+ default=None,
24
+ description="Custom configuration options for the package manager. See the documentation of the respective"
25
+ "class for available options.",
26
+ )
@@ -0,0 +1,32 @@
1
+ # SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
2
+ # SPDX-License-Identifier: MIT
3
+
4
+
5
+ from pydantic import BaseModel, ConfigDict, Field
6
+
7
+ from ort.models.config.path_exclude_reason import PathExcludeReason
8
+
9
+
10
+ class PathExclude(BaseModel):
11
+ """
12
+ Defines paths which should be excluded. Each file or directory that is matched by the [glob][pattern] is marked as
13
+ excluded. If a project definition file is matched by the [pattern], the whole project is excluded. For details about
14
+ the glob syntax see the [FileMatcher] implementation.
15
+ """
16
+
17
+ model_config = ConfigDict(
18
+ extra="forbid",
19
+ )
20
+
21
+ pattern: str = Field(
22
+ description="A glob to match the path of the project definition file, relative to the root of the repository."
23
+ )
24
+
25
+ reason: PathExcludeReason = Field(
26
+ description="The reason why the project is excluded, out of a predefined choice.",
27
+ )
28
+
29
+ comment: str = Field(
30
+ default_factory=str,
31
+ description="A comment to further explain why the [reason] is applicable here.",
32
+ )
@@ -0,0 +1,73 @@
1
+ # SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ from enum import Enum, auto
5
+
6
+
7
+ class PathExcludeReason(Enum):
8
+ """
9
+ Possible reasons for excluding a path.
10
+ Attributes
11
+ BUILD_TOOL_OF
12
+ The path only contains tools used for building source code which are not included in
13
+ distributed build artifacts.
14
+
15
+ DATA_FILE_OF
16
+ The path only contains data files such as fonts or images which are not included in
17
+ distributed build artifacts.
18
+
19
+ DOCUMENTATION_OF
20
+ The path only contains documentation which is not included in distributed build artifacts.
21
+
22
+ EXAMPLE_OF
23
+ The path only contains source code examples which are not included in distributed build
24
+ artifacts.
25
+
26
+ OPTIONAL_COMPONENT_OF
27
+ The path only contains optional components for the code that is built which are not included
28
+ in distributed build artifacts.
29
+
30
+ OTHER
31
+ Any other reason which cannot be represented by any other element of PathExcludeReason.
32
+
33
+ PROVIDED_BY
34
+ The path only contains packages or sources for packages that have to be provided by the user
35
+ of distributed build artifacts.
36
+
37
+ TEST_OF
38
+ The path only contains files used for testing source code which are not included in
39
+ distributed build artifacts.
40
+
41
+ TEST_TOOL_OF
42
+ The path only contains tools used for testing source code which are not included in
43
+ distributed build artifacts.
44
+ """
45
+
46
+ # The path only contains tools used for building source code which are not included in distributed build artifacts.
47
+ BUILD_TOOL_OF = auto()
48
+
49
+ # The path only contains data files such as fonts or images which are not included in distributed build artifacts.
50
+ DATA_FILE_OF = auto()
51
+
52
+ # The path only contains documentation which is not included in distributed build artifacts.
53
+ DOCUMENTATION_OF = auto()
54
+
55
+ # The path only contains source code examples which are not included in distributed build artifacts.
56
+ EXAMPLE_OF = auto()
57
+
58
+ # The path only contains optional components for the code that is built which are not included
59
+ # in distributed build artifacts.
60
+ OPTIONAL_COMPONENT_OF = auto()
61
+
62
+ # Any other reason which cannot be represented by any other element of PathExcludeReason.
63
+ OTHER = auto()
64
+
65
+ # The path only contains packages or sources for packages that have to be provided by the user
66
+ # of distributed build artifacts.
67
+ PROVIDED_BY = auto()
68
+
69
+ # The path only contains files used for testing source code which are not included in distributed build artifacts.
70
+ TEST_OF = auto()
71
+
72
+ # The path only contains tools used for testing source code which are not included in distributed build artifacts.
73
+ TEST_TOOL_OF = auto()
@@ -0,0 +1,2 @@
1
+ # SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
2
+ # SPDX-License-Identifier: MIT
@@ -0,0 +1,48 @@
1
+ # SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
2
+ # SPDX-License-Identifier: MIT
3
+
4
+
5
+ from pydantic import BaseModel, ConfigDict, Field
6
+
7
+ from ort.models.config.package_manager_configuration import PackageManagerConfiguration
8
+
9
+
10
+ class RepositoryAnalyzerConfiguration(BaseModel):
11
+ """
12
+ Enable the analysis of projects that use version ranges to declare their dependencies. If set to true,
13
+ dependencies of exactly the same project might change with another scan done at a later time if any of the
14
+ (transitive) dependencies are declared using version ranges and a new version of such a dependency was
15
+ published in the meantime. If set to false, analysis of projects that use version ranges will fail. Defaults to
16
+ false.
17
+ """
18
+
19
+ model_config = ConfigDict(
20
+ extra="forbid",
21
+ )
22
+ allow_dynamic_versions: bool | None = Field(
23
+ default=None,
24
+ description="Enable the analysis of projects that use version ranges to declare their dependencies."
25
+ "If set to true, dependencies of exactly the same project might change with another scan done at a later time"
26
+ "if any of the (transitive) dependencies are declared using version ranges and a new version of such a"
27
+ "dependency was published in the meantime. If set to false, analysis of projects that use version ranges will"
28
+ "fail. Defaults to false.",
29
+ )
30
+ enabled_package_managers: list[str] | None = Field(
31
+ default=None,
32
+ description="A list of the case-insensitive names of package managers that are enabled."
33
+ "Disabling a package manager in [disabledPackageManagers] overrides enabling it here.",
34
+ )
35
+ disabled_package_managers: list[str] | None = Field(
36
+ default=None,
37
+ description="A list of the case-insensitive names of package managers that are disabled."
38
+ "Disabling a package manager in this list overrides [enabledPackageManagers].",
39
+ )
40
+ package_managers: dict[str, PackageManagerConfiguration] | None = Field(
41
+ default=None,
42
+ description="Get a [PackageManagerConfiguration] from [packageManagers]. The difference to accessing the map"
43
+ "directly is that [packageManager] can be case-insensitive.",
44
+ )
45
+ skip_excluded: bool | None = Field(
46
+ default=None,
47
+ description="A flag to control whether excluded scopes and paths should be skipped during the analysis.",
48
+ )
@@ -0,0 +1,38 @@
1
+ # SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
2
+ # SPDX-License-Identifier: MIT
3
+
4
+
5
+ from pydantic import AnyUrl, BaseModel, ConfigDict, Field
6
+
7
+ from ort.models.vcstype import VcsType
8
+
9
+
10
+ class VcsMatcher(BaseModel):
11
+ """
12
+ A matcher which matches its properties against a [RepositoryProvenance].
13
+
14
+ Attributes:
15
+ orttype (VcsType): The [type] to match for equality against [VcsInfo.type].
16
+ url (AnyUrl): The [url] to match for equality against [VcsInfo.url].
17
+ revision (str | None): The revision to match for equality against [RepositoryProvenance.resolvedRevision],
18
+ or null to match any revision.
19
+ """
20
+
21
+ model_config = ConfigDict(
22
+ extra="forbid",
23
+ )
24
+
25
+ orttype: VcsType = Field(
26
+ alias="type",
27
+ description="The [type] to match for equality against [VcsInfo.type].",
28
+ )
29
+
30
+ url: AnyUrl = Field(
31
+ description="The [url] to match for equality against [VcsInfo.url].",
32
+ )
33
+
34
+ revision: str | None = Field(
35
+ default=None,
36
+ description="The revision to match for equality against [RepositoryProvenance.resolvedRevision],"
37
+ "or null to match anyrevision.",
38
+ )
@@ -0,0 +1,63 @@
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, model_validator
8
+
9
+
10
+ class Identifier(BaseModel):
11
+ """
12
+ A unique identifier for a software component.
13
+
14
+ Attributes:
15
+ orttype (str): The type of component this identifier describes. When used in the context of a [Project],
16
+ the type equals the one of the package manager that manages the project (e.g. 'Gradle'
17
+ for a Gradle project). When used in the context of a [Package], the type is the name
18
+ of the artifact ecosystem (e.g. 'Maven' for a file from a Maven repository).
19
+ namespace (str): The namespace of the component, for example the group for 'Maven' or the scope for 'NPM'.
20
+ name (str): The name of the component.
21
+ version (str): The version of the component.
22
+ """
23
+
24
+ model_config = ConfigDict(
25
+ extra="forbid",
26
+ )
27
+
28
+ orttype: str = Field(
29
+ alias="type",
30
+ description="The type of component this identifier describes. When used in the context of a [Project],"
31
+ "the type equals the one of the package manager that manages the project (e.g. 'Gradle' "
32
+ "for a Gradle project). When used in the context of a [Package], the type is the name"
33
+ "of the artifact ecosystem (e.g. 'Maven' for a file from a Maven repository).",
34
+ )
35
+
36
+ namespace: str = Field(
37
+ description="The namespace of the component, for examplethe group for 'Maven' or the scope for 'NPM'.",
38
+ )
39
+
40
+ name: str = Field(
41
+ description="The name of the component.",
42
+ )
43
+
44
+ version: str = Field(
45
+ description="The version of the component.",
46
+ )
47
+
48
+ @model_validator(mode="before")
49
+ @classmethod
50
+ def parse_string_or_dict(cls, value: Any):
51
+ if isinstance(value, dict):
52
+ return value
53
+ if isinstance(value, str):
54
+ parts = value.split(":")
55
+ if len(parts) != 4:
56
+ raise ValueError("Identifier string must be in the format 'type:namespace:name:version'")
57
+ return {
58
+ "type": parts[0],
59
+ "namespace": parts[1],
60
+ "name": parts[2],
61
+ "version": parts[3],
62
+ }
63
+ raise TypeError("Identifier must be a dict or a string in the correct format")
@@ -11,8 +11,6 @@ import yaml
11
11
  import yaml.parser
12
12
  from pydantic import AnyUrl, BaseModel, ConfigDict, Field, RootModel
13
13
 
14
- from .package_managers import OrtPackageManagerConfigurations, OrtPackageManagers
15
-
16
14
 
17
15
  class AdvisorConfig(RootModel[dict[str, dict[str, Any]] | None]):
18
16
  root: dict[str, dict[str, Any]] | None = None
@@ -200,9 +198,10 @@ class AnalyzerConfigurationSchema(BaseModel):
200
198
  extra="forbid",
201
199
  )
202
200
  allow_dynamic_versions: Annotated[bool | None, Field(alias="allowDynamicVersions")] = None
203
- enabled_package_managers: Annotated[list[OrtPackageManagers] | None, Field(alias="enabledPackageManagers")] = None
204
- disabled_package_managers: Annotated[list[OrtPackageManagers] | None, Field(alias="disabledPackageManagers")] = None
205
- package_managers: Annotated[OrtPackageManagerConfigurations | None, Field(alias="packageManagers")] = None
201
+ # enabled_package_managers: Annotated[list[PackageManager] | None, Field(alias="enabledPackageManagers")] = None
202
+ # # disabled_package_managers: Annotated[list[OrtPackageManagers] | None,
203
+ # Field(alias="disabledPackageManagers")] = None
204
+ # package_managers: Annotated[OrtPackageManagerConfigurations | None, Field(alias="packageManagers")] = None
206
205
  sw360_configuration: Annotated[Sw360Configuration | None, Field(alias="sw360Configuration")] = None
207
206
  skip_excluded: Annotated[bool | None, Field(alias="skipExcluded")] = None
208
207
 
@@ -0,0 +1,57 @@
1
+ # SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ from typing import Any
5
+
6
+ from pydantic import AnyUrl, BaseModel, ConfigDict, Field
7
+
8
+ from .hash import Hash
9
+ from .source_code_origin import SourceCodeOrigin
10
+ from .vcsinfo_curation_data import VcsInfoCurationData
11
+
12
+
13
+ class CurationArtifact(BaseModel):
14
+ url: AnyUrl
15
+ hash: Hash
16
+
17
+
18
+ class PackageCurationData(BaseModel):
19
+ """
20
+ Data model for package curation data.
21
+
22
+ Attributes:
23
+ comment (str | None): Optional comment about the curation.
24
+ purl (str | None): The package URL (PURL) identifying the package.
25
+ cpe (str | None): The Common Platform Enumeration (CPE) identifier.
26
+ authors (list[str] | None): List of authors of the package.
27
+ concluded_license (str | None): The license concluded for the package.
28
+ description (str | None): Description of the package.
29
+ homepage_url (str | None): URL of the package's homepage.
30
+ binary_artifact (CurationArtifact | None): Information about the binary artifact.
31
+ source_artifact (CurationArtifact | None): Information about the source artifact.
32
+ vcs (VcsInfoCurationData | None): Version control system information.
33
+ is_metadata_only (bool | None): Whether the curation is metadata only.
34
+ is_modified (bool | None): Whether the package has been modified.
35
+ declared_license_mapping (dict[str, Any]): Mapping of declared licenses.
36
+ source_code_origins (list[SourceCodeOrigin] | None): List of source code origins.
37
+ labels (dict[str, str]): Additional labels for the package.
38
+ """
39
+
40
+ model_config = ConfigDict(
41
+ extra="forbid",
42
+ )
43
+ comment: str | None = None
44
+ purl: str | None = None
45
+ cpe: str | None = None
46
+ authors: list[str] | None = None
47
+ concluded_license: str | None = None
48
+ description: str | None = None
49
+ homepage_url: str | None = None
50
+ binary_artifact: CurationArtifact | None = None
51
+ source_artifact: CurationArtifact | None = None
52
+ vcs: VcsInfoCurationData | None = None
53
+ is_metadata_only: bool | None = None
54
+ is_modified: bool | None = None
55
+ declared_license_mapping: dict[str, Any] = Field(default_factory=dict)
56
+ source_code_origins: list[SourceCodeOrigin] | None = None
57
+ labels: dict[str, str] = Field(default_factory=dict)
@@ -7,9 +7,9 @@ from typing import Any
7
7
 
8
8
  from pydantic import BaseModel, Field, RootModel
9
9
 
10
- from ort.models.analyzer_configurations import OrtAnalyzerConfigurations
11
10
  from ort.models.config.curations import Curations
12
- from ort.models.package_managers import OrtPackageManagerConfigurations, PackageManagerConfigs
11
+ from ort.models.config.package_configuration import PackageConfiguration
12
+ from ort.models.config.repository_analyzer_configuration import RepositoryAnalyzerConfiguration
13
13
 
14
14
 
15
15
  class OrtRepositoryConfigurationLicenseChoicesPackageLicenseChoiceLicenseChoice(BaseModel):
@@ -170,10 +170,6 @@ class OrtRepositoryConfigurationSnippetChoice(BaseModel):
170
170
  choices: list[OrtRepositoryConfigurationSnippetChoiceChoice]
171
171
 
172
172
 
173
- class PackageManagerConfigurationSchema(RootModel[dict[str, PackageManagerConfigs]]):
174
- root: dict[str, PackageManagerConfigs]
175
-
176
-
177
173
  class ResolutionsSchemaResolutionsSchemaIssue(BaseModel):
178
174
  message: str
179
175
  reason: IssueResolutionReason
@@ -277,7 +273,7 @@ class OrtRepositoryConfiguration(BaseModel):
277
273
  Each field corresponds to a specific aspect of the repository's configuration.
278
274
  """
279
275
 
280
- analyzer: OrtAnalyzerConfigurations | None = Field(
276
+ analyzer: RepositoryAnalyzerConfiguration | None = Field(
281
277
  None,
282
278
  description="Define Analyzer specific options",
283
279
  )
@@ -295,8 +291,8 @@ class OrtRepositoryConfiguration(BaseModel):
295
291
  description="Defines curations for packages used as dependencies by projects in this repository,"
296
292
  " or curations for license findings in the source code of a project in this repository.",
297
293
  )
298
- package_configurations: list[OrtPackageManagerConfigurations] | None = Field(
299
- None,
294
+ package_configurations: list[PackageConfiguration] = Field(
295
+ default_factory=list,
300
296
  description="A configuration for a specific package and provenance.",
301
297
  )
302
298
  license_choices: OrtRepositoryConfigurationLicenseChoices | None = Field(
@@ -1,19 +0,0 @@
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_managers import OrtPackageManagerConfigurations, OrtPackageManagers
8
- from ort.models.repository_configuration import OrtRepositoryConfiguration
9
-
10
- __all__ = [
11
- "OrtAnalyzerConfigurations",
12
- "OrtConfiguration",
13
- "OrtPackageManagerConfigurations",
14
- "OrtPackageManagers",
15
- "OrtRepositoryConfiguration",
16
- "Scanner",
17
- "Severity",
18
- "Storages",
19
- ]
@@ -1,32 +0,0 @@
1
- # SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
2
- # SPDX-License-Identifier: MIT
3
-
4
-
5
- from pydantic import AnyUrl, BaseModel, ConfigDict, Field
6
-
7
- from .package_managers import OrtPackageManagerConfigurations, OrtPackageManagers
8
-
9
-
10
- class Sw360Configuration(BaseModel):
11
- model_config = ConfigDict(
12
- extra="forbid",
13
- )
14
- rest_url: AnyUrl = Field(..., alias="restUrl")
15
- auth_url: AnyUrl = Field(..., alias="authUrl")
16
- username: str
17
- password: str | None = None
18
- client_id: str = Field(..., alias="clientId")
19
- client_password: str | None = Field(None, alias="clientPassword")
20
- token: str | None = None
21
-
22
-
23
- class OrtAnalyzerConfigurations(BaseModel):
24
- model_config = ConfigDict(
25
- extra="forbid",
26
- )
27
- allow_dynamic_versions: bool | None = Field(None)
28
- enabled_package_managers: list[OrtPackageManagers] | None = Field(None)
29
- disabled_package_managers: list[OrtPackageManagers] | None = Field(None)
30
- package_managers: OrtPackageManagerConfigurations | None = Field(None)
31
- sw360_configuration: Sw360Configuration | None = Field(None)
32
- skip_excluded: bool | None = Field(None)
@@ -1,36 +0,0 @@
1
- # SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
2
- # SPDX-License-Identifier: MIT
3
-
4
- from typing import Any
5
-
6
- from pydantic import AnyUrl, BaseModel, ConfigDict, Field
7
-
8
- from .hash import Hash
9
- from .source_code_origin import SourceCodeOrigin
10
- from .vcsinfo_curation_data import VcsInfoCurationData
11
-
12
-
13
- class CurationArtifact(BaseModel):
14
- url: AnyUrl
15
- hash: Hash
16
-
17
-
18
- class PackageCurationData(BaseModel):
19
- model_config = ConfigDict(
20
- extra="forbid",
21
- )
22
- comment: str | None = None
23
- purl: str | None = None
24
- cpe: str | None = None
25
- authors: list[str] | None = None
26
- concluded_license: str | None = None
27
- description: str | None = None
28
- homepage_url: str | None = None
29
- binary_artifact: CurationArtifact | None = None
30
- source_artifact: CurationArtifact | None = None
31
- vcs: VcsInfoCurationData | None = None
32
- is_metadata_only: bool | None = None
33
- is_modified: bool | None = None
34
- declared_license_mapping: dict[str, Any] = Field(default_factory=dict)
35
- source_code_origins: list[SourceCodeOrigin] | None = None
36
- labels: dict[str, str] = Field(default_factory=dict)
@@ -1,55 +0,0 @@
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
-
11
- class OrtPackageManagers(Enum):
12
- """
13
- Enumeration of supported package managers in ORT.
14
-
15
- This enum represents a variety of package managers across different programming ecosystems.
16
- """
17
-
18
- bazel = "Bazel"
19
- bower = "Bower"
20
- bundler = "Bundler"
21
- cargo = "Cargo"
22
- carthage = "Carthage"
23
- cocoa_pods = "CocoaPods"
24
- composer = "Composer"
25
- conan = "Conan"
26
- go_mod = "GoMod"
27
- gradle = "Gradle"
28
- gradle_inspector = "GradleInspector"
29
- maven = "Maven"
30
- npm = "NPM"
31
- nu_get = "NuGet"
32
- pip = "PIP"
33
- pipenv = "Pipenv"
34
- pnpm = "PNPM"
35
- poetry = "Poetry"
36
- pub = "Pub"
37
- sbt = "SBT"
38
- spdx_document_file = "SpdxDocumentFile"
39
- stack = "Stack"
40
- swift_pm = "SwiftPM"
41
- unmanaged = "Unmanaged"
42
- yarn = "Yarn"
43
- yarn2 = "Yarn2"
44
-
45
-
46
- class PackageManagerConfigs(BaseModel):
47
- model_config = ConfigDict(
48
- extra="forbid",
49
- )
50
- must_run_after: list[OrtPackageManagers] | None = Field(None, alias="mustRunAfter")
51
- options: Any | None = None
52
-
53
-
54
- class OrtPackageManagerConfigurations(RootModel[dict[str, PackageManagerConfigs]]):
55
- root: dict[str, PackageManagerConfigs]
File without changes
File without changes