feat(license_classification): Add LicenseClassification class#48
Merged
Conversation
Signed-off-by: Helio Chissini de Castro <helio.chissini.de.castro@cariad.technology>
05ff0ca to
6bf1780
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces a new license-classification model layer (Pydantic) plus accompanying schemas, fixtures, and examples, aligning the Python port with ORT’s license categorization concepts.
Changes:
- Add
LicenseClassifications,LicenseCategory, andLicenseCategorizationmodels with validation helpers and merge behavior. - Add new JSON schemas (and heavily refactor the repository configuration schema) plus new YAML fixtures for tests.
- Add tests and examples demonstrating parsing and behavior.
Reviewed changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_repo_config_curations.py | Updates expected curation package count to match new fixture entry. |
| tests/test_license_classifications.py | Adds behavioral tests for the new LicenseClassifications model. |
| tests/data/repo_config/curations.yml | Adds a new PyPI package curation entry. |
| tests/data/license-classifications.yml | Adds an example license-classifications YAML fixture. |
| src/ort/models/licenses/license_classifications.py | Implements LicenseClassifications validation, lookups, and merge logic. |
| src/ort/models/licenses/license_category.py | Adds the LicenseCategory model. |
| src/ort/models/licenses/license_categorization.py | Adds the LicenseCategorization model. |
| src/ort/models/init.py | Re-exports LicenseClassifications. |
| schemas/resolutions-schema.json | Adds a standalone resolutions schema. |
| schemas/repository-configurations/package-manager-configuration-schema.json | Adds a package-manager configuration schema used by repository config schemas. |
| schemas/repository-configurations/analyzer-configuration-schema.json | Adds analyzer configuration schema (repository-configurations namespace). |
| schemas/repository-configuration-schema.json | Replaces the large generated schema with a smaller schema referencing ORT upstream schemas. |
| schemas/package-managers-schema.json | Extends supported package manager enum values. |
| schemas/package-configuration-schema.json | Adds a package-configuration schema. |
| schemas/ort-project-schema.json | Adds a schema for ORT project definition files. |
| schemas/ort-configuration-schema.json | Adds a schema for ORT main configuration. |
| schemas/license-classifications-schema.json | Adds a schema for license classifications files. |
| schemas/curations-schema.json | Adds a schema for package curations files. |
| schemas/analyzer-configuration-schema.json | Updates analyzer schema to remove SW360 configuration from this schema. |
| pyproject.toml | Bumps version and updates dependency groups / tool configuration layout. |
| examples/repo_config.py | Improves error logging on validation failure. |
| examples/ort_result.py | Improves error logging on validation failure. |
| examples/licenses_classification.py | Adds an example CLI to parse license classifications. |
| .agents/skills/python-ort-tests/SKILL.md | Adds repository-local guidance for writing tests in this project. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
820468d to
eceadbc
Compare
eceadbc to
c2c7b1d
Compare
Signed-off-by: Helio Chissini de Castro <helio.chissini.de.castro@cariad.technology>
Signed-off-by: Helio Chissini de Castro <helio.chissini.de.castro@cariad.technology>
Signed-off-by: Helio Chissini de Castro <helio.chissini.de.castro@cariad.technology>
Signed-off-by: Helio Chissini de Castro <helio.chissini.de.castro@cariad.technology>
Signed-off-by: Helio Chissini de Castro <helio.chissini.de.castro@cariad.technology>
c2c7b1d to
4711267
Compare
Comment on lines
+113
to
+116
| merged_categories: list[LicenseCategory] = [] | ||
| for category in [*self.categories, *other.categories]: | ||
| if category.name in used_categories and category not in merged_categories: | ||
| merged_categories.append(category) |
Comment on lines
+27
to
+33
| - name: Sync dependencies | ||
| run: | | ||
| uv lock | ||
| uv sync \ | ||
| --locked \ | ||
| --all-extras \ | ||
| --dev |
Comment on lines
+182
to
192
| "repository_license_choices": { | ||
| "type": "array", | ||
| "items": { | ||
| "given": { | ||
| "type": "string" | ||
| }, | ||
| { | ||
| "type": "null" | ||
| "choice": { | ||
| "type": "string" | ||
| } | ||
| ], | ||
| "default": null, | ||
| "title": "Comment" | ||
| } | ||
| } |
Comment on lines
+21
to
+25
| "items": [ | ||
| { | ||
| "type": "string" | ||
| } | ||
| ] |
Comment on lines
+10
to
+13
| "additionalProperties": { | ||
| "type": "object", | ||
| "$ref": "#/definitions/PackageManagerConfigs" | ||
| }, |
| } | ||
| }, | ||
| "linkage": { | ||
| "description": "The linkage type used be the dependent to link this package.", |
| "$schema": "http://json-schema.org/draft-07/schema#", | ||
| "$id": "https://oss-review-toolkit.org/repository-configurations/analyzer-configuration.yml", | ||
| "title": "ORT repository analyzer configurations", | ||
| "description": "Configurations for the analyzer of the The OSS-Review-Toolkit (ORT). A full list of all available options can be found at https://github.com/oss-review-toolkit/ort/blob/main/model/src/main/kotlin/config/AnalyzerConfiguration.kt.", |
| parsed = RepositoryConfiguration(**data) | ||
| pprint(parsed) | ||
| except ValidationError as e: | ||
| logger.error("Validation error while parsing the ORT result:") |
| parsed = LicenseClassifications(**data) | ||
| pprint(parsed) | ||
| except ValidationError as e: | ||
| logger.error("Validation error while parsing the ORT result:") |
| from .hash import Hash | ||
| from .identifier import Identifier | ||
| from .issue import Issue | ||
| from .licenses.license_classifications import LicenseClassifications |
heliocastro
added a commit
that referenced
this pull request
Jun 18, 2026
* chore(deps): Update project base dependencies * chore(schemas): Update Ort upstream schemas * chore(examples): Add better examples error output * feat(ai): Add skill for replictae Ort upstream tests * feat(license_classifications): Add LicenseClassifiction model * chore(ci): Update actions Signed-off-by: Helio Chissini de Castro <helio.chissini.de.castro@cariad.technology>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.