nyl 0.8.0__tar.gz → 0.9.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. nyl-0.9.0/.changelog/0.8.1.toml +7 -0
  2. nyl-0.9.0/.changelog/0.9.0.toml +7 -0
  3. {nyl-0.8.0 → nyl-0.9.0}/.github/workflows/docs.yaml +2 -2
  4. {nyl-0.8.0 → nyl-0.9.0}/.github/workflows/python.yaml +3 -3
  5. {nyl-0.8.0 → nyl-0.9.0}/PKG-INFO +1 -1
  6. {nyl-0.8.0 → nyl-0.9.0}/argocd-cmp/Dockerfile +5 -5
  7. nyl-0.9.0/docs/content/reference/templating/basics.md +21 -0
  8. nyl-0.9.0/docs/content/reference/templating/locals.md +26 -0
  9. {nyl-0.8.0 → nyl-0.9.0}/pyproject.toml +1 -1
  10. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/commands/template.py +28 -9
  11. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/templating.py +4 -2
  12. {nyl-0.8.0 → nyl-0.9.0}/uv.lock +3 -2
  13. nyl-0.8.0/docs/content/reference/templating/basics.md +0 -5
  14. {nyl-0.8.0 → nyl-0.9.0}/.changelog/0.7.0.toml +0 -0
  15. {nyl-0.8.0 → nyl-0.9.0}/.changelog/0.7.1.toml +0 -0
  16. {nyl-0.8.0 → nyl-0.9.0}/.changelog/0.7.2.toml +0 -0
  17. {nyl-0.8.0 → nyl-0.9.0}/.changelog/0.8.0.toml +0 -0
  18. {nyl-0.8.0 → nyl-0.9.0}/.envrc +0 -0
  19. {nyl-0.8.0 → nyl-0.9.0}/.github/workflows/docker.yaml +0 -0
  20. {nyl-0.8.0 → nyl-0.9.0}/.github/workflows/update-flake-lock.yaml +0 -0
  21. {nyl-0.8.0 → nyl-0.9.0}/.gitignore +0 -0
  22. {nyl-0.8.0 → nyl-0.9.0}/README.md +0 -0
  23. {nyl-0.8.0 → nyl-0.9.0}/argocd-cmp/README.md +0 -0
  24. {nyl-0.8.0 → nyl-0.9.0}/argocd-cmp/plugin.yaml +0 -0
  25. {nyl-0.8.0 → nyl-0.9.0}/argocd-with-nyl/.envrc +0 -0
  26. {nyl-0.8.0 → nyl-0.9.0}/argocd-with-nyl/.secrets.yaml +0 -0
  27. {nyl-0.8.0 → nyl-0.9.0}/argocd-with-nyl/.sops.yaml +0 -0
  28. {nyl-0.8.0 → nyl-0.9.0}/argocd-with-nyl/README.md +0 -0
  29. {nyl-0.8.0 → nyl-0.9.0}/argocd-with-nyl/argocd.yaml +0 -0
  30. {nyl-0.8.0 → nyl-0.9.0}/argocd-with-nyl/nyl-project.yaml +0 -0
  31. {nyl-0.8.0 → nyl-0.9.0}/argocd-with-nyl/nyl-secrets.yaml +0 -0
  32. {nyl-0.8.0 → nyl-0.9.0}/docs/content/changelog.md +0 -0
  33. {nyl-0.8.0 → nyl-0.9.0}/docs/content/index.md +0 -0
  34. {nyl-0.8.0 → nyl-0.9.0}/docs/content/reference/applysets.md +0 -0
  35. {nyl-0.8.0 → nyl-0.9.0}/docs/content/reference/argocd-plugin.md +0 -0
  36. {nyl-0.8.0 → nyl-0.9.0}/docs/content/reference/cluster-connectivity.md +0 -0
  37. {nyl-0.8.0 → nyl-0.9.0}/docs/content/reference/configuration/environment.md +0 -0
  38. {nyl-0.8.0 → nyl-0.9.0}/docs/content/reference/configuration/profiles.md +0 -0
  39. {nyl-0.8.0 → nyl-0.9.0}/docs/content/reference/configuration/projects.md +0 -0
  40. {nyl-0.8.0 → nyl-0.9.0}/docs/content/reference/configuration/secrets.md +0 -0
  41. {nyl-0.8.0 → nyl-0.9.0}/docs/content/reference/configuration-api/profiles.md +0 -0
  42. {nyl-0.8.0 → nyl-0.9.0}/docs/content/reference/configuration-api/secrets.md +0 -0
  43. {nyl-0.8.0 → nyl-0.9.0}/docs/content/reference/glossary.md +0 -0
  44. {nyl-0.8.0 → nyl-0.9.0}/docs/content/reference/templating/components.md +0 -0
  45. {nyl-0.8.0 → nyl-0.9.0}/docs/content/reference/templating/inlining/helmcharts.md +0 -0
  46. {nyl-0.8.0 → nyl-0.9.0}/docs/content/reference/templating/inlining/overview.md +0 -0
  47. {nyl-0.8.0 → nyl-0.9.0}/docs/content/reference/templating/inlining/postprocessor.md +0 -0
  48. {nyl-0.8.0 → nyl-0.9.0}/docs/content/reference/templating/secrets.md +0 -0
  49. {nyl-0.8.0 → nyl-0.9.0}/docs/mkdocs.yml +0 -0
  50. {nyl-0.8.0 → nyl-0.9.0}/docs/pyproject.toml +0 -0
  51. {nyl-0.8.0 → nyl-0.9.0}/docs/uv.lock +0 -0
  52. {nyl-0.8.0 → nyl-0.9.0}/example/manifests/postgres.yaml +0 -0
  53. {nyl-0.8.0 → nyl-0.9.0}/example/nyl-profiles.yaml +0 -0
  54. {nyl-0.8.0 → nyl-0.9.0}/example/nyl-secrets.yaml +0 -0
  55. {nyl-0.8.0 → nyl-0.9.0}/example/secrets.yaml +0 -0
  56. {nyl-0.8.0 → nyl-0.9.0}/flake.lock +0 -0
  57. {nyl-0.8.0 → nyl-0.9.0}/flake.nix +0 -0
  58. {nyl-0.8.0 → nyl-0.9.0}/nix/uv.nix +0 -0
  59. {nyl-0.8.0 → nyl-0.9.0}/renovate.json +0 -0
  60. {nyl-0.8.0 → nyl-0.9.0}/src/kubernetes/README.md +0 -0
  61. {nyl-0.8.0 → nyl-0.9.0}/src/kubernetes/__init__.pyi +0 -0
  62. {nyl-0.8.0 → nyl-0.9.0}/src/kubernetes/dynamic/__init__.pyi +0 -0
  63. {nyl-0.8.0 → nyl-0.9.0}/src/kubernetes/dynamic/client.pyi +0 -0
  64. {nyl-0.8.0 → nyl-0.9.0}/src/kubernetes/dynamic/discovery.pyi +0 -0
  65. {nyl-0.8.0 → nyl-0.9.0}/src/kubernetes/dynamic/exceptions.pyi +0 -0
  66. {nyl-0.8.0 → nyl-0.9.0}/src/kubernetes/dynamic/resource.pyi +0 -0
  67. {nyl-0.8.0 → nyl-0.9.0}/src/kubernetes/watch/__init__.pyi +0 -0
  68. {nyl-0.8.0 → nyl-0.9.0}/src/kubernetes/watch/watch.pyi +0 -0
  69. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/__init__.py +0 -0
  70. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/commands/__init__.py +0 -0
  71. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/commands/add.py +0 -0
  72. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/commands/argocd.py +0 -0
  73. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/commands/crds.py +0 -0
  74. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/commands/new.py +0 -0
  75. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/commands/profile.py +0 -0
  76. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/commands/run.py +0 -0
  77. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/commands/secrets.py +0 -0
  78. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/commands/tools/__init__.py +0 -0
  79. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/commands/tools/bcrypt.py +0 -0
  80. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/commands/tools/sops.py +0 -0
  81. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/commands/tun.py +0 -0
  82. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/generator/__init__.py +0 -0
  83. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/generator/components.py +0 -0
  84. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/generator/dispatch.py +0 -0
  85. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/generator/dispatch_test.py +0 -0
  86. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/generator/helmchart.py +0 -0
  87. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/generator/statefulsecret.py +0 -0
  88. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/profiles/__init__.py +0 -0
  89. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/profiles/config.py +0 -0
  90. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/profiles/config_test.py +0 -0
  91. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/profiles/kubeconfig.py +0 -0
  92. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/profiles/tunnel.py +0 -0
  93. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/project/config.py +0 -0
  94. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/resources/__init__.py +0 -0
  95. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/resources/applyset.py +0 -0
  96. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/resources/applyset_test.py +0 -0
  97. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/resources/helmchart.py +0 -0
  98. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/resources/helmchart_test.py +0 -0
  99. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/resources/placeholder.py +0 -0
  100. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/resources/postprocessor.py +0 -0
  101. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/resources/postprocessor_test.py +0 -0
  102. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/resources/statefulsecret.py +0 -0
  103. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/secrets/__init__.py +0 -0
  104. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/secrets/config.py +0 -0
  105. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/secrets/config_test.py +0 -0
  106. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/secrets/kubernetes.py +0 -0
  107. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/secrets/null.py +0 -0
  108. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/secrets/sops.py +0 -0
  109. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/secrets/sops_test.py +0 -0
  110. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/templating_test.py +0 -0
  111. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/tools/di.py +0 -0
  112. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/tools/fs.py +0 -0
  113. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/tools/fs_test.py +0 -0
  114. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/tools/kubectl.py +0 -0
  115. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/tools/kubernetes.py +0 -0
  116. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/tools/kvstore.py +0 -0
  117. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/tools/loads.py +0 -0
  118. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/tools/logging.py +0 -0
  119. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/tools/shell.py +0 -0
  120. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/tools/testing.py +0 -0
  121. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/tools/typer.py +0 -0
  122. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/tools/types.py +0 -0
  123. {nyl-0.8.0 → nyl-0.9.0}/src/nyl/tools/yaml.py +0 -0
  124. {nyl-0.8.0 → nyl-0.9.0}/tests/__init__.py +0 -0
  125. {nyl-0.8.0 → nyl-0.9.0}/tests/conftest.py +0 -0
@@ -0,0 +1,7 @@
1
+ release-date = "2025-01-22"
2
+
3
+ [[entries]]
4
+ id = "d8a87ff7-b417-4c8d-90fc-59a2189ca7ad"
5
+ type = "fix"
6
+ description = "Remove sneaky `breakpoint()` call in `nyl template`"
7
+ author = "@NiklasRosenstein"
@@ -0,0 +1,7 @@
1
+ release-date = "2025-04-15"
2
+
3
+ [[entries]]
4
+ id = "a2772016-3dff-4da6-926d-1f47e509c63a"
5
+ type = "feature"
6
+ description = "Add ability to define and use local variables in manifests"
7
+ author = "@NiklasRosenstein"
@@ -17,10 +17,10 @@ jobs:
17
17
  - uses: actions/checkout@v4
18
18
  - name: Check Nix flake Nixpkgs inputs
19
19
  uses: DeterminateSystems/flake-checker-action@main
20
- - uses: cachix/install-nix-action@v30
20
+ - uses: cachix/install-nix-action@v31
21
21
  with:
22
22
  nix_path: nixpkgs=channel:nixos-unstable
23
- - uses: cachix/cachix-action@v15
23
+ - uses: cachix/cachix-action@v16
24
24
  with:
25
25
  name: mycache
26
26
  # If you chose signing key for write access
@@ -15,10 +15,10 @@ jobs:
15
15
  - uses: actions/checkout@v4
16
16
  - name: Check Nix flake Nixpkgs inputs
17
17
  uses: DeterminateSystems/flake-checker-action@main
18
- - uses: cachix/install-nix-action@v30
18
+ - uses: cachix/install-nix-action@v31
19
19
  with:
20
20
  nix_path: nixpkgs=channel:nixos-unstable
21
- - uses: cachix/cachix-action@v15
21
+ - uses: cachix/cachix-action@v16
22
22
  with:
23
23
  name: mycache
24
24
 
@@ -70,7 +70,7 @@ jobs:
70
70
  - name: Set up Python 3.10
71
71
  uses: actions/setup-python@v5
72
72
  with:
73
- python-version: "3.10"
73
+ python-version: "3.13"
74
74
 
75
75
  - name: Bump version
76
76
  run: sed 's/version = ".*"/version = "${{ github.ref_name }}"/' -i pyproject.toml && git diff
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nyl
3
- Version: 0.8.0
3
+ Version: 0.9.0
4
4
  Summary: Advanced templating engine for Kubernetes and GitOps.
5
5
  Author-email: Niklas Rosenstein <rosensteinniklas@gmail.com>
6
6
  License: MIT
@@ -3,7 +3,7 @@
3
3
  #: -----------------
4
4
 
5
5
  FROM python:3.13-alpine AS build
6
- COPY --from=ghcr.io/astral-sh/uv:0.5.7 /uv /bin/uv
6
+ COPY --from=ghcr.io/astral-sh/uv:0.6.14 /uv /bin/uv
7
7
 
8
8
  WORKDIR /opt/nyl
9
9
 
@@ -40,7 +40,7 @@ RUN \
40
40
  FROM fetch-bin-base AS argocd-bin
41
41
  # Find ArgoCD releases at https://github.com/argoproj/argo-cd/releases
42
42
  # renovate: datasource=github-releases depName=argocd packageName=argoproj/argo-cd
43
- ARG ARGOCD_VERSION=v2.13.1
43
+ ARG ARGOCD_VERSION=v2.14.10
44
44
  RUN curl -sSfLo /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/download/${ARGOCD_VERSION}/argocd-linux-$(cat /BINARY_ARCH) \
45
45
  && chmod +x /usr/local/bin/argocd \
46
46
  && upx /usr/local/bin/argocd \
@@ -49,7 +49,7 @@ RUN curl -sSfLo /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releas
49
49
  FROM fetch-bin-base AS helm-bin
50
50
  # Find Helm releases at https://github.com/helm/helm/releases
51
51
  # renovate: datasource=github-releases depName=helm packageName=helm/helm
52
- ARG HELM_VERSION=v3.16.3
52
+ ARG HELM_VERSION=v3.17.3
53
53
  RUN curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 \
54
54
  && chmod 700 get_helm.sh \
55
55
  && ./get_helm.sh --version $HELM_VERSION \
@@ -59,7 +59,7 @@ RUN curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/s
59
59
  FROM fetch-bin-base AS sops-bin
60
60
  # Find SOPS releases at https://github.com/getsops/sops/releases
61
61
  # renovate: datasource=github-releases depName=sops packageName=getsops/sops
62
- ARG SOPS_VERSION=v3.9.2
62
+ ARG SOPS_VERSION=v3.10.2
63
63
  RUN curl -fLO https://github.com/getsops/sops/releases/download/${SOPS_VERSION}/sops-${SOPS_VERSION}.linux.$(cat /BINARY_ARCH) \
64
64
  && mv sops-${SOPS_VERSION}.linux.$(cat /BINARY_ARCH) /usr/local/bin/sops \
65
65
  && chmod +x /usr/local/bin/sops \
@@ -68,7 +68,7 @@ RUN curl -fLO https://github.com/getsops/sops/releases/download/${SOPS_VERSION}/
68
68
 
69
69
  FROM fetch-bin-base AS kyverno-bin
70
70
  # renovate: datasource=github-releases depName=kyverno packageName=kyverno/kyverno
71
- ARG KYVERNO_VERSION=1.13.2
71
+ ARG KYVERNO_VERSION=1.13.4
72
72
  RUN \
73
73
  case "$(uname -m)" in \
74
74
  x86_64) KYVERNO_ARCH='x86_64' ;; \
@@ -0,0 +1,21 @@
1
+ # Basics
2
+
3
+ Nyl uses [structured-templates](https://pypi.org/project/structured-templates/) to process Kubernetes manifests
4
+ before they are applied. This allows you to write expressions in YAML values in the form of `${{ ... }}`, as well as
5
+ some form of control flow using special keys like `if(...):` and `for(...)`.
6
+
7
+ However, this is distinctly different from Helm templates which permit free-form generation of text, which later must
8
+ be valid YAML.
9
+
10
+ ## Basic Expressions
11
+
12
+ Basic expressions allow you to evaluate simple expressions in the form of `${{ ... }}`. This can be used to compute
13
+ or retrieve a value, rather than statically typing it in the manifest. The expression result may be of any valid
14
+ YAML type, not just strings.
15
+
16
+ Currently, only the following names are available in the scope of the expression:
17
+
18
+ - `secrets`: A reference to the secrets provider. This is used to retrieve secrets from the configured secrets
19
+ provider. See [Secrets](./secrets.md) for more information.
20
+ - `locals`: A container for local variables defined in the same manifest. See [Local Variables](./locals.md) for more
21
+ information.
@@ -0,0 +1,26 @@
1
+ # Local Variables
2
+
3
+ You may define a YAML object in your Kubernetes manifest that is used to define variables that can later be accessed
4
+ in the same manifest to achieve some level of DRY-ness. This is done by not setting any `apiVersion` or `kind`, and
5
+ instead just define variables prefixed with `$`. Variables can later be accessed using the `${{ locals.var }}`.
6
+
7
+ Note that expressions in values assigned to variables are not currently supported. This means that you cannot use e.g.
8
+ `${{ secrets.get("my-secret") }}` in the value of a variable, nor can you use `${{ locals.var }}`.
9
+
10
+ ## Example
11
+
12
+ ```yaml
13
+ # my-app.yaml
14
+ $name: my-app
15
+
16
+ ---
17
+ apiVersion: apps/v1
18
+ kind: Deployment
19
+ metadata:
20
+ name: ${{ locals.name }}
21
+ # ...
22
+ ```
23
+
24
+ > Technically, such an object defining local variables can be defined anywhere in the manifest and more than once.
25
+ > By convention and to improve readability, it is recommended to define it at the top of the manifest. The object is not
26
+ > rendered in the final manifest.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "nyl"
7
- version = "0.8.0"
7
+ version = "0.9.0"
8
8
  description = "Advanced templating engine for Kubernetes and GitOps."
9
9
  authors = [
10
10
  {name = "Niklas Rosenstein", email = "rosensteinniklas@gmail.com"},
@@ -189,14 +189,6 @@ def template(
189
189
 
190
190
  secrets = PROVIDER.get(SecretsConfig)
191
191
 
192
- template_engine = NylTemplateEngine(
193
- secrets.providers[secrets_provider],
194
- client,
195
- on_lookup_failure=on_lookup_failure.to_literal()
196
- if on_lookup_failure
197
- else project.config.settings.on_lookup_failure,
198
- )
199
-
200
192
  generator = DispatchingGenerator.default(
201
193
  cache_dir=cache_dir,
202
194
  search_path=project.config.settings.search_path,
@@ -210,6 +202,34 @@ def template(
210
202
  for source in load_manifests(paths):
211
203
  logger.opt(colors=True).info("Rendering manifests from <blue>{}</>.", source.file)
212
204
 
205
+ template_engine = NylTemplateEngine(
206
+ secrets.providers[secrets_provider],
207
+ client,
208
+ on_lookup_failure=on_lookup_failure.to_literal()
209
+ if on_lookup_failure
210
+ else project.config.settings.on_lookup_failure,
211
+ )
212
+
213
+ # Look for objects that contain local variables and feed them into the template engine.
214
+ for manifest in source.manifests[:]:
215
+ if "apiVersion" in manifest or "kind" in manifest:
216
+ continue
217
+ if not any(k.startswith("$") for k in manifest.keys()):
218
+ # Neither a Kubernetes object, nor one defining local variables. Hmm..
219
+ continue
220
+ if any(not k.startswith("$") for k in manifest.keys()):
221
+ # Can't have keys that don't start with `$` in a local variable object.
222
+ logger.opt(colors=True).error(
223
+ "A manifest in <yellow>'{}'</> has keys that don't start with `$`:\n\n{}",
224
+ source.file,
225
+ yaml.dumps(manifest),
226
+ )
227
+ exit(1)
228
+ for key, value in manifest.items():
229
+ assert key.startswith("$"), key
230
+ setattr(template_engine.locals, key[1:], value)
231
+ source.manifests.remove(manifest)
232
+
213
233
  # Begin populating the default namespace to resources.
214
234
  current_default_namespace = get_default_namespace_for_manifest(source, default_namespace)
215
235
  populate_namespace_to_resources(source.manifests, current_default_namespace)
@@ -218,7 +238,6 @@ def template(
218
238
  if inline:
219
239
 
220
240
  def new_generation(manifest: Manifest) -> Manifests:
221
- breakpoint()
222
241
  manifests = template_engine.evaluate(Manifests([manifest]))
223
242
  populate_namespace_to_resources(manifests, current_default_namespace)
224
243
  return manifests
@@ -2,9 +2,10 @@
2
2
  Implements Nyl's variant of structured templating.
3
3
  """
4
4
 
5
+ from argparse import Namespace
5
6
  from collections.abc import Mapping
6
7
  from contextlib import contextmanager
7
- from dataclasses import dataclass
8
+ from dataclasses import dataclass, field
8
9
  from typing import Any, Callable, ClassVar, Iterator, Literal, Sequence, TypeVar, cast
9
10
 
10
11
  from loguru import logger
@@ -172,6 +173,7 @@ class NylTemplateEngine:
172
173
 
173
174
  secrets: SecretProvider
174
175
  client: ApiClient
176
+ locals: Namespace = field(default_factory=Namespace)
175
177
  on_lookup_failure: Literal["Error", "CreatePlaceholder", "SkipResource"] = "Error"
176
178
 
177
179
  def __post_init__(self) -> None:
@@ -194,7 +196,7 @@ class NylTemplateEngine:
194
196
  NylTemplateEngine.current = prev
195
197
 
196
198
  def _new_engine(self) -> _TemplateEngine:
197
- return _TemplateEngine({"secrets": self.secrets, **registered_functions})
199
+ return _TemplateEngine({"secrets": self.secrets, "locals": self.locals, **registered_functions})
198
200
 
199
201
  def evaluate(self, value: Manifests, recursive: bool = True) -> Manifests:
200
202
  result = []
@@ -1,4 +1,5 @@
1
1
  version = 1
2
+ revision = 1
2
3
  requires-python = ">=3.11"
3
4
 
4
5
  [[package]]
@@ -108,7 +109,7 @@ name = "click"
108
109
  version = "8.1.7"
109
110
  source = { registry = "https://pypi.org/simple" }
110
111
  dependencies = [
111
- { name = "colorama", marker = "platform_system == 'Windows'" },
112
+ { name = "colorama", marker = "sys_platform == 'win32'" },
112
113
  ]
113
114
  sdist = { url = "https://files.pythonhosted.org/packages/96/d3/f04c7bfcf5c1862a2a5b845c6b2b360488cf47af55dfa79c98f6a6bf98b5/click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de", size = 336121 }
114
115
  wheels = [
@@ -384,7 +385,7 @@ wheels = [
384
385
 
385
386
  [[package]]
386
387
  name = "nyl"
387
- version = "0.7.2"
388
+ version = "0.8.1"
388
389
  source = { editable = "." }
389
390
  dependencies = [
390
391
  { name = "bcrypt" },
@@ -1,5 +0,0 @@
1
- # Basics
2
-
3
- Todo
4
-
5
- See [structured-templates](https://pypi.org/project/structured-templates/).
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes