{"id":14069064,"url":"https://github.com/r-lib/desc","last_synced_at":"2025-05-15T00:12:18.887Z","repository":{"id":2146068,"uuid":"42076495","full_name":"r-lib/desc","owner":"r-lib","description":"Manipulate DESCRIPTION files","archived":false,"fork":false,"pushed_at":"2025-02-05T08:52:56.000Z","size":6911,"stargazers_count":124,"open_issues_count":14,"forks_count":29,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-06T17:09:17.324Z","etag":null,"topics":["r"],"latest_commit_sha":null,"homepage":"https://desc.r-lib.org/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r-lib.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-07T22:01:43.000Z","updated_at":"2025-04-05T13:54:35.000Z","dependencies_parsed_at":"2022-08-21T06:50:38.280Z","dependency_job_id":"f63e112e-14bb-46fb-902b-6a5547ad8ebe","html_url":"https://github.com/r-lib/desc","commit_stats":{"total_commits":357,"total_committers":20,"mean_commits":17.85,"dds":0.2016806722689075,"last_synced_commit":"c8463062edf4dc5501c66d4e8f6019743fae3fa3"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fdesc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fdesc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fdesc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fdesc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r-lib","download_url":"https://codeload.github.com/r-lib/desc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248784772,"owners_count":21161177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["r"],"created_at":"2024-08-13T07:06:34.958Z","updated_at":"2025-04-13T21:28:27.687Z","avatar_url":"https://github.com/r-lib.png","language":"R","funding_links":[],"categories":["R","Meta-packages"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n```{r, setup, echo = FALSE, message = FALSE}\nknitr::opts_chunk$set(\n  comment = \"#\u003e\",\n  tidy = FALSE,\n  error = FALSE\n)\n```\n\n# desc\n\n\u003e Parse DESCRIPTION files\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-green.svg)](https://lifecycle.r-lib.org/articles/stages.html)\n[![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)\n[![Codecov test coverage](https://codecov.io/gh/r-lib/desc/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-lib/desc?branch=main)\n[![](https://www.r-pkg.org/badges/version/desc)](https://www.r-pkg.org/pkg/desc)\n[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/desc)](https://www.r-pkg.org/pkg/desc)\n\u003c!-- badges: end --\u003e\n\nParse, manipulate and reformat DESCRIPTION files. The package\nprovides two APIs, one is object oriented, the other one is\nprocedural and manipulates the files *in place*.\n\n---\n\n  - [Installation](#installation)\n  - [The object oriented API](#the-oo-api)\n    - [Introduction](#introduction)\n    - [Loading or creating new `DESCRIPTION` files](#loading-or-creating-new-description-files)\n\t- [Normalizing `DESCRIPTION` files](#normalizing-description-files)\n\t- [Querying, changing and removing fields](#querying-changing-and-removing-fields)\n\t- [Dependencies](#dependencies)\n\t- [Collate fields](#collate-fields)\n\t- [Authors](#authors)\n  - [The procedural API](#the-procedural-api)\n  - [License](#license)\n\n## Installation\n\n```{r, eval = FALSE}\n# Install the released version from CRAN\ninstall.packages(\"desc\")\n\n# Or the development version from GitHub:\n# install.packages(\"pak\")\npak::pak(\"r-lib/desc\")\n```\n\n## The object oriented API\n\n```{r}\nlibrary(desc)\n```\n\n### Introduction\n\nThe object oriented API uses [R6](https://github.com/r-lib/R6) classes.\n\n### Loading or creating new `DESCRIPTION` files\n\nA new `description` object can be created by reading a `DESCRIPTION`\nfile form the disk. By default the `DESCRIPTION` file in the current\ndirectory is read:\n\n```{r include = FALSE}\ndesc \u003c- description$new(\"tools/pkg1\")\n```\n\n```{r eval = FALSE}\ndesc \u003c- description$new()\n```\n\n```{r}\ndesc\n```\n\nA new object can also be created from scratch:\n\n```{r}\ndesc2 \u003c- description$new(\"!new\")\ndesc2\n```\n\n### Normalizing `DESCRIPTION` files\n\nMost `DESCRIPTION` fields may be formatted in multiple equivalent\nways. `desc` does not reformat fields, unless they are\nupdated or reformatting is explicitly requested via a call to\nthe `normalize()` method or using the `normalize` argument of the\n`write()` method.\n\n### Querying, changing and removing fields\n\n`get()` and `set()` queries or updates a field:\n\n```{r}\ndesc$set(\"Package\", \"foo\")\ndesc$get(\"Package\")\n```\n\nThey work with multiple fields as well:\n\n```{r}\ndesc$set(Package = \"bar\", Title = \"Bar Package\")\ndesc$get(c(\"Package\", \"Title\"))\n```\n\n### Dependencies\n\nPackage dependencies can be set and updated via an easier API:\n\n```{r}\ndesc$get_deps()\ndesc$set_dep(\"mvtnorm\")\ndesc$set_dep(\"Rcpp\", \"LinkingTo\")\ndesc$get_deps()\ndesc\n```\n\n### Collate fields\n\nCollate fields can be queried and set using simple character\nvectors of file names:\n\n```{r}\ndesc$set_collate(list.files(\"../R\"))\ndesc$get_collate()\n```\n\n### Authors\n\nAuthors information, when specified via the `Authors@R` field,\nalso has a simplified API:\n\n```{r, include=FALSE}\nwithr::local_envvar(\n  c(\"FULLNAME\" = \"First Last\", \"EMAIL\" = \"first.last@dom.com\")\n)\n```\n\n```{r}\ndesc \u003c- description$new(\"tools/pkg2\")\ndesc$get_authors()\ndesc$add_author(\"Bugs\", \"Bunny\", email = \"bb@acme.com\")\ndesc$add_me()\ndesc$add_author_gh(\"jeroen\")\ndesc$get_authors()\n```\n\nIf the `Author` field is specified, it can be changed to a `Authors@R` field\nusing `coerce_authors_at_r()`, incorporating the `Maintainer` information if necessary:\n\n```{r, error = TRUE}\ndesc \u003c- description$new(\"!new\")\ndesc$del(\"Authors@R\")\ndesc$del(\"Maintainer\")\ndesc$set(Author = \"Gábor Csárdi \u003ccsardi.gabor@gmail.com\u003e\")\ndesc$get_authors()\ndesc$coerce_authors_at_r()\ndesc$get_authors()\n```\n\n## The procedural API\n\nThe procedural API is simpler to use for one-off `DESCRIPTION`\nmanipulation, since it does not require dealing with\n`description` objects. Each object oriented method has a\nprocedural counterpart that works on a file, and potentially\nwrites its result back to the same file.\n\nFor example, adding a new dependency to `DESCRIPTION` in the\ncurrent working directory can be done with\n\n```{r}\ndesc_set_dep(\"newpackage\", \"Suggests\")\n```\n\nThis added `newpackage` to the `Suggests` field:\n\n```{r}\ndesc_get(\"Suggests\")\n```\n\nSo the full list of dependencies are now\n\n```{r}\ndesc_get_deps()\n```\n\n```{r include = FALSE}\ndesc_del_dep(\"newpackage\")\n```\n\n## Code of Conduct\n\nPlease note that the desc project is released with a\n[Contributor Code of Conduct](https://desc.r-lib.org/CODE_OF_CONDUCT.html).\nBy contributing to this project, you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fdesc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr-lib%2Fdesc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fdesc/lists"}