Skip to content

Commit 1a94c72

Browse files
committed
Upgrade allow_external warning to error
1 parent 350c4f2 commit 1a94c72

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

docs/introduction/advanced-settings.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,9 @@ Controls import path overrides during import resolution.
309309
310310
Enables and disables resolution of imports from `sys.path`.
311311

312-
<Note>
313-
For this to properly work, you may also need to enable `allow_external`.
314-
</Note>
312+
<Warning>
313+
For this to properly work, you must also set `allow_external` to `True`.
314+
</Warning>
315315

316316
## Flag: `allow_external`
317317
> **Default: `False`**

src/codegen/sdk/core/codebase.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,13 @@ def __init__(
213213
self.ctx = CodebaseContext(projects, config=config, secrets=secrets, io=io, progress=progress)
214214
self.console = Console(record=True, soft_wrap=True)
215215

216+
# Assert config assertions
217+
# External import resolution must be enabled if syspath is enabled
218+
if self.ctx.config.py_resolve_syspath:
219+
if not self.ctx.config.allow_external:
220+
msg = "allow_external must be set to True when py_resolve_syspath is enabled"
221+
raise ValueError(msg)
222+
216223
@noapidoc
217224
def __str__(self) -> str:
218225
return f"<Codebase(name={self.name}, language={self.language}, path={self.repo_path})>"

0 commit comments

Comments
 (0)