Skip to content

Commit

Permalink
Add CITATION file and prep tests for citing repos
Browse files Browse the repository at this point in the history
  • Loading branch information
willGraham01 committed Jan 26, 2024
1 parent 9e56610 commit 5a9d46a
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
29 changes: 29 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: BrainGlobe
message: >-
You can use the brainglobe.cite() function to generate
citations for the BrainGlobe tools you use in your
research.
type: software
authors:
- given-names: BrainGlobe
family-names: Developers
affiliation: 'Sainsbury Wellcome Centre, University College London'
email: [email protected]
- given-names: Wiliam Michael
family-names: Graham
email: [email protected]
affiliation: 'Advanced Research Computing, University College London'
orcid: 'https://orcid.org/0000-0003-0058-263X'
repository-code: 'https://github.com/brainglobe/brainglobe-meta'
url: 'https://brainglobe.info/'
abstract: >-
The BrainGlobe Initiative exists to facilitate the
development of interoperable Python-based tools for
computational neuroanatomy.
license: BSD-3-Clause
citation-sentence: >-
'This project makes use of the BrainGlobe tool-suite, https://brainglobe.info/'
11 changes: 10 additions & 1 deletion brainglobe/citation/cite.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def cite(
format: Literal["bibtex", "text"] = "bibtex",
outfile: str = None,
cite_software: bool = False,
newline_separations: int = 2,
) -> str:
"""
Provide citation(s) for the BrainGlobe tool(s) that the user has supplied.
Expand All @@ -34,6 +35,9 @@ def cite(
or journal counterparts, where present in repositories.
Use if you want to reference the source code of a particular tool,
rather than acknowledge use of the tool itself.
newline_separations: int, default = 2
Number of newline characters to use when separating references, in the
event that multiple tools are to be cited.
Returns
-------
Expand Down Expand Up @@ -68,6 +72,10 @@ def cite(
)
citation_type = None

# The repo_reference variable will contain the reference string
repo_reference: str = None

# Determine citation format in preparation for writing
if format == "text":
# If the user requested the citation sentence,
# provide this by looking up the expected field.
Expand Down Expand Up @@ -101,7 +109,8 @@ def cite(

repo_reference = citation_class(citation_info)

cite_string += f"{repo_reference}\n\n"
# Append the reference to the string we are generating
cite_string += f"{repo_reference}" + "\n" * newline_separations

# Upon looping over each of the repositories, we should be ready to dump
# the output to the requested location.
Expand Down
12 changes: 12 additions & 0 deletions brainglobe/citation/repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,18 @@ def unique_repositories_from_tools(
],
cff_branch="add-citation-file",
)
brainglobe_meta = Repository(
"brainglobe-meta",
[
"brainglobe",
"meta-package",
"meta package",
"meta",
"toolsuite",
"tool suite",
],
cff_branch="add-citation-function",
)


def all_citable_repositories() -> List[Repository]:
Expand Down
3 changes: 3 additions & 0 deletions tests/test_unit/citation/test_cite.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def test_citation_combinations() -> None:
""" """
pass

0 comments on commit 5a9d46a

Please sign in to comment.