Skip to content

Commit

Permalink
fix: empty table when using python with no imports
Browse files Browse the repository at this point in the history
  • Loading branch information
akselthomsen committed Dec 10, 2024
1 parent 2b1082d commit f6bee4f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions R/session.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#'
#' @noRd

session_info <- function(approved_folder_pkgs = NULL, approved_url_pkgs = NULL, python = FALSE, python_packages = NULL) {
session_info <- function(approved_folder_pkgs = NULL, approved_url_pkgs = NULL, python_packages = NULL) {
info <- sessioninfo::session_info()

if (!is.null(approved_folder_pkgs) |
Expand Down Expand Up @@ -45,7 +45,7 @@ session_info <- function(approved_folder_pkgs = NULL, approved_url_pkgs = NULL,
}
}

if (python) {
if (!is.null(python_packages)) {

# TODO: Get the same information as for R packages (not only name and version)
# TODO: Only show used, and not all installed, packages if possible
Expand Down Expand Up @@ -74,7 +74,11 @@ python_package_info <- function(json) {

json <- jsonlite::fromJSON(json)

if (!length(json)) return(NULL)
if (!length(json)) {
return(structure(list(Package = character(0), Version = character(0),
Path = character(0)), row.names = integer(0), class = c("tbl_df",
"tbl", "data.frame")))
}

json |>
tibble::enframe(name = "Package") |>
Expand Down

0 comments on commit f6bee4f

Please sign in to comment.