Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for parsing citation.cff files #3625

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Zumitify
Copy link

@Zumitify Zumitify commented Dec 22, 2023

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 nexB#3580
Check comments for mapping of keys between citation.cff and
models.py

Signed-off-by: Zumitify <sumitpagar123@gmail.com>
@Zumitify
Copy link
Author

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

Copy link
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.

@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
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
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
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
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
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
Member

@Zumitify gentle ping

@AyanSinhaMahapatra AyanSinhaMahapatra modified the milestones: v32.1, v32.2 Mar 18, 2024
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.

Add support for citation file format
2 participants