Added support for parsing citation.cff files - #3625
Conversation
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>
cc5d509 to
b3faffb
Compare
|
Please refer to #3580 (comment) for explanation and mapping between cff file fields and model.py fields. |
AyanSinhaMahapatra
left a comment
There was a problem hiding this comment.
@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',) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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?
|
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 |
|
@AyanSinhaMahapatra Thanks for the response. Let me go over them and I'll try to address your code comments and questions soon. |
|
@Zumitify gentle ping |
|
This feature is increasingly important in scientific open source and I'm keen to see it implemented @Zumitify :) |
| )) | ||
| repository_homepage_url = metayaml.get('repository') | ||
| repository_download_url = metayaml.get('repository-code') | ||
| extracted_license_statement = metayaml.get('license') |
There was a problem hiding this comment.
There are interesting details in https://github.com/citation-file-format/citation-file-format/blob/main/schema-guide.md#license
|
|
||
| class CitationHandler(models.DatafileHandler): | ||
| datasource_id = 'citation_cff' | ||
| default_package_type = 'citation' |
There was a problem hiding this comment.
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.
|
@Zumitify gentle ping, do you have any questions or need any help finishing this up? |
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
Run tests locally to check for errors.
Signed-off-by: Zumitify sumitpagar123@gmail.com