desc

Manipulate DESCRIPTION files

https://github.com/r-lib/desc

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 22 committers (4.5%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.0%) to scientific vocabulary

Keywords

r

Keywords from Contributors

setup tidy-data unit-testing package-creation rmarkdown grammar data-manipulation visualisation documentation-tool book
Last synced: 10 months ago · JSON representation

Repository

Manipulate DESCRIPTION files

Basic Info
  • Host: GitHub
  • Owner: r-lib
  • License: other
  • Language: R
  • Default Branch: main
  • Homepage: https://desc.r-lib.org/
  • Size: 6.75 MB
Statistics
  • Stars: 126
  • Watchers: 3
  • Forks: 29
  • Open Issues: 18
  • Releases: 5
Topics
r
Created almost 11 years ago · Last pushed 10 months ago
Metadata Files
Readme Changelog License Code of conduct

README.Rmd

---
output: github_document
---

```{r, setup, echo = FALSE, message = FALSE}
knitr::opts_chunk$set(
  comment = "#>",
  tidy = FALSE,
  error = FALSE
)
```

# desc

> Parse DESCRIPTION files


[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-green.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![R-CMD-check](https://github.com/r-lib/desc/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/desc/actions/workflows/R-CMD-check.yaml)
[![](https://www.r-pkg.org/badges/version/desc)](https://www.r-pkg.org/pkg/desc)
[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/desc)](https://www.r-pkg.org/pkg/desc)
[![Codecov test coverage](https://codecov.io/gh/r-lib/desc/graph/badge.svg)](https://app.codecov.io/gh/r-lib/desc)


Parse, manipulate and reformat DESCRIPTION files. The package
provides two APIs, one is object oriented, the other one is
procedural and manipulates the files *in place*.

---

  - [Installation](#installation)
  - [The object oriented API](#the-oo-api)
    - [Introduction](#introduction)
    - [Loading or creating new `DESCRIPTION` files](#loading-or-creating-new-description-files)
	- [Normalizing `DESCRIPTION` files](#normalizing-description-files)
	- [Querying, changing and removing fields](#querying-changing-and-removing-fields)
	- [Dependencies](#dependencies)
	- [Collate fields](#collate-fields)
	- [Authors](#authors)
  - [The procedural API](#the-procedural-api)
  - [License](#license)

## Installation

```{r, eval = FALSE}
# Install the released version from CRAN
install.packages("desc")

# Or the development version from GitHub:
# install.packages("pak")
pak::pak("r-lib/desc")
```

## The object oriented API

```{r}
library(desc)
```

### Introduction

The object oriented API uses [R6](https://github.com/r-lib/R6) classes.

### Loading or creating new `DESCRIPTION` files

A new `description` object can be created by reading a `DESCRIPTION`
file form the disk. By default the `DESCRIPTION` file in the current
directory is read:

```{r include = FALSE}
desc <- description$new("tools/pkg1")
```

```{r eval = FALSE}
desc <- description$new()
```

```{r}
desc
```

A new object can also be created from scratch:

```{r}
desc2 <- description$new("!new")
desc2
```

### Normalizing `DESCRIPTION` files

Most `DESCRIPTION` fields may be formatted in multiple equivalent
ways. `desc` does not reformat fields, unless they are
updated or reformatting is explicitly requested via a call to
the `normalize()` method or using the `normalize` argument of the
`write()` method.

### Querying, changing and removing fields

`get()` and `set()` queries or updates a field:

```{r}
desc$set("Package", "foo")
desc$get("Package")
```

They work with multiple fields as well:

```{r}
desc$set(Package = "bar", Title = "Bar Package")
desc$get(c("Package", "Title"))
```

### Dependencies

Package dependencies can be set and updated via an easier API:

```{r}
desc$get_deps()
desc$set_dep("mvtnorm")
desc$set_dep("Rcpp", "LinkingTo")
desc$get_deps()
desc
```

### Collate fields

Collate fields can be queried and set using simple character
vectors of file names:

```{r}
desc$set_collate(list.files("../R"))
desc$get_collate()
```

### Authors

Authors information, when specified via the `Authors@R` field,
also has a simplified API:

```{r, include=FALSE}
withr::local_envvar(
  c("FULLNAME" = "First Last", "EMAIL" = "first.last@dom.com")
)
```

```{r}
desc <- description$new("tools/pkg2")
desc$get_authors()
desc$add_author("Bugs", "Bunny", email = "bb@acme.com")
desc$add_me()
desc$add_author_gh("jeroen")
desc$get_authors()
```

If the `Author` field is specified, it can be changed to a `Authors@R` field
using `coerce_authors_at_r()`, incorporating the `Maintainer` information if necessary:

```{r, error = TRUE}
desc <- description$new("!new")
desc$del("Authors@R")
desc$del("Maintainer")
desc$set(Author = "Gábor Csárdi ")
desc$get_authors()
desc$coerce_authors_at_r()
desc$get_authors()
```

## The procedural API

The procedural API is simpler to use for one-off `DESCRIPTION`
manipulation, since it does not require dealing with
`description` objects. Each object oriented method has a
procedural counterpart that works on a file, and potentially
writes its result back to the same file.

For example, adding a new dependency to `DESCRIPTION` in the
current working directory can be done with

```{r}
desc_set_dep("newpackage", "Suggests")
```

This added `newpackage` to the `Suggests` field:

```{r}
desc_get("Suggests")
```

So the full list of dependencies are now

```{r}
desc_get_deps()
```

```{r include = FALSE}
desc_del_dep("newpackage")
```

## Code of Conduct

Please note that the desc project is released with a
[Contributor Code of Conduct](https://desc.r-lib.org/CODE_OF_CONDUCT.html).
By contributing to this project, you agree to abide by its terms.

Owner

  • Name: R infrastructure
  • Login: r-lib
  • Kind: organization

GitHub Events

Total
  • Issues event: 5
  • Watch event: 3
  • Delete event: 1
  • Issue comment event: 7
  • Push event: 7
  • Pull request event: 11
  • Fork event: 2
  • Create event: 1
Last Year
  • Issues event: 5
  • Watch event: 3
  • Delete event: 1
  • Issue comment event: 7
  • Push event: 7
  • Pull request event: 11
  • Fork event: 2
  • Create event: 1

Committers

Last synced: 12 months ago

All Time
  • Total Commits: 388
  • Total Committers: 22
  • Avg Commits per committer: 17.636
  • Development Distribution Score (DDS): 0.206
Past Year
  • Commits: 22
  • Committers: 4
  • Avg Commits per committer: 5.5
  • Development Distribution Score (DDS): 0.364
Top Committers
Name Email Commits
Gábor Csárdi c****r@g****m 308
Kirill Müller k****r@i****h 18
Andy Teucher a****r@g****m 11
Maëlle Salmon m****n@y****e 11
Daniel Possenriede p****e@g****m 8
Malcolm Barrett m****t@g****m 5
Jenny Bryan j****n@g****m 4
Jim Hester j****r@g****m 3
Salim B s****m@p****e 3
niceume t****i@n****m 3
Kevin Ushey k****y@g****m 2
Kirill Müller k****r 2
Devin Pastoor d****r@g****m 1
Hadley Wickham h****m@g****m 1
Jeroen Ooms j****s@g****m 1
John Muschelli m****2@g****m 1
Lluís l****s 1
Lorenz Walthert l****t@i****m 1
Luke W Johnston l****6 1
Mikko Korpela m****l@i****i 1
Rich FitzJohn r****n@g****m 1
seankross s****0@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 75
  • Total pull requests: 53
  • Average time to close issues: 7 months
  • Average time to close pull requests: about 2 months
  • Total issue authors: 36
  • Total pull request authors: 23
  • Average comments per issue: 2.23
  • Average comments per pull request: 2.64
  • Merged pull requests: 38
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 5
  • Pull requests: 9
  • Average time to close issues: about 2 hours
  • Average time to close pull requests: about 5 hours
  • Issue authors: 4
  • Pull request authors: 3
  • Average comments per issue: 0.6
  • Average comments per pull request: 1.0
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • gaborcsardi (15)
  • maelle (8)
  • jennybc (7)
  • hadley (6)
  • jimhester (5)
  • januz (2)
  • krlmlr (2)
  • ateucher (2)
  • infotroph (1)
  • salim-b (1)
  • llrs (1)
  • schloerke (1)
  • Farbfetzen (1)
  • gvegayon (1)
  • DavisVaughan (1)
Pull Request Authors
  • maelle (10)
  • gaborcsardi (8)
  • jimhester (4)
  • ateucher (3)
  • jennybc (3)
  • malcolmbarrett (3)
  • lorenzwalthert (3)
  • Jakerson22 (3)
  • kevinushey (2)
  • krlmlr (2)
  • salim-b (2)
  • seankross (2)
  • niceume (1)
  • lwjohnst86 (1)
  • hadley (1)
Top Labels
Issue Labels
bug (10) feature (9) upkeep (8) tidy-dev-day :nerd_face: (5) help wanted :heart: (4) documentation (3) good first issue :heart: (3) reprex (1)
Pull Request Labels

Packages

  • Total packages: 3
  • Total downloads:
    • cran 399,078 last-month
  • Total docker downloads: 86,471,488
  • Total dependent packages: 98
    (may contain duplicates)
  • Total dependent repositories: 288
    (may contain duplicates)
  • Total versions: 21
  • Total maintainers: 1
cran.r-project.org: desc

Manipulate DESCRIPTION Files

  • Versions: 10
  • Dependent Packages: 71
  • Dependent Repositories: 238
  • Downloads: 399,078 Last month
  • Docker Downloads: 86,471,488
Rankings
Downloads: 0.4%
Dependent repos count: 1.1%
Dependent packages count: 1.2%
Forks count: 3.4%
Stargazers count: 3.4%
Average: 4.5%
Docker downloads count: 17.3%
Maintainers (1)
Last synced: 10 months ago
proxy.golang.org: github.com/r-lib/desc
  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 10 months ago
conda-forge.org: r-desc
  • Versions: 6
  • Dependent Packages: 27
  • Dependent Repositories: 50
Rankings
Dependent packages count: 2.5%
Dependent repos count: 5.1%
Average: 18.5%
Stargazers count: 32.2%
Forks count: 34.1%
Last synced: 10 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.4 depends
  • R6 * imports
  • cli * imports
  • rprojroot * imports
  • utils * imports
  • callr * suggests
  • covr * suggests
  • gh * suggests
  • spelling * suggests
  • testthat * suggests
  • whoami * suggests
  • withr * suggests
tests/testthat/files/DESCRIPTION cran
  • R6 * imports
  • testthat * suggests
tools/pkg1/DESCRIPTION cran
  • R6 * imports
  • newpackage * suggests
  • testthat * suggests
  • whoami * suggests
tools/pkg2/DESCRIPTION cran
  • R >= 3.0.2 depends
  • Rcpp >= 0.11.0 imports
  • brew * imports
  • digest * imports
  • methods * imports
  • stringr >= 0.5 imports
  • knitr * suggests
  • testthat >= 0.8.0 suggests