Skip to content

Commit a50038c

Browse files
mabry1985Josh Mabryclaude
authored
docs: standalone-script note for the project_board import bootstrap (#66)
Hit twice this session while writing quick live smoke tests outside pytest (exercising coder_seam.test_rung() against a real repo + a real delegate, bypassing the need for a full plugin host) -- reached for a manual symlink workaround before realizing tests/conftest.py already solves this properly (registers the repo root under sys.modules["project_board"] via importlib.util.spec_from_file_location, no symlink/rename needed). Document the actual mechanism in the README so the next standalone script doesn't rediscover the workaround. Snippet verified to actually run standalone (not just copied from conftest.py). Co-authored-by: Josh Mabry <josh@protolabs.studio> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent ce91ad1 commit a50038c

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,32 @@ project_board:
169169

170170
Ships **disabled**; nothing runs until you enable it and declare a coder.
171171

172+
## Standalone scripts (outside pytest)
173+
174+
`from project_board import coder_seam` resolves under `pytest` because
175+
`tests/conftest.py` registers this repo's root `__init__.py` under the name
176+
`project_board` directly in `sys.modules` (`importlib.util.spec_from_file_location`,
177+
`submodule_search_locations=[ROOT]`) — the repo's own directory name
178+
(`projectBoard-plugin`) doesn't matter; no symlink, no rename needed. That
179+
registration only happens when `conftest.py` loads, so a plain script
180+
(`python some_smoke_test.py`, not `pytest`) needs the same few lines up front:
181+
182+
```python
183+
import importlib.util
184+
import sys
185+
from pathlib import Path
186+
187+
ROOT = Path("/path/to/projectBoard-plugin")
188+
spec = importlib.util.spec_from_file_location("project_board", ROOT / "__init__.py", submodule_search_locations=[str(ROOT)])
189+
sys.modules["project_board"] = importlib.util.module_from_spec(spec)
190+
spec.loader.exec_module(sys.modules["project_board"])
191+
192+
from project_board import coder_seam, worktree # now resolves
193+
```
194+
195+
Handy for a one-off live smoke test (e.g. exercising `coder_seam.test_rung()`
196+
against a real repo + a real delegate) without standing up a whole plugin host.
197+
172198
## Releasing
173199

174200
Releases follow the fleet cadence via [`protoLabsAI/release-tools`](https://github.com/protoLabsAI/release-tools):

0 commit comments

Comments
 (0)