mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-13 23:14:11 +00:00
fix: install black's transitive deps in the pyodide code formatter (#29503)
Saving any tool or function in the admin UI threw "ModuleNotFoundError: No module named 'click'" in the browser, even on a fresh tool with no custom code, because the click name never appears in user code at all. The in-browser formatter runs black through a Pyodide/micropip worker. black needs click, mypy_extensions, pathspec, platformdirs and pytokens at import time, but the vendored pyodide-lock.json records none of these as black's dependencies, and micropip only walks a locked package's declared deps when install() is given explicit constraints, which this worker never does. So only black itself ever got installed. Requesting the five packages explicitly alongside black fixes it without touching the worker or the lock file.
This commit is contained in:
parent
8aa25dd358
commit
59f9502240
1 changed files with 9 additions and 1 deletions
|
|
@ -122,7 +122,15 @@ print(black.format_str("""${code.replace(/\\/g, '\\\\').replace(/`/g, '\\`').rep
|
|||
print("${endTag}")
|
||||
`;
|
||||
|
||||
const packages = ['black'];
|
||||
// black's pyodide-lock entry declares no dependencies, so micropip installs none of them
|
||||
const packages = [
|
||||
'black',
|
||||
'click',
|
||||
'mypy_extensions',
|
||||
'pathspec',
|
||||
'platformdirs',
|
||||
'pytokens'
|
||||
];
|
||||
|
||||
function handleMessage(event) {
|
||||
const { id: eventId, stdout, stderr } = event.data;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue