Skip to content

Added support for parsing citation.cff files - #3625

Open
Zumitify wants to merge 1 commit into
aboutcode-org:developfrom
Zumitify:support_citation_file_format
Open

Added support for parsing citation.cff files#3625
Zumitify wants to merge 1 commit into
aboutcode-org:developfrom
Zumitify:support_citation_file_format

Conversation

@Zumitify

@Zumitify Zumitify commented Dec 22, 2023

Copy link
Copy Markdown

Parses citation files containing information about citing software/dataset.
Added tests to validate the parser.

fixes #3580 Check comments for mapping of keys between citation.cff and models.py

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled 📑 and links the original issue above 🔗
  • Tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR
    Run tests locally to check for errors.
  • Commits are in uniquely-named feature branch and has no merge conflicts 📁
  • Looked for possible updates in documentation and added updates if applicable.
  • Updated CHANGELOG.rst

Signed-off-by: Zumitify sumitpagar123@gmail.com

Parses citation files containing information about citing
software/dataset.
Added tests to validate the parser.
Added documentation for citation.cff in list of supported package
parsers.

fixes aboutcode-org#3580
Check comments for mapping of keys between citation.cff and
models.py

Signed-off-by: Zumitify <sumitpagar123@gmail.com>
@Zumitify
Zumitify force-pushed the support_citation_file_format branch from cc5d509 to b3faffb Compare December 22, 2023 09:07
@Zumitify

Copy link
Copy Markdown
Author

Please refer to #3580 (comment) for explanation and mapping between cff file fields and model.py fields.

@AyanSinhaMahapatra AyanSinhaMahapatra left a comment

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.

@Zumitify Thanks++for the PR! Already looking good and works mostly ok.
See comments below and the comment made in the issue: #3580 (comment) for more details and answers to your questions there.

class CitationHandler(models.DatafileHandler):
datasource_id = 'citation_cff'
default_package_type = 'citation'
path_patterns = ('*/CITATION.cff',)

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.

Based on https://github.com/search?q=path%3A*.cff&type=Code&ref=advsearch&l=&l=&p=1 these are often also in lowercase and others, and as we do a case-sensitive matching here (should we? 🤔) we would fail on lowercase and others, should specify more cases here.

- citation file format
- CFF
version: 1.1.0
doi: 10.5281/zenodo.1184077

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.

The DOI is very important here, maybe we should have this in PackageData.extra_data, maybe also date-released?

repository: https://github.com/citation-file-format/
repository-artifact: https://rubygems.org/gems/cff
repository-code: https://github.com/citation-file-format/ruby-cff
references:

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.

Here we have to think if references can be listed as dependencies. See https://github.com/citation-file-format/citation-file-format/blob/main/schema-guide.md#referencing-other-work which does support this. Maybe only for the references with a type: software?

@AyanSinhaMahapatra

Copy link
Copy Markdown
Member

Also regen the failed tests here: https://dev.azure.com/nexB/scancode-toolkit/_build/results?buildId=12395&view=logs&j=1412dbfa-421a-5a40-8ddf-7073fc46aa19&t=13c90161-2109-5957-f563-a96fefc7d869
See https://scancode-toolkit.readthedocs.io/en/stable/contribute/contrib_dev.html#running-tests for usage of SCANCODE_REGEN_TEST_FIXTURES to do this easily (Be sure to review what was updated when this is done always).

@AyanSinhaMahapatra AyanSinhaMahapatra added this to the v32.1 milestone Jan 8, 2024
@Zumitify

Copy link
Copy Markdown
Author

@AyanSinhaMahapatra Thanks for the response. Let me go over them and I'll try to address your code comments and questions soon.

@AyanSinhaMahapatra

Copy link
Copy Markdown
Member

@Zumitify gentle ping

@AyanSinhaMahapatra AyanSinhaMahapatra modified the milestones: v32.1, v32.2 Mar 18, 2024
@sgoggins

Copy link
Copy Markdown

This feature is increasingly important in scientific open source and I'm keen to see it implemented @Zumitify :)

@Zumitify

Zumitify commented Oct 16, 2024

Copy link
Copy Markdown
Author

This feature is increasingly important in scientific open source and I'm keen to see it implemented @Zumitify :)

Hi @sgoggins,
I'm sorry I lost touch with this PR. Give me a few days (until the weekend), and I will try to update my repo and fix this.

@pombredanne

Copy link
Copy Markdown
Member

@sgoggins let's do this! We had met in the past at some Linux event... you are a leading CHAOSS... tell us how we can help there!
@Zumitify Thank you for following through on this. ❤️

))
repository_homepage_url = metayaml.get('repository')
repository_download_url = metayaml.get('repository-code')
extracted_license_statement = metayaml.get('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.


class CitationHandler(models.DatafileHandler):
datasource_id = 'citation_cff'
default_package_type = 'citation'

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.

is this the best type? what about cff? and is this really a new PURL type?
There are likely details in the URLs that would make this another PURL type.

@AyanSinhaMahapatra

Copy link
Copy Markdown
Member

@Zumitify gentle ping, do you have any questions or need any help finishing this up?
I would like to see this merged soon enough 😄

@AyanSinhaMahapatra AyanSinhaMahapatra added the needs-help Need some help to complete and merge these. label Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-help Need some help to complete and merge these.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for citation file format

4 participants