permit_mutation: Choose how extensively devutils affects a package namespace

View source: R/permissions.R

permit_mutationR Documentation

Choose how extensively devutils affects a package namespace

Description

devutils will invariably inject some objects into the package namespace. However, the extent to which this happens may be undesirable. Unless new privileges are granted, devutils will aim to minimally affect your namespace.

Usage

permit_mutation(which = c("all", "some", "none"), env = parent.frame())

Permission Tiers

Each level of permissioning grants additional permissions to modify your package namespace. From least to most extensive, permissions are granted as one of

"none"

Minimalist permissions, and the default behavior.

  • Creates a .devutils environment in your package namespace wherein settings and data are stored

"some"

Moderate permissions, modifying your namespace, but only as a side effect of direct use of devutils functions.

  • using suggested creates an object of the package's name in the package environment, which can be used with $ or [[ indexing

"all"

Full permissions, additionally masking some base functions in your package namespace.

  • Masks base :: and ::: to automatically handle suggested packages, throwing errors when unavailable suggested package functions are called

Examples

## Not run: permit_mutation("some")
utils <- suggested("utils")
utils$head(1:10)

permit_mutation("all")
suggested("utils")
utils::head(1:10)

permit_mutation("all")
suggested("not.a.real.package")
not.a.real.package::head(1:10)
# Error: This feature is unavailable because package 'not.a.real.package'
#   is not installed.

## End(Not run)


dgkf/devutils documentation built on Jan. 3, 2023, 7:26 a.m.