-
Notifications
You must be signed in to change notification settings - Fork 1
feat(curations): Minor fix and tests #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| name: pytest | ||
|
|
||
| on: [pull_request, workflow_dispatch] | ||
|
|
||
| jobs: | ||
| test-optima: | ||
| name: Run python-optima tests | ||
| runs-on: ubuntu-24.04 | ||
| strategy: | ||
| matrix: | ||
| python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
|
|
||
| - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0 | ||
| with: | ||
| enable-cache: true | ||
|
|
||
| - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Install the project | ||
| run: uv sync --locked --all-extras --dev | ||
|
|
||
| - name: Test with python ${{ matrix.python-version }} | ||
| run: uv run --frozen pytest |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # SPDX-FileCopyrightText: 2025 Helio Chissini de Castro <heliocastro@gmail.com> | ||
| # SPDX-License-Identifier: MIT | ||
|
|
||
| from pydantic import AnyUrl, BaseModel, Field | ||
|
|
||
| from .vcstype import VcsType | ||
|
|
||
|
|
||
| class VcsInfoCurationData(BaseModel): | ||
| """ | ||
| Bundles general Version Control System information. | ||
|
|
||
| Attributes: | ||
| type(VcsType): The type of the VCS, for example Git, GitRepo, Mercurial, etc. | ||
| url(AnyUrl): The URL to the VCS repository. | ||
| revision(str): The VCS-specific revision (tag, branch, SHA1) that the version of the package maps to. | ||
| path(str): The path inside the VCS to take into account. | ||
| If the VCS supports checking out only a subdirectory, only this path is checked out. | ||
| """ | ||
|
|
||
| type: VcsType | None = Field( | ||
| default=None, | ||
| description="The type of the VCS, for example Git, GitRepo, Mercurial, etc.", | ||
| ) | ||
| url: AnyUrl | None = Field( | ||
| default=None, | ||
| description="The URL to the VCS repository.", | ||
| ) | ||
| revision: str | None = Field( | ||
| default=None, | ||
| description="The VCS-specific revision (tag, branch, SHA1) that the version of the package maps to.", | ||
| ) | ||
| path: str | None = Field( | ||
| default=None, | ||
| description="The path inside the VCS to take into account." | ||
| "If the VCS supports checking out only a subdirectory, only this path is checked out.", | ||
| ) |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| --- | ||
| # Example for a complete curation object: | ||
| #- id: "Maven:org.hamcrest:hamcrest-core:1.3" | ||
| # curations: | ||
| # comment: "An explanation why the curation is needed or the reasoning for a license conclusion." | ||
| # concluded_license: "Apache-2.0 OR BSD-3-Clause" # Valid SPDX license expression to override the license findings. | ||
| # declared_license_mapping: | ||
| # "Copyright (C) 2013, Martin Journois": "NONE" | ||
| # "BSD": "BSD-3-Clause" | ||
| # description: "Curated description." | ||
| # homepage_url: "http://example.com" | ||
| # binary_artifact: | ||
| # url: "http://example.com/binary.zip" | ||
| # hash: | ||
| # value: "ddce269a1e3d054cae349621c198dd52" | ||
| # algorithm: "MD5" | ||
| # source_artifact: | ||
| # url: "http://example.com/sources.zip" | ||
| # hash: | ||
| # value: "ddce269a1e3d054cae349621c198dd52" | ||
| # algorithm: "MD5" | ||
| # vcs: | ||
| # type: "Git" | ||
| # url: "http://example.com/repo.git" | ||
| # revision: "1234abc" | ||
| # path: "subdirectory" | ||
| # is_metadata_only: true # Whether the package is metadata only. | ||
| # is_modified: true # Whether the package is modified compared to the original source. | ||
|
|
||
| - id: 'Maven:asm:asm' # No version means the curation will be applied to all versions of the package. | ||
| curations: | ||
| comment: 'Repository moved to https://gitlab.ow2.org.' | ||
| vcs: | ||
| type: 'Giot' | ||
| url: 'https://gitlab.ow2.org/asm/asm.git' | ||
|
|
||
| - id: 'NPM::ast-traverse:0.1.0' | ||
| curations: | ||
| comment: 'Revision found by comparing the NPM package with the sources from https://github.com/olov/ast-traverse.' | ||
| vcs: | ||
| revision: 'f864d24ba07cde4b79f16999b1c99bfb240a441e' | ||
|
|
||
| - id: 'NPM::ast-traverse:0.1.1' | ||
| curations: | ||
| comment: 'Revision found by comparing the NPM package with the sources from https://github.com/olov/ast-traverse.' | ||
| vcs: | ||
| revision: '73f2b3c319af82fd8e490d40dd89a15951069b0d' | ||
|
|
||
| - id: 'NPM::ramda:[0.21.0,0.25.0]' # Ivy-style version matchers are supported. | ||
| curations: | ||
| comment: >- | ||
| The package is licensed under MIT per `LICENSE` and `dist/ramda.js`. The project logo is CC-BY-NC-SA-3.0 but it is | ||
| not part of the distributed .tar.gz package, see the `README.md` which says: | ||
| "Ramda logo artwork © 2014 J. C. Phillipps. Licensed Creative Commons CC BY-NC-SA 3.0." | ||
| concluded_license: 'MIT' | ||
|
|
||
| - id: 'Maven:org.jetbrains.kotlin:kotlin-bom' | ||
| curations: | ||
| comment: 'The package is a Maven BOM file and thus is metadata only.' | ||
| is_metadata_only: true | ||
|
|
||
| - id: 'PyPI::pyramid-workflow:1.0.0' | ||
| curations: | ||
| comment: 'The package has an unmappable declared license entry.' | ||
| declared_license_mapping: | ||
| 'BSD-derived (http://www.repoze.org/LICENSE.txt)': 'LicenseRef-scancode-repoze' | ||
|
|
||
| - id: 'PyPI::branca' | ||
| curations: | ||
| comment: 'A copyright statement was used to declare the license.' | ||
| declared_license_mapping: | ||
| 'Copyright (C) 2013, Martin Journois': 'NONE' | ||
|
|
||
| - id: 'Maven:androidx.collection:collection:' | ||
| curations: | ||
| comment: 'Scan the source artifact, because the VCS revision and path are hard to figure out.' | ||
| source_code_origins: [ARTIFACT] | ||
|
|
||
| - id: 'Maven:androidx.collection:collection:' | ||
| curations: | ||
| comment: 'Specify the platform for use within policy rules.' | ||
| labels: | ||
| platform: 'android' | ||
|
|
||
| - id: 'NPM:@types:mime-types:2.1.0' | ||
| curations: | ||
| comment: 'Retrieve the vulnerabilities from Black Duck by the provided origin-id instead of by the purl.' | ||
| labels: | ||
| black-duck:origin-id: 'npmjs:@types/mime-types/2.1.0' | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| - id: "Maven:com.example.app:example:0.0.1" | ||
| curations: | ||
| comment: "An explanation why the curation is needed or the reasoning for a license conclusion" | ||
| purl: "pkg:Maven/com.example.app/example@0.0.1?arch=arm64-v8a#src/main" | ||
| authors: | ||
| - "Name of one author" | ||
| - "Name of another author" | ||
| cpe: "cpe:2.3:a:example-org:example-package:0.0.1:*:*:*:*:*:*:*" | ||
| concluded_license: "Valid SPDX license expression to override the license findings." | ||
| declared_license_mapping: | ||
| "license a": "Apache-2.0" | ||
| description: "Curated description." | ||
| homepage_url: "http://example.com" | ||
| binary_artifact: | ||
| url: "http://example.com/binary.zip" | ||
| hash: | ||
| value: "ddce269a1e3d054cae349621c198dd52" | ||
| algorithm: "MD5" | ||
| source_artifact: | ||
| url: "http://example.com/sources.zip" | ||
| hash: | ||
| value: "ddce269a1e3d054cae349621c198dd52" | ||
| algorithm: "MD5" | ||
| vcs: | ||
| type: "Git" | ||
| url: "http://example.com/repo.git" | ||
| revision: "1234abc" | ||
| path: "subdirectory" | ||
| is_metadata_only: true | ||
| is_modified: true | ||
| source_code_origins: [ARTIFACT, VCS] | ||
| labels: | ||
| my-key: "my-value" |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'Giot' to 'Git'.