tool

Abstract base for external EDA tool wrappers.

Tool is the root of the tool catalogue. It is never instantiated: every tool is used as a singleton through classmethods (e.g. YosysTool.run(...)). The base owns the single subprocess entry point (run), so every concrete wrapper (Yosys, OpenSTA, GHDL, and future tools such as nextpnr or OpenROAD) shares one place for invocation and error handling, and no business-logic code calls subprocess directly. Each subclass resolves its own executable from the FABulous context via executable.

Classes

Tool

Abstract base for every external tool wrapper.

Module Contents

Tool

class Tool[source]

Bases: ABC

Abstract base for every external tool wrapper.

Tools are stateless singletons used through classmethods only; neither Tool nor any subclass can be instantiated (see __new__). A subclass implements executable to resolve its command, then builds its argument list and stdin and calls run.

Reject instantiation; tools are used only through their classmethods.

Parameters:
  • *_args (object) – Ignored positional arguments from the rejected constructor call.

  • **_kwargs (object) – Ignored keyword arguments from the rejected constructor call.

Raises:

TypeError – Always, because tool wrappers are stateless singletons.

Methods

classmethod executable() Path | str[source]
Abstractmethod:

Return the path to (or name of) this tool’s executable.

Returns:

The resolved executable, typically read from the FABulous context.

classmethod render_template(template_name, **context) str[source]

Render a tool script template into the command string to feed run.

Parameters:
  • template_name (str) – Template file name within the fabulous/template directory.

  • **context (object) – Variables made available to the template.

Returns:

The rendered script.

classmethod run(args=None, stdin_data='') CompletedProcess[source]

Run the tool executable, capturing output and raising on failure.

Parameters:
  • args (list[str] | None) – Arguments passed to the executable.

  • stdin_data (str) – Data piped to the executable’s stdin.

Returns:

The completed subprocess result.

Raises:

RuntimeError – If the command exits with a non-zero return code.