-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚸 Improve the user experience for setting up Python & reticulate (#129)
* ✨ Add install_lamindb() function Installs lamindb into a new or existing environment * ✨ Add .onLoad() function Sets the default Python environment if reticulate is not already connected * ➕ Move reticulate to Imports * ✨ Add lamin_connect() function * 📝 Add setup vignette Adjust instructions in other documentation * ✨ Add lamin_login() function * 👷 Use R setup functions for CI * 📝 Roxygenise * 🚨 Fix lint * 💚 Fix missing shell in CI * 🐛 Fix lamin_login function name * 🐛 Remove argument check in lamin_login() * 📝 Fix \dontru{} in example * ➕ Install s3fs on CI * 📝 Adjust setup vignette title * Update R-CMD-check.yaml * 💚 Install laminr in check action * 💚 Use pak to install tiledbsoma on GHA * 💚 Use reticulate to install Python 3.12 on macOS * 💚 Correctly install Python 3.12 on macOS not Linux * 🐛 Fix logic in lamin_login() * 🐛 Adjust settings directory path for Windows * 📝 Update CHANGELOG * 📝 Remove login with user from README * 📝 Update development vignette * 📝 Fix version in CHANGELOG --------- Co-authored-by: Robrecht Cannoodt <[email protected]>
- Loading branch information
Showing
16 changed files
with
443 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#' Install LaminDB | ||
#' | ||
#' Create a Python environment containing **lamindb** or install **lamindb** | ||
#' into an existing environment. | ||
#' | ||
#' @param ... Additional arguments passed to `reticulate::py_install()` | ||
#' @param envname String giving the name of the environment to install packages | ||
#' into | ||
#' @param extra_packages A vector giving the names of additional Python packages | ||
#' to install | ||
#' @param new_env Whether to remove any existing `virtualenv` with the same name | ||
#' before creating a new one with the requested packages | ||
#' | ||
#' @return The result of `reticulate::py_install()` | ||
#' @export | ||
#' | ||
#' @details | ||
#' See `vignette("setup", package = "laminr")` for further details on setting up | ||
#' a Python environment | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
#' install_lamindb() | ||
#' | ||
#' # Add additional packages to the environment | ||
#' install_lamindb(extra_packages = c("bionty", "wetlab")) | ||
#' | ||
#' # Install into a different environment | ||
#' install_lamindb(envvname = "your-env") | ||
#' } | ||
install_lamindb <- function(..., envname = "r-lamindb", extra_packages = NULL, | ||
new_env = identical(envname, "r-lamindb")) { | ||
|
||
if (new_env && reticulate::virtualenv_exists(envname)) { | ||
reticulate::virtualenv_remove(envname) | ||
} | ||
|
||
packages <- unique(c( | ||
"lamindb", | ||
"ipython", | ||
extra_packages | ||
)) | ||
reticulate::py_install(packages = packages, envname = envname, ...) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.onLoad <- function(libname, pkgname) { | ||
reticulate::use_virtualenv("r-lamindb", required = FALSE) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.