ytt icon indicating copy to clipboard operation
ytt copied to clipboard

Disambiguate between libraries and .lib.* files

Open jtigger opened this issue 4 years ago • 3 comments

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 modules
  • library: 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.

jtigger avatar May 08 '20 02:05 jtigger

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 file
  • module: single file; can export variables or functions; loaded by templates or other`modules
  • ordinary file: single file; read by templates or modules
  • package: single directory; contains modules, templates, and ordinary files
  • library: 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")

jtigger avatar May 17 '20 14:05 jtigger

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.

cari-lynn avatar Apr 08 '22 17:04 cari-lynn

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.

cari-lynn avatar Apr 08 '22 17:04 cari-lynn

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.

pivotaljohn avatar Sep 27 '22 23:09 pivotaljohn