Skip to content

handling nested list types #5

@dpastoor

Description

@dpastoor

in rv's new lockfile format, we're capturing dependency constraints if they exist in the dependencies array

So a field can now look like:

[[packages]]
name = "gsm.app"
version = "2.4.0"
source = { git = "https://github.com/gilead-biostats/gsm.app", sha = "2bade6a78617abc9154f3c92117012260a5477b5", tag = "v2.4.0" }
force_source = true
dependencies = [
    "bslib",
    "cli",
    "dplyr",
    "favawesome",
    "glue",
    "gsm.core",
    "gsm.kri",
    { name = "gt", requirement = "(>= 0.11.1.9000)" },
    "htmltools",
    "htmlwidgets",
    "jsonlite",
    "magrittr",
    "purrr",
    "rlang",
    { name = "shiny", requirement = "(>= 1.6.0)" },
    "shinyjs",
    "shinyWidgets",
    "yaml",
]

and when calling tomledit get the following:

> toml_data <- tomledit::read_toml("rv.lock")
> tomledit::get_item(toml_data, "packages")

thread '<unnamed>' panicked at src/to_robj.rs:96:34:
called `Result::unwrap()` on an `Err` value: ExpectedString(list!(name=["gt"], requirement=["(>= 0.11.1.9000)"]))
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

so the parsing needs another layer.

here is a complete snippet from an rv.lock file with version 2 syntax:

# This file is automatically @generated by rv.
# It is not intended for manual editing.
version = 2
r_version = "4.4"

[[packages]]
name = "DBI"
version = "1.2.3"
source = { repository = "https://prism.dev.a2-ai.cloud/rpkgs/stratus/2025-04-26" }
force_source = false
dependencies = []

[[packages]]
name = "DT"
version = "0.33"
source = { repository = "https://prism.dev.a2-ai.cloud/rpkgs/stratus/2025-04-26" }
force_source = false
dependencies = [
    { name = "htmltools", requirement = "(>= 0.3.6)" },
    { name = "htmlwidgets", requirement = "(>= 1.3)" },
    "httpuv",
    { name = "jsonlite", requirement = "(>= 0.9.16)" },
    "magrittr",
    "crosstalk",
    "jquerylib",
    "promises",
]

[[packages]]
name = "Matrix"
version = "1.7-1"
source = { builtin = true }
force_source = false
dependencies = [
    "lattice",
]

if you want to see the src code for any reason to see the data/structures where toml stuff is being called on creation:

https://github.com/A2-ai/rv/blob/main/src/lockfile.rs#L327

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions