mirror of
https://github.com/apple/pkl.git
synced 2026-01-13 15:13:38 +01:00
Cannot import dynamically #104
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @philippemerle on GitHub (Mar 4, 2024).
I would like to write something like
But evaluating this produces the following error
Is a way to dynamically import a pkl file?
@stackoverflow commented on GitHub (Mar 4, 2024):
Pkl doesn't support dynamic imports, so you can't do that.
The error message can definitely be improved, though. It's not very clear what the error is.
@philippemerle commented on GitHub (Mar 4, 2024):
Thank you for the explanation. This was I thought well.
@bioball commented on GitHub (Mar 4, 2024):
You can emulate "dynamic imports" using globbed imports.
For example, you can do:
Note: globbed imports resolve to a mapping where the keys are the expanded form of the glob. So, the provided
filenamemust match something that the glob pattern would expand to.@philippemerle commented on GitHub (Mar 4, 2024):
Thank for the proposal. I found another way with a shell script:
@bioball commented on GitHub (Mar 4, 2024):
Closing this, as we do not have any plans to implement this.