From 98fe425c2600d7c3fce9f7241e64b80b72999cad Mon Sep 17 00:00:00 2001 From: Luke Zappia Date: Wed, 20 Nov 2024 14:13:09 +0100 Subject: [PATCH 1/4] Swap argument positions in Instance$track() --- R/Instance.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/R/Instance.R b/R/Instance.R index 4bce2e0..1852155 100644 --- a/R/Instance.R +++ b/R/Instance.R @@ -219,11 +219,15 @@ Instance <- R6::R6Class( # nolint object_name_linter #' Calling `track()` with `transform = NULL` with return a UID, providing #' that UID with the same path with start a run #' - #' @param path Path to the R script or document to track #' @param transform UID specifying the data transformation - track = function(path, transform = NULL) { + #' @param path Path to the R script or document to track + track = function(transform = NULL, path = NULL) { py_lamin <- self$get_py_lamin(check = TRUE, what = "Tracking") + if (is.null(path)) { + cli::cli_abort("The {.arg path} argument must be provided") + } + if (is.null(transform)) { transform <- tryCatch( py_lamin$track(path = path), From 00bd0f1198dbf6f08de2d3c972627d3373a97f9c Mon Sep 17 00:00:00 2001 From: Luke Zappia Date: Wed, 20 Nov 2024 14:36:46 +0100 Subject: [PATCH 2/4] Improve Python error handling in Instance$track() --- R/Instance.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/Instance.R b/R/Instance.R index 1852155..2444258 100644 --- a/R/Instance.R +++ b/R/Instance.R @@ -235,7 +235,7 @@ Instance <- R6::R6Class( # nolint object_name_linter py_err <- reticulate::py_last_error() if (py_err$type != "MissingContextUID") { cli::cli_abort(c( - "Python error {.val {py_err$type}}", + "Python {py_err$message}", "i" = "Run {.run reticulate::py_last_error()} for details" )) } From 6786be307cea714fabf005ee81c1e02d1dc11966 Mon Sep 17 00:00:00 2001 From: Luke Zappia Date: Wed, 20 Nov 2024 14:39:14 +0100 Subject: [PATCH 3/4] Roxygenise --- man/Instance.Rd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/man/Instance.Rd b/man/Instance.Rd index 9617e57..9adff42 100644 --- a/man/Instance.Rd +++ b/man/Instance.Rd @@ -188,15 +188,15 @@ Python lamindb module. \subsection{Method \code{track()}}{ Start a run with tracked data lineage \subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Instance$track(path, transform = NULL)}\if{html}{\out{
}} +\if{html}{\out{
}}\preformatted{Instance$track(transform = NULL, path = NULL)}\if{html}{\out{
}} } \subsection{Arguments}{ \if{html}{\out{
}} \describe{ -\item{\code{path}}{Path to the R script or document to track} - \item{\code{transform}}{UID specifying the data transformation} + +\item{\code{path}}{Path to the R script or document to track} } \if{html}{\out{
}} } From 201ca544ca51b0d3b4aa3265dd91007be1de4e57 Mon Sep 17 00:00:00 2001 From: Luke Zappia Date: Wed, 20 Nov 2024 14:50:37 +0100 Subject: [PATCH 4/4] Update CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2672611..fbe5fbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ The default instance must be changed using the Lamin CLI. (PR #78) - User setting are stored in a global option the first time `connect()` is run (PR #78) +## MINOR CHANGES + +- Adjusted argument order in `Instance$track()` and improved Python error handling (PR #89) + ## TESTING - Add a test for creating artifacts from data frames (PR #78).