Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Environment:8beeeaaat Touchdesigner mcp Pure Python No TD

From Leeroopedia
Knowledge Sources
Domains Geometry, Testing
Last Updated 2026-10-28 22:13 GMT

Overview

Standard Python 3.9+ environment with no TouchDesigner dependency, for pure-geometry and pure-logic modules that can be unit-tested outside the TouchDesigner runtime.

Description

This environment covers Python modules that intentionally avoid `import td` so their logic can be unit-verified in any standard Python environment (CPython, PyPy, CI runners, etc.). The primary example is `node_layout.py`, which implements grid placement geometry using only tuples and arithmetic — no TouchDesigner APIs are called.

The module docstring explicitly documents this design decision: "This module intentionally has no `import td` so the placement logic can be unit-verified outside TouchDesigner." This allows the grid-layout algorithm to be tested with `pytest` against a stubbed `td` module (via `conftest.py`) or with no `td` stub at all, since the module never imports it.

Usage

Use this environment for pure-logic Python modules that do not need the TouchDesigner runtime. These modules can be tested with `npm run test:python` (which runs `pytest` against a stubbed `td` module) or with plain `pytest` since they never import `td`.

System Requirements

Category Requirement Notes
OS Any (Linux, macOS, Windows) No TouchDesigner dependency
Software Python >= 3.9 Matches `pyproject.toml` `requires-python`
Hardware No GPU required Pure computation only

Dependencies

System Packages

  • Python 3.9+

Python Packages

  • No third-party packages required for `node_layout.py` (pure standard library)

Test Dependencies (optional)

  • `pytest` (for running `tests/python/` suites)
  • `ruff` (for linting, configured in `pyproject.toml`)

Credentials

No credentials required.

Quick Install

# No installation needed beyond Python 3.9+
# For testing:
pip install pytest ruff
# Run tests:
pytest tests/python/

Code Evidence

The `node_layout.py` module explicitly avoids importing `td`:

From `td/modules/mcp/services/node_layout.py:1-6`:

"""Pure geometry helpers for laying out newly created nodes.

This module intentionally has **no** ``import td`` so the placement logic can be
unit-verified outside TouchDesigner. All coordinates use TouchDesigner's node
space: ``(x, y)`` is the lower-left corner and ``y`` grows upward.
"""

The `first_free_cell` function uses only standard Python:

From `td/modules/mcp/services/node_layout.py:41-60`:

def first_free_cell(
    existing, width, height, cols=DEFAULT_COLS, gap=DEFAULT_GAP, origin=(0.0, 0.0),
):
    for k in range(_MAX_CELLS):
        box = _cell_box(k, width, height, cols, gap, origin)
        if all(not boxes_overlap(box, e, gap) for e in existing):
            return (box[0], box[1])
    raise RuntimeError("first_free_cell: no free grid cell within safety bound")

Common Errors

Error Message Cause Solution
`RuntimeError: first_free_cell: no free grid cell within safety bound` More than 100,000 cells searched without finding a free slot Reduce grid density or increase `cols` parameter
`ModuleNotFoundError: No module named 'td'` Attempting to import a module that does require `td` in this environment Only pure-logic modules belong in this environment; TD-dependent modules need Environment:8beeeaaat_Touchdesigner_mcp_TouchDesigner_Runtime

Compatibility Notes

  • All platforms: Works on any OS with Python 3.9+.
  • No TouchDesigner required: Modules in this environment can be tested in CI without a TouchDesigner license or installation.
  • Ruff linting: `pyproject.toml` ignores `F821` (undefined name) because TouchDesigner provides globals like `parent`, but pure-logic modules do not rely on those globals.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment