Skip to content

Add Toolkit template variable substitution for toolkit YAML reads - #1615

Open
poocog wants to merge 7 commits into
mainfrom
feat/toolkit-yaml-variable-substitution
Open

Add Toolkit template variable substitution for toolkit YAML reads#1615
poocog wants to merge 7 commits into
mainfrom
feat/toolkit-yaml-variable-substitution

Conversation

@poocog

@poocog poocog commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Description

Resolve Toolkit {{ variable }} placeholders when reading module YAML with format="toolkit", using Toolkit config (default.config.yaml, env overlays, cdf.toml, and module overrides). Options are collated in ToolkitReadOptions and config is loaded once per directory; strategy is documented in _toolkit_variables.py.

Bump

  • Patch
  • Skip

Changelog

Added

  • Add Toolkit template variable substitution for format="toolkit" YAML reads via toolkit_env, toolkit_config, and toolkit_version.

poocog and others added 3 commits August 13, 2026 12:25
Resolve {{ variable }} placeholders from Toolkit config during format=toolkit imports, with a compact once-per-directory config load.

Co-authored-by: Cursor <cursoragent@cursor.com>
Thread a single options object through importers and session internals, share Args docs, and dedupe YAML load/quote paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
@poocog
poocog requested a review from a team as a code owner August 13, 2026 11:27
@gemini-code-assist

Copy link
Copy Markdown
Contributor
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
7843 7250 92% 90% 🟢

New Files

File Coverage Status
cognite/neat/_data_model/importers/_toolkit_variables.py 92% 🟢
TOTAL 92% 🟢

Modified Files

File Coverage Status
cognite/neat/_data_model/importers/_api_importer.py 94% 🟢
cognite/neat/_session/_physical.py 76% 🟢
TOTAL 85% 🟢

updated for commit: 44d522d by action🐍

@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.38411% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.92%. Comparing base (9a95a2e) to head (44d522d).
⚠️ Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
...e/neat/_data_model/importers/_toolkit_variables.py 92.15% 20 Missing ⚠️
cognite/neat/_session/_physical.py 86.66% 2 Missing ⚠️
...ognite/neat/_data_model/importers/_api_importer.py 96.87% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1615      +/-   ##
==========================================
+ Coverage   91.85%   91.92%   +0.06%     
==========================================
  Files         126      131       +5     
  Lines        7468     7983     +515     
==========================================
+ Hits         6860     7338     +478     
- Misses        608      645      +37     
Files with missing lines Coverage Δ
...ognite/neat/_data_model/importers/_api_importer.py 93.84% <96.87%> (+0.90%) ⬆️
cognite/neat/_session/_physical.py 76.35% <86.66%> (+3.25%) ⬆️
...e/neat/_data_model/importers/_toolkit_variables.py 92.15% <92.15%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…reads.

Treat module-local default.config.yaml as a variable source, not the project root, and ignore build_info/config files during directory import.

Co-authored-by: Cursor <cursoragent@cursor.com>

@doctrino doctrino left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my longer comment on the ToolkitReadOptions.

I think this is a question of should we do this? And if so, how should we do this? Not the implementation itself. I am happy to take a discussion on it when I am back, or take it without me before then.

reuse the flattened map for every YAML file under that directory.
"""

from __future__ import annotations

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for Python 3.9 and earlier which we have never supported for neat.

data_model_file: Path | None = None,
data_model_file: Path | str | None = None,
fix: bool = False,
options: ToolkitReadOptions | None = None,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we want to make the public API, which this is part of only basic types (string, integers, boolean). Here you are introducing a new class that the user must import in their notebook. This class is not publicly exposed to the user, so they cannot import it.

Looking at ToolkitReadOptions, I see that it might be necessary, but I am not really sure. I think this needs some pondering.

Current implementation looks like this

from cognite.neat._data_model.importers._toolkit_variables import ToolkitReadOptions
neat.physical_data_model.read.yaml(io="path-to-toolkit-directory", format="toolkit", options=ToolkitReadOptions(...))

This is starting to feel clunky and unintuitive.

An alternative is to split this into two methods, one for reading neat_yaml and one for toolkit_yaml

neat.physical_data_model.read.yaml_toolkit(io="path-to-toolkit-directory", format="toolkit", env="dev")

and

neat.physical_data_model.read.yaml_neat(io="path-to-neat-yaml", format="toolkit", fix=True)

Then the toolkit version is for running a CI, while the neat version is for developing. However, that raises more questions like should we support neat format in CI through an interface that is intended to be used in a notebook?

poocog and others added 2 commits August 28, 2026 16:14
Yamale validation schemas such as data_model_container.yaml are no longer treated as DMS container resources during directory reads.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ree.

Load variables from each YAML file's module path so nested variables.modules keys apply correctly. Skip parsing sibling DataModels and views when data_model_file selects one model.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants