Skip to content

feat: use save_temp_file project situation for scratch files in NukeScriptNode #84

Description

@hutchinson

Background

The griptape-nodes-engine added a save_temp_file project situation that gives nodes a project-managed path for scratch files — OVERWRITE collision policy, resolves to the project's {temp} directory, and auto-creates directories. Nodes declare a ProjectFileParameter(situation="save_temp_file") to get a deterministic, project-visible path instead of writing to the OS temp dir.

Problem

nuke_nodes/nuke_script_node.py currently uses raw tempfile module calls to create scratch files during node execution. This means:

  • Scratch files land in the OS temp dir, invisible to the project system
  • Re-runs accumulate indexed copies instead of overwriting
  • Cleanup is manual (explicit finally blocks and atexit hooks)

Proposed Change

Migrate the following call-site groups in nuke_nodes/nuke_script_node.py to use ProjectFileParameter(situation="save_temp_file"):

  1. Lines ~812 — output placeholder files in run_step() (NamedTemporaryFile)
  2. Lines ~802 — image sequence directory in run_step() (mkdtemp)
  3. Lines ~630, 651_artifact_to_path() URL/bytes download helpers (NamedTemporaryFile)

Out of Scope

These are infrastructure-level temp files and should stay as-is:

  • execution/direct.py — IPC manifest JSON for subprocess communication
  • script_parser/sidecar.py — atomic write (mkstemp + rename) pattern
  • nuke_plugin/griptape_annotator_panel.py — same atomic write pattern inside Nuke GUI
  • publish_gizmo/run_button.py — runs inside Nuke's Python, not the Griptape runtime

Acceptance Criteria

  • All three call-site groups in nuke_nodes/ use ProjectFileParameter(situation="save_temp_file") path resolution
  • No raw tempfile module calls remain in nuke_nodes/
  • Manual cleanup in finally blocks removed where OVERWRITE policy makes them redundant
  • Existing unit tests pass (uv run pytest tests/unit/)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions