ytt
ytt copied to clipboard
Disambiguate between libraries and .lib.* files
The docs say...
module
: single file; can export variables, functions, or be templated => some type of result e.g. yaml structure, or string, or None)package
: single directory; contains moduleslibrary
: collection of packages
But the file extension that indicates that a file is a loadable module is .lib.(y[a]ml|star)
.
Using the same term for different concepts can lead to confusion. We could avoid that confusion if we disambiguate them.
While the files we generally refer to as "templates" are technically implemented as Starlark modules, they are not loadable by the user.
How about this?
template
: single file; results in a corresponding output filemodule
: single file; can export variables or functions; loaded by templates or other`modulesordinary file
: single file; read by templates or modulespackage
: single directory; contains modules, templates, and ordinary fileslibrary
: collection of packages
A related error message could read:
- cannot load deployment.yml: Expected file 'deployment.yml' to be a loadable
module, but was not (hint: module filename must end with '.mod.yml' or '.star'; use
data.read(...) for loading ordinary file contents)
in <toplevel>
service.yml:2 | #@ load("deployment.yml", "deploy")
We have also been defining a module as either a Starlark module or a YAML module. We have a section on Terminology that these definitions may belong in.
I believe the scope of this issue is to disambiguate .lib.yml
(modules) with libraries
(ie _ytt_lib
) in both the documentation and/or in error messages or user facing messages.
This kind of thing will get caught up in any proposed revamp of the documentation. No need to have an individual open item tracking it.