python-ort 0.3.0__tar.gz → 0.3.1__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 (23) hide show
  1. {python_ort-0.3.0 → python_ort-0.3.1}/PKG-INFO +1 -1
  2. {python_ort-0.3.0 → python_ort-0.3.1}/pyproject.toml +4 -5
  3. {python_ort-0.3.0 → python_ort-0.3.1}/src/ort/models/package_curation_data.py +2 -2
  4. python_ort-0.3.1/src/ort/models/vcsinfo_curation_data.py +37 -0
  5. python_ort-0.3.1/src/ort/models/vcstype.py +45 -0
  6. python_ort-0.3.0/src/ort/models/vcstype.py +0 -46
  7. {python_ort-0.3.0 → python_ort-0.3.1}/LICENSE +0 -0
  8. {python_ort-0.3.0 → python_ort-0.3.1}/README.md +0 -0
  9. {python_ort-0.3.0 → python_ort-0.3.1}/src/ort/__init__.py +0 -0
  10. {python_ort-0.3.0 → python_ort-0.3.1}/src/ort/models/__init__.py +0 -0
  11. {python_ort-0.3.0 → python_ort-0.3.1}/src/ort/models/analyzer_configurations.py +0 -0
  12. {python_ort-0.3.0 → python_ort-0.3.1}/src/ort/models/config/curations.py +0 -0
  13. {python_ort-0.3.0 → python_ort-0.3.1}/src/ort/models/config/license_finding_curation.py +0 -0
  14. {python_ort-0.3.0 → python_ort-0.3.1}/src/ort/models/config/license_finding_curation_reason.py +0 -0
  15. {python_ort-0.3.0 → python_ort-0.3.1}/src/ort/models/hash.py +0 -0
  16. {python_ort-0.3.0 → python_ort-0.3.1}/src/ort/models/hash_algorithm.py +0 -0
  17. {python_ort-0.3.0 → python_ort-0.3.1}/src/ort/models/ort_configuration.py +0 -0
  18. {python_ort-0.3.0 → python_ort-0.3.1}/src/ort/models/package_curation.py +0 -0
  19. {python_ort-0.3.0 → python_ort-0.3.1}/src/ort/models/package_managers.py +0 -0
  20. {python_ort-0.3.0 → python_ort-0.3.1}/src/ort/models/repository_configuration.py +0 -0
  21. {python_ort-0.3.0 → python_ort-0.3.1}/src/ort/models/resolutions.py +0 -0
  22. {python_ort-0.3.0 → python_ort-0.3.1}/src/ort/models/source_code_origin.py +0 -0
  23. {python_ort-0.3.0 → python_ort-0.3.1}/src/ort/models/vcsinfo.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-ort
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: A Python Ort model serialization library
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -2,12 +2,9 @@
2
2
  requires = ["uv_build>=0.8.12,<0.10.0"]
3
3
  build-backend = "uv_build"
4
4
 
5
- [tool.hatch.build.targets.wheel]
6
- packages = ["src/ort"]
7
-
8
5
  [project]
9
6
  name = "python-ort"
10
- version = "0.3.0"
7
+ version = "0.3.1"
11
8
  description = "A Python Ort model serialization library"
12
9
  readme = "README.md"
13
10
  license = "MIT"
@@ -39,6 +36,7 @@ dev = [
39
36
  "pycodestyle>=2.14.0",
40
37
  "pyrefly>=0.40.0",
41
38
  "pytest>=8.4.2",
39
+ "rich>=14.2.0",
42
40
  "ruff>=0.14.4",
43
41
  "types-pyyaml>=6.0.12.20250915",
44
42
  ]
@@ -47,7 +45,8 @@ dev = [
47
45
  addopts = ["--import-mode=importlib"]
48
46
  log_cli = true
49
47
  log_cli_level = "INFO"
50
- pythonpath = "src"
48
+ pythonpath = ["src"]
49
+ testpaths = ["tests"]
51
50
 
52
51
  [tool.pylint.messages_control]
53
52
  disable = [
@@ -7,7 +7,7 @@ from pydantic import AnyUrl, BaseModel, ConfigDict, Field
7
7
 
8
8
  from .hash import Hash
9
9
  from .source_code_origin import SourceCodeOrigin
10
- from .vcsinfo import VcsInfo
10
+ from .vcsinfo_curation_data import VcsInfoCurationData
11
11
 
12
12
 
13
13
  class CurationArtifact(BaseModel):
@@ -28,7 +28,7 @@ class PackageCurationData(BaseModel):
28
28
  homepage_url: str | None = None
29
29
  binary_artifact: CurationArtifact | None = None
30
30
  source_artifact: CurationArtifact | None = None
31
- vcs: VcsInfo | None = None
31
+ vcs: VcsInfoCurationData | None = None
32
32
  is_metadata_only: bool | None = None
33
33
  is_modified: bool | None = None
34
34
  declared_license_mapping: dict[str, Any] = Field(default_factory=dict)
@@ -0,0 +1,37 @@
1
+ # SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ from pydantic import AnyUrl, BaseModel, Field
5
+
6
+ from .vcstype import VcsType
7
+
8
+
9
+ class VcsInfoCurationData(BaseModel):
10
+ """
11
+ Bundles general Version Control System information.
12
+
13
+ Attributes:
14
+ type(VcsType): The type of the VCS, for example Git, GitRepo, Mercurial, etc.
15
+ url(AnyUrl): The URL to the VCS repository.
16
+ revision(str): The VCS-specific revision (tag, branch, SHA1) that the version of the package maps to.
17
+ path(str): The path inside the VCS to take into account.
18
+ If the VCS supports checking out only a subdirectory, only this path is checked out.
19
+ """
20
+
21
+ type: VcsType | None = Field(
22
+ default=None,
23
+ description="The type of the VCS, for example Git, GitRepo, Mercurial, etc.",
24
+ )
25
+ url: AnyUrl | None = Field(
26
+ default=None,
27
+ description="The URL to the VCS repository.",
28
+ )
29
+ revision: str | None = Field(
30
+ default=None,
31
+ description="The VCS-specific revision (tag, branch, SHA1) that the version of the package maps to.",
32
+ )
33
+ path: str | None = Field(
34
+ default=None,
35
+ description="The path inside the VCS to take into account."
36
+ "If the VCS supports checking out only a subdirectory, only this path is checked out.",
37
+ )
@@ -0,0 +1,45 @@
1
+ # SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ from pydantic import BaseModel, Field, model_validator
5
+
6
+ # Define known VCS types as constants
7
+ GIT = ["Git", "GitHub", "GitLab"]
8
+ GIT_REPO = ["GitRepo", "git-repo", "repo"]
9
+ MERCURIAL = ["Mercurial", "hg"]
10
+ SUBVERSION = ["Subversion", "svn"]
11
+
12
+ KNOWN_TYPES = GIT + GIT_REPO + MERCURIAL + SUBVERSION
13
+
14
+
15
+ class VcsType(BaseModel):
16
+ """
17
+ A class for Version Control System types. Each type has one or more [aliases] associated to it,
18
+ where the first alias is the definite name. This class is not implemented as an enum as
19
+ constructing from an unknown type should be supported while maintaining that type as the primary
20
+ alias for the string representation.
21
+
22
+ Attributes:
23
+ name(str): Primary name and aliases
24
+ """
25
+
26
+ name: str = Field(default_factory=str)
27
+
28
+ @model_validator(mode="before")
29
+ @classmethod
30
+ def _forName(cls, value):
31
+ # Allow direct string input (e.g., "Git" or "gitlab")
32
+ if isinstance(value, str):
33
+ if any(item.lower() == value.lower() for item in KNOWN_TYPES):
34
+ return {"name": value}
35
+ else:
36
+ # Not a known type → default to empty string
37
+ return {"name": ""}
38
+ # Allow dict input or existing model
39
+ elif isinstance(value, dict):
40
+ name = value.get("name", "")
41
+ if any(item.lower() == name.lower() for item in KNOWN_TYPES):
42
+ return value
43
+ else:
44
+ return {"name": ""}
45
+ return {"name": ""}
@@ -1,46 +0,0 @@
1
- # SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com>
2
- # SPDX-License-Identifier: MIT
3
-
4
- from pydantic import BaseModel, Field, model_validator
5
-
6
-
7
- class VcsType(BaseModel):
8
- """
9
- A class for Version Control System types. Each type has one or more [aliases] associated to it,
10
- where the first alias is the definite name. This class is not implemented as an enum as
11
- constructing from an unknown type should be supported while maintaining that type as the primary
12
- alias for the string representation.
13
-
14
- Attributes:
15
- aliases(list[str]): Primary name and aliases
16
- """
17
-
18
- aliases: list[str] = Field(default_factory=list, description="Primary name and aliases")
19
-
20
- @model_validator(mode="after")
21
- def ensure_non_empty(self):
22
- """Ensure the aliases list is never empty."""
23
- if not self.aliases:
24
- self.aliases = [""]
25
- return self
26
-
27
- def __str__(self):
28
- return self.aliases[0] if self.aliases else ""
29
-
30
- @classmethod
31
- def for_name(cls, name: str) -> "VcsType":
32
- """Lookup known type by name, or create a new instance."""
33
- for t in KNOWN_TYPES:
34
- if any(alias.lower() == name.lower() for alias in t.aliases):
35
- return t
36
- return cls(aliases=[name])
37
-
38
-
39
- # Define known VCS types as constants
40
- GIT = VcsType(aliases=["Git", "GitHub", "GitLab"])
41
- GIT_REPO = VcsType(aliases=["GitRepo", "git-repo", "repo"])
42
- MERCURIAL = VcsType(aliases=["Mercurial", "hg"])
43
- SUBVERSION = VcsType(aliases=["Subversion", "svn"])
44
- UNKNOWN = VcsType(aliases=[""])
45
-
46
- KNOWN_TYPES = [GIT, GIT_REPO, MERCURIAL, SUBVERSION]
File without changes
File without changes