PkgCite
The PkgCite Julia package is useful for retrieving citation information for Julia packages. By convention, Julia packages that have a paper (or some other citable work associated) contain a CITATION.bib file in the root of the package directory. This package helps users collect a .bib file corresponding to all the pacakges and their dependencies in the current active environment and it also provides an automatically generated sentence that references Julia and the used packages.
Usage
In order to give the most up to date citation information, PkgCite works with the packages in the current active environment / project. Be sure to activate the desired environment before retrieving the citation data.
There are 2 main exported functions for this package: get_citations
and get_tool_citation
. If you only need a .bib file which concatenates all the CITATION.bib files of all the packages and their dependencies in the current active environment, then you will only need get_citations
. Note that the generated .bib file doesn't include the citation for the Julia language itself.
PkgCite.get_citations
โ Functionget_citations(; only_direct=false, filename="julia_citations.bib")
This function will create a .bib file with all the citations collected form the CITATION.bib files corresponding to the dependecies of the current active environment. Use filename
to change the name of the file. To include just the direct dependencies use only_direct=true
. Use badge = true
to get the citations from packages without a Citation.bib
file, but with a DOI badge.
When working on a new project / paper it is useful to create a Julia project to isolate the packages you use from other projects or the default environment. This will also help others reproduce your results more easily, since if they have your Project.toml and Manifest.toml files, with ]instantiate
they will get the exact same package versions as you do, eliminating thus problems with incompatible package versions. See also the DrWatson package, which can help you manage scientific projects.
If you also need to get the automatically generated sentence referencig Julia, you will have to use get_tool_citation
.
PkgCite.get_tool_citation
โ Functionget_tool_citation(io::IO=stdout; jl = true, texttt = false, copy = true, cite_commands=Dict{String,String}(), filename="julia_citations.bib", badge=false)
Print a sentence describing the packages used in the current environment. If you only want to consider the direct dependencies, you can set only_direct=true
. The sentence is automatically copied to the clipboard(you can avoid this by using copy=false
). The package names have the .jl ending by default. You can ommit it with jl=false
. Package names can be wrapped in texttt
by setting texttt=true
and you can also customize the cite command used for each package by using cite_commands=Dict("PackageName"=>"custom_cite")
. The filename of the .bib file can be passed via the filename
keyword. Use badge = true
to get the citations from packages without a Citation.bib
file, but with a DOI badge.
By default, the julia_citations.bib
file is saved in the current directory. To change the name or the save location of the generated .bib
, you can just pass a path in the filename
keyword argument, such as get_tool_citation(filename="path/to/bib_file.bib")
.