-
Notifications
You must be signed in to change notification settings - Fork 0
Add example manifests #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| netsuke_version: "1.0" | ||
|
|
||
| vars: | ||
| outdir: build/book | ||
|
|
||
| rules: | ||
| - name: build | ||
| command: "mkdir -p $(dirname {outs}) && pandoc {ins} -o {outs}" | ||
| description: Compile document | ||
|
|
||
| targets: | ||
| - name: "{{ outdir }}/manuscript.pdf" | ||
| rule: build | ||
| sources: "{{ glob('chapters/*.md') }}" | ||
|
leynos marked this conversation as resolved.
|
||
|
|
||
| defaults: | ||
| - "{{ outdir }}/manuscript.pdf" | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,32 @@ | ||||||||||||||||||||||||||||||
| netsuke_version: "1.0" | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| vars: | ||||||||||||||||||||||||||||||
| cc: gcc | ||||||||||||||||||||||||||||||
| cflags: -Wall | ||||||||||||||||||||||||||||||
| objdir: build/obj | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| rules: | ||||||||||||||||||||||||||||||
| - name: compile | ||||||||||||||||||||||||||||||
| command: "mkdir -p $(dirname {outs}) && {{ cc }} {{ cflags }} -c {ins} -o {outs}" | ||||||||||||||||||||||||||||||
| description: Compile C source | ||||||||||||||||||||||||||||||
| - name: link | ||||||||||||||||||||||||||||||
| command: "{{ cc }} {{ cflags }} {ins} -o {outs}" | ||||||||||||||||||||||||||||||
| description: Link objects | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Target list generated from source files | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| targets: | | ||||||||||||||||||||||||||||||
| {% for src in glob('src/*.c') %} | ||||||||||||||||||||||||||||||
| - name: "{{ objdir }}/{{ src | basename | replace('.c', '.o') }}" | ||||||||||||||||||||||||||||||
| rule: compile | ||||||||||||||||||||||||||||||
| sources: "{{ src }}" | ||||||||||||||||||||||||||||||
| {% endfor %} | ||||||||||||||||||||||||||||||
| - name: app | ||||||||||||||||||||||||||||||
|
Comment on lines
+18
to
+24
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainVerify that Netsuke re-parses the templated target list Run: Ensure the runtime Jinja pass writes a second-stage YAML that Netsuke loads. 🏁 Script executed: #!/bin/bash
# Expect: 'targets' key in the rendered YAML is an array, not a string.
grep -nA2 -B2 '^targets:' examples/c_app.ymlLength of output: 218 Run a Jinja render simulation to verify the 🏁 Script executed: #!/bin/bash
set -e
pip install jinja2 pyyaml
python3 - << 'EOF'
import jinja2, yaml, glob
env = jinja2.Environment()
template = open('examples/c_app.yml').read()
rendered = env.from_string(template).render(objdir='build', glob=glob)
loaded = yaml.safe_load(rendered)
print(type(loaded['targets']).__name__)
EOFLength of output: 1103 Register missing Jinja filters and re-run the YAML load simulation: 🏁 Script executed: #!/bin/bash
set -e
pip install jinja2 pyyaml
python3 - << 'EOF'
import jinja2, yaml, glob, os
env = jinja2.Environment()
env.filters['basename'] = os.path.basename
env.filters['replace'] = lambda s, a, b: s.replace(a, b)
template = open('examples/c_app.yml').read()
rendered = env.from_string(template).render(objdir='build', glob=glob)
loaded = yaml.safe_load(rendered)
print(type(loaded.get('targets')).__name__)
EOFLength of output: 873 Register 🏁 Script executed: #!/bin/bash
set -e
pip install jinja2 pyyaml
python3 - << 'EOF'
import jinja2, yaml, glob, os
# Load template from examples/
env = jinja2.Environment(loader=jinja2.FileSystemLoader('examples'))
env.globals['glob'] = glob.glob
env.filters['basename'] = os.path.basename
env.filters['replace'] = lambda s, a, b: s.replace(a, b)
# Render and parse
template = env.get_template('c_app.yml').render(objdir='build')
data = yaml.safe_load(template)
# Output type of targets
print(type(data.get('targets')).__name__)
EOFLength of output: 420 Ensure File: examples/c_app.yml - targets: |
- {% for src in glob('src/*.c') %}
- - name: "{{ objdir }}/{{ src | basename | replace('.c', '.o') }}"
- rule: compile
- sources: "{{ src }}"
- {% endfor %}
- - name: app
+ targets:
+ {% for src in glob('src/*.c') %}
+ - name: "{{ objdir }}/{{ src | basename | replace('.c', '.o') }}"
+ rule: compile
+ sources: "{{ src }}"
+ {% endfor %}
+ - name: app
Run 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| rule: link | ||||||||||||||||||||||||||||||
| sources: | ||||||||||||||||||||||||||||||
| {% for src in glob('src/*.c') %} | ||||||||||||||||||||||||||||||
| - "{{ objdir }}/{{ src | basename | replace('.c', '.o') }}" | ||||||||||||||||||||||||||||||
| {% endfor %} | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| defaults: | ||||||||||||||||||||||||||||||
| - app | ||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| netsuke_version: "1.0" | ||
|
|
||
| vars: | ||
| style: "{{ env('DT_STYLE') | default('natural') }}" | ||
|
sourcery-ai[bot] marked this conversation as resolved.
|
||
| outdir: "build/jpg/{{ style }}" | ||
|
|
||
| rules: | ||
| - name: develop | ||
| command: "mkdir -p $(dirname {outs}) && darktable-cli {ins} {outs} --style {{ style }}" | ||
| description: Develop RAW image | ||
|
|
||
| - name: thumb | ||
| command: "mkdir -p $(dirname {outs}) && convert {ins} -resize 200x200^ -gravity center -extent 200x200 {outs}" | ||
| description: Create thumbnail | ||
|
|
||
| targets: | ||
| {% for raw in glob('photos/*.nef') %} | ||
| - name: "{{ outdir }}/{{ raw | basename | replace('.nef', '.jpg') }}" | ||
| rule: develop | ||
| sources: "{{ raw }}" | ||
| - name: "{{ outdir }}/thumbs/{{ raw | basename | replace('.nef', '.jpg') }}" | ||
| rule: thumb | ||
| sources: "{{ outdir }}/{{ raw | basename | replace('.nef', '.jpg') }}" | ||
| {% endfor %} | ||
|
|
||
| defaults: | ||
| {% for raw in glob('photos/*.nef') %} | ||
| - "{{ outdir }}/thumbs/{{ raw | basename | replace('.nef', '.jpg') }}" | ||
| {% endfor %} | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,33 @@ | ||||||||||
| netsuke_version: "1.0" | ||||||||||
|
|
||||||||||
| vars: | ||||||||||
| python: python3 | ||||||||||
| venv: .venv | ||||||||||
|
|
||||||||||
| rules: | ||||||||||
| - name: setup | ||||||||||
| command: "{{ python }} -m venv {{ venv }}" | ||||||||||
| description: Create virtual environment | ||||||||||
|
Comment on lines
+9
to
+10
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Upgrade venv tooling during creation - command: "{{ python }} -m venv {{ venv }}"
+ command: "{{ python }} -m venv --upgrade-deps {{ venv }}"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| - name: install | ||||||||||
| command: "{{ venv }}/bin/pip install -e . -r requirements.txt" | ||||||||||
| description: Install package | ||||||||||
| - name: test | ||||||||||
| command: "{{ venv }}/bin/python -m pytest {{ ins | join(' ') }}" | ||||||||||
| description: Run tests | ||||||||||
|
|
||||||||||
| targets: | ||||||||||
| - name: venv | ||||||||||
| rule: setup | ||||||||||
| - name: deps | ||||||||||
| rule: install | ||||||||||
| sources: requirements.txt | ||||||||||
| deps: | ||||||||||
| - venv | ||||||||||
| - name: test-results | ||||||||||
| rule: test | ||||||||||
| sources: tests | ||||||||||
| deps: | ||||||||||
| - deps | ||||||||||
|
|
||||||||||
| defaults: | ||||||||||
| - test-results | ||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,21 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
| netsuke_version: "1.0" | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| vars: | ||||||||||||||||||||||||||||||||||||||||||||||
| outdir: build/png | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| rules: | ||||||||||||||||||||||||||||||||||||||||||||||
| - name: rasterise | ||||||||||||||||||||||||||||||||||||||||||||||
| command: "mkdir -p $(dirname {outs}) && inkscape {ins} --export-type=png --export-filename={outs}" | ||||||||||||||||||||||||||||||||||||||||||||||
| description: Convert SVG to PNG | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| targets: | ||||||||||||||||||||||||||||||||||||||||||||||
| {% for svg in glob('assets/svg/*.svg') %} | ||||||||||||||||||||||||||||||||||||||||||||||
| - name: "{{ outdir }}/{{ svg | basename | replace('.svg', '.png') }}" | ||||||||||||||||||||||||||||||||||||||||||||||
| rule: rasterise | ||||||||||||||||||||||||||||||||||||||||||||||
| sources: "{{ svg }}" | ||||||||||||||||||||||||||||||||||||||||||||||
| {% endfor %} | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| defaults: | ||||||||||||||||||||||||||||||||||||||||||||||
| {% for svg in glob('assets/svg/*.svg') %} | ||||||||||||||||||||||||||||||||||||||||||||||
| - "{{ outdir }}/{{ svg | basename | replace('.svg', '.png') }}" | ||||||||||||||||||||||||||||||||||||||||||||||
| {% endfor %} | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+11
to
+21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrap Jinja loop to restore YAML validity -targets:
-{% for svg in glob('assets/svg/*.svg') %}
+targets: |
+ {% for svg in glob('assets/svg/*.svg') %}
- name: "{{ outdir }}/{{ svg | basename | replace('.svg', '.png') }}"
rule: rasterise
sources: "{{ svg }}"
-{% endfor %}
+ {% endfor %}
-defaults:
-{% for svg in glob('assets/svg/*.svg') %}
- - "{{ outdir }}/{{ svg | basename | replace('.svg', '.png') }}"
-{% endfor %}
+defaults: |
+ {% for svg in glob('assets/svg/*.svg') %}
+ - "{{ outdir }}/{{ svg | basename | replace('.svg', '.png') }}"
+ {% endfor %}📝 Committable suggestion
Suggested change
🧰 Tools🪛 YAMLlint (1.37.1)[error] 12-12: syntax error: found character '%' that cannot start any token (syntax) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Expose PDF engine selection
Permit authors to tweak the output engine without editing the rule. Pipe an optional
pdf_enginevar through topandoc.Add to
vars:🤖 Prompt for AI Agents