Add the possibility to create import file names dynamically
Is your feature request related to a problem? Please describe.
I'm trying to build a Nickel file which contains info about a bunch of Python projects in a monorepo and it would be nice to be able to read the prproject.toml files into a Nickel record. The issue is that I already have a field which contains the path to the project, and this would cause repetition:
{
project_path = "path/to/project"
toml_content = import "path/to/project/pyproject.toml"
}
Describe the solution you'd like
It would be nice if the string passed to the import keyword could be constructed at runtime, enabling something like this:
{
project_path = "path/to/project"
toml_content = import "%{project_path}/pyproject.toml"
}
Describe alternatives you've considered
- Repeat the path in two strings, which is a bit annoying and error prone.
- Extract the
pyproject.tomlinto whatever script the Nickel file is fed into. Kind of defeats the purpose of using Nickel in the first place.
Note: related or even duplicate of https://github.com/tweag/nickel/issues/1865
Sorry, you're right. I'll let you decide if it makes sense to keep this issue open just to show my use case, or if it's just an hassle and it's better to close it.
No worries, I just wanted to link to the other issue before I forget. I think we can keep this one open as well; I find the feature request to be formulated more clearly, so other people might find it before the oldest.