| 100 | |
| 101 | @dataclass |
| 102 | class ExampleScript: |
| 103 | path: Path |
| 104 | tags: set[str] = field(default_factory=set) |
| 105 | |
| 106 | @property |
| 107 | def relpath(self) -> str: |
| 108 | return normalize_relpath(str(self.path.relative_to(ROOT_DIR))) |
| 109 | |
| 110 | @property |
| 111 | def module(self) -> str: |
| 112 | relative = self.path.relative_to(ROOT_DIR).with_suffix("") |
| 113 | return ".".join(relative.parts) |
| 114 | |
| 115 | @property |
| 116 | def command(self) -> list[str]: |
| 117 | # Run via module path so relative imports inside examples work. |
| 118 | return [*build_uv_run_command(), "python", "-u", "-m", self.module] |
| 119 | |
| 120 | |
| 121 | @dataclass |