{"id":14069076,"url":"https://github.com/r-lib/pkgconfig","last_synced_at":"2026-04-07T19:31:52.035Z","repository":{"id":20489326,"uuid":"23767512","full_name":"r-lib/pkgconfig","owner":"r-lib","description":"Private configuration for R packages","archived":false,"fork":false,"pushed_at":"2025-04-25T12:29:48.000Z","size":65,"stargazers_count":42,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-06T05:22:33.875Z","etag":null,"topics":["r"],"latest_commit_sha":null,"homepage":"","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.markdown","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,"zenodo":null}},"created_at":"2014-09-07T18:37:00.000Z","updated_at":"2025-10-06T09:15:43.000Z","dependencies_parsed_at":"2024-12-24T11:07:28.867Z","dependency_job_id":"63d97a1d-98e1-4105-8e3f-2d3f9630bb2e","html_url":"https://github.com/r-lib/pkgconfig","commit_stats":{"total_commits":76,"total_committers":3,"mean_commits":"25.333333333333332","dds":0.02631578947368418,"last_synced_commit":"b81ae038aa5fe5d7c66c363d45a002cd8f0a4503"},"previous_names":["gaborcsardi/pkgconfig"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/r-lib/pkgconfig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fpkgconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fpkgconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fpkgconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fpkgconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r-lib","download_url":"https://codeload.github.com/r-lib/pkgconfig/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fpkgconfig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31526665,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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:35.436Z","updated_at":"2026-04-07T19:31:52.013Z","avatar_url":"https://github.com/r-lib.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"\n# Private configuration for R packages\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/r-lib/pkgconfig/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/pkgconfig/actions/workflows/R-CMD-check.yaml)\n[![](https://www.r-pkg.org/badges/version/pkgconfig)](https://www.r-pkg.org/pkg/pkgconfig)\n[![](https://cranlogs.r-pkg.org/badges/pkgconfig)](https://www.r-pkg.org/pkg/pkgconfig)\n[![Codecov test coverage](https://codecov.io/gh/r-lib/pkgconfig/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-lib/pkgconfig?branch=main)\n\u003c!-- badges: end --\u003e\n\nEasy way to create configuration parameters in your R package. Configuration\nvalues set in different packages are independent.\n\nCall `set_config()` to set a configuration parameter.\nCall `get_config()` to query it.\n\n## Installation\n\nStable version:\n\n```r\ninstall.packages(\"pkgconfig\")\n```\n\nDevelopment version:\n\n```r\npak::pak(\"r-lib/pkgconfig\")\n```\n\n## Typical usage\n\n\u003e Note: this is a real example, but it is not yet implemented in\n\u003e the CRAN version of the `igraph` package.\n\nThe igraph package has two ways of returning a set of vertices. Before\nversion 1.0.0, it simply returned a numeric vector. From version 1.0.0\nit sets an S3 class on this vector by default, but it has an option\ncalled `return.vs.es` that can be set to `FALSE` to request the old\nbehavior.\n\nThe problem with the `return.vs.es` option is that it is global. Once set\nto `FALSE` (interactively or from a package), R will use that setting in\nall packages, which breaks packages that expect the new behavior.\n\n`pkgconfig` solves this problem, by providing configuration settings\nthat are private to packages. Setting a configuration key from a\ngiven package will only apply to that package.\n\n## Workflow\n\nLet's assume that two packages, `pkgA` and `pkgB`, both set the igraph\noption `return.vs.es`, but `pkgA` sets it to `TRUE`, and `pkgB` sets it\nto `FALSE`. Here is how their code will look.\n\n### `pkgA`\n\n`pkgA` imports `set_config` from the `pkgconfig` package, and sets\nthe `return.vs.es` option from it's `.onLoad` function:\n\n```r\n.onLoad \u003c- function(lib, pkg) {\n    pkgconfig::set_config(\"igraph::return.vs.es\" = TRUE)\n}\n```\n\n### `pkgB`\n\n`pkgB` is similar, but it sets the option to `FALSE`:\n\n```r\n.onLoad \u003c- function(lib, pkg) {\n    pkgconfig::set_config(\"igraph::return.vs.es\" = FALSE)\n}\n```\n\n### `igraph`\n\nThe igraph package will use `get_config` to query the option, and\nwill supply a fallback value for the cases when it is not set:\n\n```r\nreturn_vs_es_default \u003c- TRUE\n# ...\nigraph_func \u003c- function() {\n    # ...\n    pkgconfig::get_config(\"igraph::return.vs.es\", return_vs_es_default)\n\t# ...\n}\n```\n\nIf `igraph_func` is called from `pkgA` (maybe through other packages),\n`get_config` will return `TRUE`, and if it is called from `pkgB`,\n`get_config` will return `FALSE`. If no package on the call stack\nsets the `igraph::return.vs.es` option, then its default value is used,\nas specified in `igraph`.\n\n## What if `pkgA` calls `pkgB`?\n\nIt might happen that both `pkgA` and `pkgB` set an option, and\n`pkgA` also calls functions from `pkgB`, which in turn, might call\n`igraph`. In this case the package that is further down the call\nstack wins. In other words, if the call sequence looks like this:\n\n```\n... -\u003e pkgA -\u003e ... -\u003e pkgB -\u003e ... -\u003e igraph\n```\n\nthen `pkgB`'s value is used in `igraph`. (Assuming the last  `...` does\nnot contain a call to `pkgA` of course.)\n\n## Feedback\n\nPlease comment in the\n[Github issue tracker](https://github.com/r-lib/pkgconfig/issues)\nof the project.\n\n## License\n\nMIT © [Gábor Csárdi](https://github.com/gaborcsardi)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fpkgconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr-lib%2Fpkgconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fpkgconfig/lists"}