kurtosis-tech / kurtosis

A platform for packaging and launching ephemeral backend stacks with a focus on approachability for the average developer.
https://docs.kurtosistech.com/
Apache License 2.0
348 stars 45 forks source link

FR: be able to upload python objects #2430

Open barnabasbusa opened 4 months ago

barnabasbusa commented 4 months ago

Background & motivation

Currently upload files is limited to files. https://docs.kurtosis.com/api-reference/starlark-reference/plan/#upload_files

artifact_name = plan.upload_files(
    # The file to upload into a files artifact
    # Must be any GitHub URL without the '/blob/main' part.
    # MANDATORY
    src = "github.com/foo/bar/static/example.txt",

    # The name to give the files artifact that will be produced.
    # If not specified, it will be auto-generated.
    # OPTIONAL
    name = "my-artifact",

    # A human friendly description for the end user of the package
    # OPTIONAL (Default: Uploading file 'PATH' to files artifact 'ARTIFACT_NAME')
    description = "uploading file"
)

It would be great if you had a python object, like a python array, dict, it could be directly referenced and uploaded as a files artifact as well.

Desired behaviour

test = [A,B,C]

artifact_name = plan.upload_files(
    src = test
    name = "my-test-artifact",
    description = "uploading file"
)

How important is this to you?

Painful; the lack of this feature makes using Kurtosis frictionful.

What area of the product does this pertain to?

CLI: the Command Line Interface

h4ck3rk3y commented 4 months ago

Some more context - Barnabas wants to create files artifacts from Starlark objects; something like

plan.create_artifact(
    contents = str or list of string,
    target = "filename.txt",
    name = "barnabas-artifact",
    delimiter = "\n", optional value that applies to strings
)

if its a string it can be written out to target which will be at root of barnabas-artifact; if its a list of strings it can be concatenated with "\n" by default or allow the person to give the delimiter

0xTylerHolmes commented 3 months ago

Any update on this? I think it would be extremely valuable to be able to do this for the package configuration file that you are using. The service context is very limited in terms of getting complete service information. I'm running into some roadblocks that could be alleviated if I had access to the StarlarkRunConfig file used to start the remote packages.