citation

citation

Print and update citation files in CFF format.

Functions

Name Description
print_citation Print the citation in the specified format.
update_citation Update the citation file with the specified version and date.

print_citation

citation.print_citation(citation_file='CITATION.cff', output_format='bibtex')

Print the citation in the specified format.

This function reads a citation file in CFF format and prints it in the specified output format using the cffconvert library.

Parameters

Name Type Description Default
citation_file str The path to the citation file (default is “CITATION.cff”). 'CITATION.cff'
output_format str The format to print the citation in (default is “bibtex”). 'bibtex'

Examples

>>> print_citation()
@article{...

update_citation

citation.update_citation(
    citation_file='CITATION.cff',
    version='${{ steps.set-version.output.NEXT_VERSION }}',
    date=date_today(),
    debug=False,
)

Update the citation file with the specified version and date.

This function updates the version and date-released fields in the citation file and writes the updated content back to the file.

Parameters

Name Type Description Default
citation_file str The path to the citation file (default is “CITATION.cff”). 'CITATION.cff'
version str The version to set in the citation file (default is “\({{ steps.set-version.output.NEXT_VERSION }}"). | `'\){{ steps.set-version.output.NEXT_VERSION }}’| | date | [str](str) | The release date to set in the citation file (default is today's date). |date_today()| | debug | [bool](bool) | If True, print the updated citation content instead of writing to the file (default is False). |False`

Examples

>>> update_citation(version="1.0.1", date="2023-10-01")