Download hatch_build.py from Rfym21/OpenWebUI: direct link, hf CLI and curl.
- Browser
- Download file 819 Bytes
-
https://huggingface.co/spaces/Rfym21/OpenWebUI/resolve/main/hatch_build.py
- Command line
-
hf download hf://spaces/Rfym21/OpenWebUI/hatch_build.py
-
curl -L -o hatch_build.py https://huggingface.co/spaces/Rfym21/OpenWebUI/resolve/main/hatch_build.py
819 Bytes
| # noqa: INP001 | |
| import os | |
| import shutil | |
| import subprocess | |
| from sys import stderr | |
| from hatchling.builders.hooks.plugin.interface import BuildHookInterface | |
| class CustomBuildHook(BuildHookInterface): | |
| def initialize(self, version, build_data): | |
| super().initialize(version, build_data) | |
| stderr.write(">>> Building Open Webui frontend\n") | |
| npm = shutil.which("npm") | |
| if npm is None: | |
| raise RuntimeError( | |
| "NodeJS `npm` is required for building Open Webui but it was not found" | |
| ) | |
| stderr.write("### npm install\n") | |
| subprocess.run([npm, "install"], check=True) # noqa: S603 | |
| stderr.write("\n### npm run build\n") | |
| os.environ["APP_BUILD_HASH"] = version | |
| subprocess.run([npm, "run", "build"], check=True) # noqa: S603 | |