Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New API #65

Merged
merged 32 commits into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b021277
Add new as.data.frame method
dieghernan Feb 15, 2024
7567cd6
Review docs
dieghernan Feb 15, 2024
784c8dc
Add as.person method
dieghernan Feb 16, 2024
6d8ece2
Update docs with pkgdev
github-actions[bot] Feb 16, 2024
d4642b6
revdepcheck
github-actions[bot] Feb 16, 2024
c0d7d63
Add head, tail and start working in reading files
dieghernan Feb 19, 2024
c1beb0e
Finish cff_read()
dieghernan Feb 19, 2024
b4d1f75
TODO examples
dieghernan Feb 19, 2024
f8673e9
revdepcheck
github-actions[bot] Feb 19, 2024
d9021af
Move readers
dieghernan Feb 20, 2024
40002b6
Handle DOI and corner case for VGAM
dieghernan Feb 20, 2024
2d6b569
New toBibtex.cff method
dieghernan Feb 26, 2024
aa16983
Improve linting
dieghernan Feb 27, 2024
df92a9d
Update tests
dieghernan Feb 27, 2024
186bdb1
Add new cff_write funs
dieghernan Feb 27, 2024
364a9f5
Deprecate warnings and other improvements
dieghernan Feb 27, 2024
44dc4d4
Start the review of the person conversion
dieghernan Feb 28, 2024
fe36c20
Try fixing issues
dieghernan Feb 28, 2024
e5e7c7a
Fix tests for devel version
dieghernan Feb 28, 2024
b5f6d85
Prepare new person and refactor tests and API
dieghernan Feb 29, 2024
3192a40
Add cff_create_cff_person
dieghernan Feb 29, 2024
b426462
Fix regex for older versions of R
dieghernan Feb 29, 2024
3d54999
revdepcheck
github-actions[bot] Mar 1, 2024
b5b468e
Update docs with pkgdev
github-actions[bot] Mar 1, 2024
b6a79d8
New API review and NEWS
dieghernan Mar 1, 2024
3245b70
Update pkgdown
dieghernan Mar 1, 2024
7b8430a
add_cff method
dieghernan Mar 1, 2024
e8cff76
Add as_cff, still left core functions
dieghernan Mar 2, 2024
de412dd
Update docs
dieghernan Mar 2, 2024
0247fbc
Deprecate arguments in cff()
dieghernan Mar 2, 2024
e924743
Add cff_modify
dieghernan Mar 3, 2024
8c751c9
Finish API
dieghernan Mar 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/workflows/check-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@ jobs:
config:
- {os: windows-latest, r: 'devel'}
- {os: windows-latest, r: 'release'}
# - {os: windows-latest, r: 'oldrel'}
- {os: windows-latest, r: 'oldrel'}
- {os: macOS-latest, r: 'devel'}
- {os: macOS-latest, r: 'release'}
#- {os: macOS-latest, r: 'oldrel'}
- {os: macOS-latest, r: 'oldrel'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
#- {os: ubuntu-latest, r: 'oldrel'}
#- {os: ubuntu-latest, r: 'oldrel-2'}
#- {os: ubuntu-latest, r: '3.6'}

- {os: ubuntu-latest, r: 'oldrel'}
- {os: ubuntu-latest, r: 'oldrel-2'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand Down
7 changes: 6 additions & 1 deletion .lintr
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
linters: linters_with_defaults() # see vignette("lintr")
encoding: "UTF-8"
exclusions: list("data-raw")
exclusions: list(
"data-raw",
"tests/testthat/test_ci/test-full_cff.R",
"vignettes/cffr.Rmd",
"vignettes/bibtex_cff.Rmd"
)
8 changes: 4 additions & 4 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ license: GPL-3.0-or-later
title: 'cffr: Generate Citation File Format (''cff'') Metadata for R Packages'
version: 0.5.0.9000
doi: 10.21105/joss.03900
abstract: The Citation File Format version 1.2.0 <doi:10.5281/zenodo.5171937> is a
human and machine readable file format which provides citation metadata for software.
This package provides core utilities to generate and validate this metadata.
abstract: The Citation File Format version 1.2.0 <https://doi.org/10.5281/zenodo.5171937>
is a human and machine readable file format which provides citation metadata for
software. This package provides core utilities to generate and validate this metadata.
authors:
- family-names: Hernangómez
given-names: Diego
Expand Down Expand Up @@ -96,7 +96,7 @@ references:
name: R Foundation for Statistical Computing
address: Vienna, Austria
year: '2024'
version: '>= 3.6.0'
version: '>= 4.0.0'
- type: software
title: cli
abstract: 'cli: Helpers for Developing Command Line Interfaces'
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ License: GPL (>= 3)
URL: https://docs.ropensci.org/cffr/, https://github.com/ropensci/cffr
BugReports: https://github.com/ropensci/cffr/issues
Depends:
R (>= 3.6.0)
R (>= 4.0.0)
Imports:
cli (>= 2.0.0),
desc (>= 1.3.0),
Expand Down
26 changes: 25 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,28 +1,50 @@
# Generated by roxygen2: do not edit by hand

S3method("[",cff_pers_list)
S3method("[",cff_ref_list)
S3method(as.data.frame,cff)
S3method(as.person,cff)
S3method(as_cff,Bibtex)
S3method(as_cff,bibentry)
S3method(as_cff,default)
S3method(as_cff,list)
S3method(as_cff,person)
S3method(c,cff)
S3method(head,cff)
S3method(print,cff)
S3method(tail,cff)
S3method(toBibtex,cff)
export(as.cff)
export(as_bibentry)
export(as_cff)
export(as_cff_person)
export(cff)
export(cff_create)
export(cff_extract_to_bibtex)
export(cff_from_bibtex)
export(cff_gha_update)
export(cff_git_hook_install)
export(cff_git_hook_remove)
export(cff_modify)
export(cff_parse_citation)
export(cff_parse_person)
export(cff_parse_person_bibtex)
export(cff_read)
export(cff_read_bib)
export(cff_read_bib_text)
export(cff_read_cff_citation)
export(cff_read_citation)
export(cff_read_description)
export(cff_schema_definitions_entity)
export(cff_schema_definitions_person)
export(cff_schema_definitions_refs)
export(cff_schema_keys)
export(cff_schema_keys_license)
export(cff_to_bibentry)
export(cff_to_bibtex)
export(cff_validate)
export(cff_write)
export(cff_write_bib)
export(cff_write_citation)
export(encoded_utf_to_latex)
export(write_bib)
export(write_citation)
Expand All @@ -33,9 +55,11 @@ importFrom(utils,bibentry)
importFrom(utils,capture.output)
importFrom(utils,citation)
importFrom(utils,download.file)
importFrom(utils,head)
importFrom(utils,installed.packages)
importFrom(utils,modifyList)
importFrom(utils,packageDescription)
importFrom(utils,person)
importFrom(utils,read.csv)
importFrom(utils,tail)
importFrom(utils,toBibtex)
104 changes: 78 additions & 26 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,78 @@
# cffr (development version)

## Major changes in the API

This is a major release with some notable changes. The change mainly **affects
to non-core functions**, hence the natural workflow (`cff_create()` →
`cff_write()` → `cff_validate()`) shouldn't be affected.

## Major changes

### API

The API has been completely reviewed to provide more clarity on functions naming
and to facilitate internal maintenance. This change **only** **affects to
non-core functions**. Now each function does less things but does it better. The
old API [has been
deprecated](https://lifecycle.r-lib.org/articles/stages.html#deprecated) and it
would warn when used, providing advice on the replacement function.

#### Deprecation

- `cff_to_bibtex()` and `cff_extract_to_bibtex()`: replaced by
`as_bibentry()`.
- `cff_from_bibtex()`: replaced by `cff_read_bib()` (for `*.bib` files) and
`cff_read_bib_text()` (for character strings).
- `write_bib()` and `write_citation()` : replaced by `cff_write_bib()` and
`cff_write_citation()` respectively.
- `cff_parse_person()` and `cff_parse_person_bibtex()`: replaced by
`as_cff_person()`.
- The conversion from `cff` to `bibentry` is performed now by a new function
`cff_to_bibentry()`. Previous names of this function were `cff_to_bibtex()`
and `cff_extract_to_bibtex()` that are now superseded.

## Changes on bibtex crosswalk

- **\@inbook** and **\@book** gains a new value on [CFF]{.underline} when
**series** is provided: [collection-type: book-series.]{.underline}
- Review and update `vignette("bibtex_cff", package = "cffr")`.
`as_bibentry()`. Previous names of this function were `cff_to_bibtex()` and
`cff_extract_to_bibtex()` that are now deprecated.
- `cff_parse_citation()`: replaced by `as_cff()`, see **New capabilities**.
- Argument `path` in `cff()` is also deprecated, use `cff_read()`.

### New capabilities

- New `as_cff()` S3 generic method (replacing `as.cff()`): This method coerces
**R** objects to `cff-class` format. Current methods provided are:
- `as_cff.Bibtex()`.
- `as_cff.bibentry()`, replacing cff_parse_citation().
- `as_cff.person()`, similar to `as_cff_person()` but only for `person`
objects. We recommend using `as_cff_person()` since it can parse also
string representing authors in BibTeX markup (`"{von Neumen}, James"`),
that can't be captured properly via methods.
- Now reading from external files is performed exclusively by `cff_read()`
(that is designed to fit all supported file types on a single entry point)
and the new specific readers (that are used under the hood by `cff_read()`),
namely:
- `cff_read_cff_citation()`,
- `cff_read_description()`,
- `cff_read_citation()`
- `cff_read_bib()`.
- New `cff_modify()` function for updating and modifying `cff` objects easily.

## Other changes

- Minimum **R** version required now is **4.0.0**.
- Now `class()` of `cff` objects are `c("cff", "list")` instead of single
value (`"cff"`).
- New S3 **base** and **utils** methods added:
- `as.data.frame.cff().`
- `as.person.cff()`, that provides results **only** for CFF keys defined
as
[person](https://github.com/citation-file-format/citation-file-format/blob/main/schema-guide.md#definitionsperson)
or
[entity](https://github.com/citation-file-format/citation-file-format/blob/main/schema-guide.md#definitionsentity)
(e.g. `authors`, `contacts`, `editors`, `publisher,` etc.).
- `head.cff()`, `tail.cff()`.
- `toBibtex.cff()`.
- Update of BibTeX crosswalk (see `vignette("bibtex_cff", package = "cffr")`)
and consequently changes in the mapping performed by `as_bibtex()`
`cff_parse_citation()`:
- **\@inbook** and **\@book** gains a new value on [CFF]{.underline} when
**series** is provided: [collection-type: book-series.]{.underline}
- Can handle BibLaTeX **\@inbook**, that differs significantly from BibTeX
**\@inbook**.

# cffr 0.5.0

Expand All @@ -27,7 +89,7 @@
## Enhancements

- Additional authors of a **R** package can be now included based on the role
on the DESCRIPTION file, via the parameter `authors_roles` (#49).
on the `DESCRIPTION` file, via the parameter `authors_roles` (#49).

- New message interface based on [**cli**](https://cli.r-lib.org/)
capabilities.
Expand Down Expand Up @@ -55,7 +117,7 @@

# cffr 0.3.0

- `preferred-citation` is only produced when a CITATION (**R**) file has been
- `preferred-citation` is only produced when a `CITATION` **R** file has been
provided with the package (#37).
- Improve email handling on authors.
- Add `cff_read()` function. This functionality was already implemented on
Expand All @@ -72,39 +134,29 @@
# cffr 0.2.1

- GitHub Action now runs only on `master` or `main`branch.

- Better handling of references

# cffr 0.2.0

- Now **cffr** extracts also information of the package dependencies and adds
the main citation of the dependencies to the `references` field, using
`citation(auto = TRUE)`.

- New `dependencies` parameter on `cff_create()` and `cff_write()`.

- Other improvements on `cff_parse_citation():`

- `cff_parse_citation()` extracts more information of authors, based on
the fields provided on the DESCRIPTION file.

the fields provided on the `DESCRIPTION` file.
- `cff_parse_citation()` does a better job extracting information from
`bibentry()` /BibTeX and mapping it to `preferred-citation/references`
fields of CFF.

- Add new functions for working with git pre-commit hooks
[![Experimental](https://lifecycle.r-lib.org/articles/figures/lifecycle-experimental.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental):

- `cff_git_hook_install()`
- `cff_git_hook_remove()`

- New BibTeX functions:

- `cff_extract_to_bibtex()`
- `cff_to_bibtex()`
- `cff_parse_person_bibtex()`
- `write_bib()`

- Add a new dependency: `lifecycle`.

# cffr 0.1.1
Expand All @@ -121,16 +173,16 @@

# cffr 0.0.2

- `cffr` is part now of rOpenSci.
- **cffr** is part now of rOpenSci.
- Update on docs and README.
- Add fuzzy match on `keys` parameter.
- New dataset: `cran_to_spdx`.
- Add DOI <https://doi.org/10.5281/zenodo.5509766>
- Citation of installed packages extracted using `citation().`
- Auto-generating `preferred-citation` key from DESCRIPTION.
- Auto-generating `preferred-citation` key from `DESCRIPTION`.
- Rename `cff_schema_definitions_reference()` to
`cff_schema_definitions_refs()`.
- "repository" key is supported.
- `repository` key is supported.
- Added vignette: `vignette("crosswalk", package = "cffr")`.
- Add support to Bioconductor packages.
- New function: `cff_gha_update()`.
Expand Down
Loading