-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question on using .instances()
#1880
Comments
+1 on instances reporting the double amount of instances actually created. |
For question 2, according to the design of kcl, all files in kcl file1.k file2.k file3.k ... fileN.k render.k are regarded as the For question 3, can you provide more details? like example code |
Gotcha, I'll try to get an example out tomorrow. In the meantime, is there a better way to get all instances in a set of directories without globbing everything together, and without explicitly importing each file? I'd like a way where someone can add in a new |
put the .k files into a directory and import it in main.k? |
looked into this a bit more. Let's say I have 100+ files. It's not very desirable to put this into a single directory, as then I need to coordinate a bunch of name conflicts, and I've noticed rendering slows down a lot. Another option is to autogenerate an imports file, like import configs.specs
import configs.package1
import configs.package2
import configs.package3
import configs.package4
...
containers = specs.Containers.instances() However instances only searches the local package. It seems there's no mechanism to auto retrieve/glob instances of an object type without putting them all into one directory, which becomes somewhat of an anti pattern at a larger scale. Any recommendations on how to proceed here? |
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:
myField
variable, will now result in a conflictspecs.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 :)The text was updated successfully, but these errors were encountered: