| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/lockfiles.R |
| 3 |
\name{lockfiles} |
| 4 |
\alias{lockfiles} |
| 5 |
\alias{lockfile_create} |
| 6 |
\alias{lockfile_read} |
| 7 |
\alias{lockfile_write} |
| 8 |
\alias{lockfile_modify} |
| 9 |
\title{Lockfiles} |
| 10 |
\usage{ |
| 11 |
lockfile_create( |
| 12 |
type = settings$snapshot.type(project = project), |
| 13 |
libpaths = .libPaths(), |
| 14 |
packages = NULL, |
| 15 |
exclude = NULL, |
| 16 |
prompt = interactive(), |
| 17 |
force = FALSE, |
| 18 |
..., |
| 19 |
project = NULL |
| 20 |
) |
| 21 |
|
| 22 |
lockfile_read(file = NULL, ..., project = NULL) |
| 23 |
|
| 24 |
lockfile_write(lockfile, file = NULL, ..., project = NULL) |
| 25 |
|
| 26 |
lockfile_modify( |
| 27 |
lockfile = NULL, |
| 28 |
..., |
| 29 |
remotes = NULL, |
| 30 |
repos = NULL, |
| 31 |
project = NULL |
| 32 |
) |
| 33 |
} |
| 34 |
\arguments{ |
| 35 |
\item{type}{The type of snapshot to perform: |
| 36 |
\itemize{ |
| 37 |
\item \code{"implicit"}, (the default), uses all packages captured by \code{\link[=dependencies]{dependencies()}}. |
| 38 |
\item \code{"explicit"} uses packages recorded in \code{DESCRIPTION}. |
| 39 |
\item \code{"all"} uses all packages in the project library. |
| 40 |
\item \code{"custom"} uses a custom filter. |
| 41 |
} |
| 42 |
|
| 43 |
See \strong{Snapshot types} below for more details.} |
| 44 |
|
| 45 |
\item{libpaths}{The library paths to be used when generating the lockfile.} |
| 46 |
|
| 47 |
\item{packages}{A vector of packages to be included in the lockfile. When |
| 48 |
\code{NULL} (the default), all packages relevant for the type of snapshot being |
| 49 |
performed will be included. When set, the \code{type} argument is ignored. |
| 50 |
Recursive dependencies of the specified packages will be added to the |
| 51 |
lockfile as well.} |
| 52 |
|
| 53 |
\item{exclude}{A vector of packages to be explicitly excluded from the lockfile. |
| 54 |
Note that transitive package dependencies will always be included, to avoid |
| 55 |
potentially creating an incomplete / non-functional lockfile.} |
| 56 |
|
| 57 |
\item{prompt}{Boolean; prompt the user before taking any action? For backwards |
| 58 |
compatibility, \code{confirm} is accepted as an alias for \code{prompt}.} |
| 59 |
|
| 60 |
\item{force}{Boolean; force generation of a lockfile even when pre-flight |
| 61 |
validation checks have failed?} |
| 62 |
|
| 63 |
\item{...}{Unused arguments, reserved for future expansion. If any arguments |
| 64 |
are matched to \code{...}, renv will signal an error.} |
| 65 |
|
| 66 |
\item{project}{The project directory. If \code{NULL}, then the active project will |
| 67 |
be used. If no project is currently active, then the current working |
| 68 |
directory is used instead.} |
| 69 |
|
| 70 |
\item{file}{A file path, or \R connection.} |
| 71 |
|
| 72 |
\item{lockfile}{An \code{renv} lockfile; typically created by either |
| 73 |
\code{lockfile_create()} or \code{lockfile_read()}.} |
| 74 |
|
| 75 |
\item{remotes}{An \R vector of remote specifications.} |
| 76 |
|
| 77 |
\item{repos}{A named vector, mapping \R repository names to their URLs.} |
| 78 |
} |
| 79 |
\description{ |
| 80 |
A \strong{lockfile} records the state of a project at some point in time. |
| 81 |
} |
| 82 |
\details{ |
| 83 |
A lockfile captures the state of a project's library at some point in time. |
| 84 |
In particular, the package names, their versions, and their sources (when |
| 85 |
known) are recorded in the lockfile. |
| 86 |
|
| 87 |
Projects can be restored from a lockfile using the \code{\link[=restore]{restore()}} function. This |
| 88 |
implies reinstalling packages into the project's private library, as encoded |
| 89 |
within the lockfile. |
| 90 |
|
| 91 |
While lockfiles are normally generated and used with \code{\link[=snapshot]{snapshot()}} / |
| 92 |
\code{\link[=restore]{restore()}}, they can also be edited by hand if so desired. Lockfiles are |
| 93 |
written as \code{.json}, to allow for easy consumption by other tools. |
| 94 |
|
| 95 |
An example lockfile follows: |
| 96 |
|
| 97 |
\if{html}{\out{<div class="sourceCode">}}\preformatted{\{ |
| 98 |
"R": \{ |
| 99 |
"Version": "3.6.1", |
| 100 |
"Repositories": [ |
| 101 |
\{ |
| 102 |
"Name": "CRAN", |
| 103 |
"URL": "https://cloud.r-project.org" |
| 104 |
\} |
| 105 |
] |
| 106 |
\}, |
| 107 |
"Packages": \{ |
| 108 |
"markdown": \{ |
| 109 |
"Package": "markdown", |
| 110 |
"Version": "1.0", |
| 111 |
"Source": "Repository", |
| 112 |
"Repository": "CRAN", |
| 113 |
"Hash": "4584a57f565dd7987d59dda3a02cfb41" |
| 114 |
\}, |
| 115 |
"mime": \{ |
| 116 |
"Package": "mime", |
| 117 |
"Version": "0.7", |
| 118 |
"Source": "Repository", |
| 119 |
"Repository": "CRAN", |
| 120 |
"Hash": "908d95ccbfd1dd274073ef07a7c93934" |
| 121 |
\} |
| 122 |
\} |
| 123 |
\} |
| 124 |
}\if{html}{\out{</div>}} |
| 125 |
|
| 126 |
The sections used within a lockfile are described next. |
| 127 |
\subsection{renv}{ |
| 128 |
|
| 129 |
Information about the version of renv used to manage this project. |
| 130 |
|
| 131 |
\tabular{ll}{ |
| 132 |
\strong{Version} \tab The version of the renv package used with this project. \cr |
| 133 |
} |
| 134 |
} |
| 135 |
|
| 136 |
\subsection{R}{ |
| 137 |
|
| 138 |
Properties related to the version of \R associated with this project. |
| 139 |
|
| 140 |
\tabular{ll}{ |
| 141 |
\strong{Version} \tab The version of \R used. \cr |
| 142 |
\strong{Repositories} \tab The \R repositories used in this project. \cr |
| 143 |
} |
| 144 |
} |
| 145 |
|
| 146 |
\subsection{Packages}{ |
| 147 |
|
| 148 |
\R package records, capturing the packages used or required by a project |
| 149 |
at the time when the lockfile was generated. |
| 150 |
|
| 151 |
\tabular{ll}{ |
| 152 |
\strong{Package} \tab The package name. \cr |
| 153 |
\strong{Version} \tab The package version. \cr |
| 154 |
\strong{Source} \tab The location from which this package was retrieved. \cr |
| 155 |
\strong{Repository} \tab The name of the repository (if any) from which this package was retrieved. \cr |
| 156 |
\strong{Hash} \tab (Optional) A unique hash for this package, used for package caching. \cr |
| 157 |
} |
| 158 |
|
| 159 |
Additional remote fields, further describing how the package can be |
| 160 |
retrieved from its corresponding source, will also be included as |
| 161 |
appropriate (e.g. for packages installed from GitHub). |
| 162 |
} |
| 163 |
|
| 164 |
\subsection{Python}{ |
| 165 |
|
| 166 |
Metadata related to the version of Python used with this project (if any). |
| 167 |
|
| 168 |
\tabular{ll}{ |
| 169 |
\strong{Version} \tab The version of Python being used. \cr |
| 170 |
\strong{Type} \tab The type of Python environment being used ("virtualenv", "conda", "system") \cr |
| 171 |
\strong{Name} \tab The (optional) name of the environment being used. |
| 172 |
} |
| 173 |
|
| 174 |
Note that the \code{Name} field may be empty. In that case, a project-local Python |
| 175 |
environment will be used instead (when not directly using a system copy of Python). |
| 176 |
} |
| 177 |
} |
| 178 |
\section{Caveats}{ |
| 179 |
These functions are primarily intended for expert users -- in most cases, |
| 180 |
\code{\link[=snapshot]{snapshot()}} and \code{\link[=restore]{restore()}} are the primariy tools you will need when |
| 181 |
creating and using lockfiles. |
| 182 |
} |
| 183 |
|
| 184 |
\seealso{ |
| 185 |
Other reproducibility: |
| 186 |
\code{\link{restore}()}, |
| 187 |
\code{\link{snapshot}()} |
| 188 |
} |
| 189 |
\concept{reproducibility} |