Skip to content

Question on using .instances() #1880

@steeling

Description

@steeling

We have a setup where we have many specs.Containers objects spread across many files.

I'd like to add a script, where I can run kcl render.k, which consumes all the containers, and outputs a single object (either to stdout, or to a file). My issue is that to get this to work, I'm using globbing all kcl files such that the script calls:

kcl file1.k file2.k file3.k ... fileN.k render.k

This seems to have some issues:

  1. It's very slow, and I have suspicion it's evaluating some things twice.
  2. File scoped variables become global scoped, ie: 2 separate files in 2 separate directories with a top level myField variable, will now result in a conflict
  3. specs.Containers.instances() works within render.k, but if I have another file that is not part of the glob, but maybe indirectly imported that also attempts to find all containers, it doesn't. Which leads me to believe there are some further scoping oddities.

I might be abusing the intent of running kcl, is there a better way to do what I want to accomplish? Let me know if I can provide more info on this :)

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