{ "cells": [ { "cell_type": "markdown", "id": "b7a2908a", "metadata": {}, "source": [ "# Example\n", "\n", "[CITATION.cff](https://citation-file-format.github.io/):\n", "\n", "``` yaml\n", "# YAML 1.2\n", "---\n", "cff-version: 1.1.0\n", "message: If you use this software, please cite it as below.\n", "authors:\n", " - family-names: Druskat\n", " given-names: Stephan\n", " orcid: https://orcid.org/0000-0003-4925-7248\n", "title: \"My Research Software\"\n", "version: 2.0.4\n", "doi: 10.5281/zenodo.1234\n", "date-released: 2017-12-18\n", "```\n", "\n", "You can output YAML files as Python [dictionaries](https://python-basics-tutorial.readthedocs.io/en/latest/types/dicts.html) with:" ] }, { "cell_type": "code", "execution_count": 1, "id": "fb0a60bc", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{'cff-version': '1.1.0', 'message': 'If you use this software, please cite it as below.', 'authors': [{'family-names': 'Druskat', 'given-names': 'Stephan', 'orcid': 'https://orcid.org/0000-0003-4925-7248'}], 'title': 'My Research Software', 'version': '2.0.4', 'doi': '10.5281/zenodo.1234', 'date-released': datetime.date(2017, 12, 18)}\n" ] } ], "source": [ "import yaml\n", "\n", "\n", "with open(\"CITATION.cff\", \"r\") as file:\n", " cite = yaml.safe_load(file)\n", " print(cite)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3.13 Kernel", "language": "python", "name": "python313" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.0" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": {}, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 5 }