
Install a paper's declared Python dependencies into a throwaway environment
Source:R/reproducibility_check_python.R
repro_install_deps_py.RdThe process-sandbox twin of repro_install_deps(): installs each
non-stdlib dependency via pip install --target <lib_dir>, so a run does
not touch the host's own site-packages. A manifest-pinned requirement
(ref non-NA — see repro_dependencies_py()) is installed by that exact
requirement text (honouring the pin); an import-only package (ref NA) is
installed by bare name, latest version. Installing runs a package's own
build/setup code, so this is part of the gated execute phase, same as its
R counterpart.
Arguments
- install_deps
the module's Python
install_depsframe (package,source,ref), base/stdlib rows already excluded- lib_dir
the throwaway install target (created if absent); passed to
pip install --target- python_bin
the
pythonexecutable to invoke-m pipwith (default"python", resolved viaSys.which()at call time so a missing interpreter fails with a clear message rather than a crypticpiperror)- timeout
per-
pip installtimeout in seconds (default 300)
Value
a data frame with package, source, installed (logical),
message (error text/pip stderr on failure, else ""), via_archive
(always FALSE — pip has no CRAN-Archive-style fallback registry to retry
against), and category (always NA — pip's own error text is not
classified into categories the way .repro_classify_install_message()
does for R's install.packages()/BiocManager error shapes) — same column
SET as repro_install_deps() so callers do not need to branch on which
language ran.
Examples
if (FALSE) { # \dontrun{
# needs Python; installs packages with pip into a throwaway folder
deps <- repro_dependencies_py("import numpy as np")
repro_install_deps_py(deps, file.path(tempdir(), "pylib"))
} # }