Title: | Generate 'CodeMeta' Metadata for R Packages |
---|---|
Description: | The 'Codemeta' Project defines a 'JSON-LD' format for describing software metadata, as detailed at <https://codemeta.github.io>. This package provides utilities to generate, parse, and modify 'codemeta.json' files automatically for R packages, as well as tools and examples for working with 'codemeta.json' 'JSON-LD' more generally. |
Authors: | Carl Boettiger [aut, cre, cph] , Anna Krystalli [rev, ctb] , Toph Allen [rev] , Maëlle Salmon [ctb, aut] , rOpenSci [fnd] (https://ropensci.org/), Katrin Leinweber [ctb] , Noam Ross [ctb] , Arfon Smith [ctb], Jeroen Ooms [ctb] , Sebastian Meyer [ctb] , Michael Rustler [ctb] , Hauke Sonnenberg [ctb] , Sebastian Kreutzer [ctb] , Thierry Onkelinx [ctb] |
Maintainer: | Carl Boettiger <[email protected]> |
License: | GPL-3 |
Version: | 0.3.5 |
Built: | 2024-11-02 04:43:06 UTC |
Source: | https://github.com/ropensci/codemetar |
The 'Codemeta' Project defines a 'JSON-LD' format for describing software metadata, as detailed at https://codemeta.github.io. This package provides utilities to generate, parse, and modify 'codemeta.json' files automatically for R packages, as well as tools and examples for working with 'codemeta.json' 'JSON-LD' more generally.
Why bother creating a codemeta.json for your package? R packages
encode lots of metadata in the DESCRIPTION
file, README
, and other
places, telling users and developers about the package purpose, authors,
license, dependencies, and other information that facilitates discovery,
adoption, and credit for your software. Unfortunately, because each
software language records this metadata in a different format, that
information is hard for search engines, software repositories, and other
developers to find and integrate.
By generating a codemeta.json
file, you turn your metadata into a
format that can easily crosswalk between metadata in many other software
languages. CodeMeta is built on schema.org a
simple structured data
format developed by major search engines like Google and Bing to improve
discoverability in search. CodeMeta is also understood by significant
software archiving efforts such as Software Heritage Project, which seeks to
permanently archive all open source software.
For more general information about the CodeMeta Project for defining software metadata, see https://codemeta.github.io. In particular, new users might want to start with the User Guide, while those looking to learn more about JSON-LD and consuming existing codemeta files should see the Developer Guide.
Why codemetar? The ‘Codemeta’ Project defines a ‘JSON-LD’ format for describing software metadata, as detailed at https://codemeta.github.io. This package provides utilities to generate, parse, and modify codemeta.jsonld files automatically for R packages, as well as tools and examples for working with codemeta json-ld more generally.
It has three main goals:
Quickly generate a valid codemeta.json file from any valid R package. To do so, we automatically extract as much metadata as possible using the DESCRIPTION file, as well as extracting metadata from other common best-practices such as the presence of Travis and other badges in README, etc.
Facilitate the addition of further metadata fields into a codemeta.json file, as well as general manipulation of codemeta files.
Support the ability to crosswalk between terms used in other metadata standards, as identified by the Codemeta Project Community, see https://codemeta.github.io/crosswalk/
Maintainer: Carl Boettiger [email protected] (ORCID) [copyright holder]
Authors:
Maëlle Salmon (ORCID) [contributor]
Other contributors:
Anna Krystalli (ORCID) [reviewer, contributor]
Toph Allen (ORCID) [reviewer]
rOpenSci (https://ropensci.org/) [funder]
Katrin Leinweber (ORCID) [contributor]
Noam Ross (ORCID) [contributor]
Arfon Smith [contributor]
Jeroen Ooms (ORCID) [contributor]
Sebastian Meyer (ORCID) [contributor]
Michael Rustler (ORCID) [contributor]
Hauke Sonnenberg (ORCID) [contributor]
Sebastian Kreutzer (ORCID) [contributor]
Thierry Onkelinx (ORCID) [contributor]
Useful links:
Report bugs at https://github.com/ropensci/codemetar/issues
create a codemeta list object in R for further manipulation. Similar
to write_codemeta()
, but returns an R list object rather
than writing directly to a file. See examples.
create_codemeta( pkg = ".", root = ".", id = NULL, use_filesize = FALSE, force_update = getOption("codemeta_force_update", TRUE), verbose = TRUE, ... )
create_codemeta( pkg = ".", root = ".", id = NULL, use_filesize = FALSE, force_update = getOption("codemeta_force_update", TRUE), verbose = TRUE, ... )
pkg |
package path to package root, or description file (character), or a codemeta object (list) |
root |
if pkg is a codemeta object, optionally give the path to package root. Default guess is current dir. |
id |
identifier for the package, e.g. a DOI (or other resolvable URL) |
use_filesize |
whether to try to estimating and adding a filesize by using
|
force_update |
Update guessed fields even if they are defined in an existing codemeta.json file |
verbose |
Whether to print messages indicating opinions e.g. when
DESCRIPTION has no URL. – See |
... |
additional arguments to |
a codemeta list object
path <- system.file("", package="codemeta") cm <- create_codemeta(path) cm$keywords <- list("metadata", "ropensci")
path <- system.file("", package="codemeta") cm <- create_codemeta(path) cm$keywords <- list("metadata", "ropensci")
Extract all badges from Markdown file
extract_badges(path)
extract_badges(path)
path |
Path to Markdown file |
A data.frame with for each badge its text, link and link to its image.
## Not run: extract_badges(system.file("examples/README_fakepackage.md", package="codemetar")) ## End(Not run)
## Not run: extract_badges(system.file("examples/README_fakepackage.md", package="codemetar")) ## End(Not run)
Function giving opinions about a package
give_opinions(pkg_path = getwd(), verbose = FALSE)
give_opinions(pkg_path = getwd(), verbose = FALSE)
pkg_path |
Path to the package root |
verbose |
Whether to print message related to internet download progress. |
A data.frame of opinions
write out a codemeta.json file for a given package. This function is
basically a wrapper around create_codemeta() to both create the codemeta
object and write it out to a JSON-LD-formatted file in one command. It can
also be used simply to write out to JSON-LD any existing object created with
create_codemeta()
.
write_codemeta( pkg = ".", path = "codemeta.json", root = ".", id = NULL, use_filesize = TRUE, force_update = getOption("codemeta_force_update", TRUE), use_git_hook = NULL, verbose = TRUE, write_minimeta = FALSE, ... )
write_codemeta( pkg = ".", path = "codemeta.json", root = ".", id = NULL, use_filesize = TRUE, force_update = getOption("codemeta_force_update", TRUE), use_git_hook = NULL, verbose = TRUE, write_minimeta = FALSE, ... )
pkg |
package path to package root, or description file (character), or a codemeta object (list) |
path |
file name of the output, leave at default "codemeta.json" |
root |
if pkg is a codemeta object, optionally give the path to package root. Default guess is current dir. |
id |
identifier for the package, e.g. a DOI (or other resolvable URL) |
use_filesize |
whether to try to estimating and adding a filesize by using
|
force_update |
Update guessed fields even if they are defined in an existing codemeta.json file |
use_git_hook |
Deprecated argument. |
verbose |
Whether to print messages indicating opinions e.g. when
DESCRIPTION has no URL. – See |
write_minimeta |
whether to also create the file schemaorg.json that
corresponds to the metadata Google would validate, to be inserted to a
webpage for SEO. It is saved as "inst/schemaorg.json" alongside |
... |
additional arguments to |
writes out the codemeta.json file, and schemaorg.json if write_codemeta
is TRUE
.
If pkg is a codemeta object, the function will attempt to update any fields it can guess (i.e. from the DESCRIPTION file), overwriting any existing data in that block. In this case, the package root directory should be the current working directory.
When creating and writing a codemeta.json for the first time, the function adds "codemeta.json" to .Rbuildignore.
## Not run: # from anywhere in the package source directory write_codemeta() ## End(Not run)
## Not run: # from anywhere in the package source directory write_codemeta() ## End(Not run)