Skip to content

Add support for parsing publiccode.yml as package metadata#4865

Open
kumarasantosh wants to merge 7 commits intoaboutcode-org:developfrom
kumarasantosh:feature/publiccode-yml-handler
Open

Add support for parsing publiccode.yml as package metadata#4865
kumarasantosh wants to merge 7 commits intoaboutcode-org:developfrom
kumarasantosh:feature/publiccode-yml-handler

Conversation

@kumarasantosh
Copy link
Copy Markdown
Contributor

Add a new PubliccodeYmlHandler in src/packagedcode/publiccode.py to parse publiccode.yml / publiccode.yaml files and extract them as package metadata.
publiccode.yml is a YAML-based metadata standard for public sector open source software, widely adopted across the EU.

Closes #2851

When a gemspec uses a Ruby constant for the version field like:
  s.version = Elasticsearch::API::VERSION
  s.version = Faraday::VERSION

scancode was storing the constant name as the version string.
These constants cannot be resolved without executing Ruby code.

Add is_ruby_version_constant() to detect Ruby constant
expressions (containing :: namespace separator or bare
uppercase constant names) and return None for the version
instead of storing an unresolvable constant string.

Also fixes the download_url and api_data_url which were
generating invalid URLs with the constant name embedded.

Fixes aboutcode-org#3129

Signed-off-by: kumarasantosh <santosh.pulikond02@gmail.com>
Signed-off-by: kumarasantosh <santosh.pulikond02@gmail.com>
licenses: add IBPP License v1.1 detection

- Add ibpp_ref.RULE for reference-style detection
- Add ibpp_intro.RULE for header/copyright line detection
- Add test data for IBPP interference with passwdqc block

Signed-off-by: kumarasantosh <santosh.pulikond02@gmail.com>
Signed-off-by: kumarasantosh <santosh.pulikond02@gmail.com>
…r to parse publiccode.yml files.\npubliccode.yml is a metadata standard for public sector open source\nsoftware. See https://github.com/publiccodeyml/publiccode.yml\n\nResolves aboutcode-org#2851

Signed-off-by: kumarasantosh <santosh.pulikond02@gmail.com>
@kumarasantosh kumarasantosh force-pushed the feature/publiccode-yml-handler branch from f3be189 to ce55547 Compare March 25, 2026 03:29
@kumarasantosh kumarasantosh changed the title Feature/publiccode yml handler publiccode yml handler Mar 25, 2026
@kumarasantosh kumarasantosh changed the title publiccode yml handler Add support for parsing publiccode.yml as package metadata Mar 25, 2026
Copy link
Copy Markdown
Member

@AyanSinhaMahapatra AyanSinhaMahapatra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of changes from other issues/PRs, remove them.
See also general comments from #4803

@@ -0,0 +1,2 @@
license_expressions:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are changes from other issues/PRs here?
Do you even look at the changes after submitting the PR?

Comment thread src/packagedcode/publiccode.py Outdated
vcs_url=vcs_url,
homepage_url=homepage_url,
description=description,
declared_license_expression=declared_license,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to populate the extracted license statement, which we do a license detection on, you cannot directly populate the license expression.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid SPDX license expressions are supported and parsed automatically https://github.com/publiccodeyml/publiccode.yml/blob/main/docs/standard/schema.core.rst#key-legallicense

Signed-off-by: kumarasantosh <santosh.pulikond02@gmail.com>
Signed-off-by: kumarasantosh <santosh.pulikond02@gmail.com>
@kumarasantosh kumarasantosh force-pushed the feature/publiccode-yml-handler branch from 39c4566 to 1229323 Compare April 15, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collect publiccode metadata as package-like data

2 participants