-
fix: self-install pinned spaCy model at runtime with SHA256 verification (#4258)
发布于
2026-02-23 00:36:20 +00:00 Summary
- Replace
en-core-web-smdirect URL dependency inpyproject.toml
with theinstallerlibrary - spaCy model is now downloaded and installed on first use with SHA256
hash verification - Removes
[tool.uv.sources]section, making the install more portable
across package managers
Test plan
- Verify
tokenize.pydownloads and installs the spaCy model on
first use - Verify SHA256 hash check rejects tampered wheels
- Verify existing NLP tokenization tests pass
🤖 Generated with Claude Code
Note
Medium Risk
Introduces runtime download-and-install behavior into the NLP path and
writes intosite-packages, which can fail under restricted
networking/permissions or in unusual multi-process environments despite
locking and hash checks.Overview
Updates NLP tokenization to lazy-load and self-install the pinned
en_core_web_smspaCy model on first use, downloading the wheel from
GitHub and verifying it via SHA256, with a cross-processFileLock
to avoid concurrent installs.Removes the
en-core-web-smwheel URL dependency and
[tool.uv.sources]override, addinginstaller(for wheel
installation) andfilelock(for install locking) to dependencies;
uv.lockis updated accordingly and the version is bumped to0.21.2.Adjusts the
Dockerfileto trigger model installation during image
build (viauv runimporting_get_nlp) so the model is present before
HF_HUB_OFFLINE=1is set.Written by Cursor
Bugbot for commit
df62a9cf08b07f7292104ea69bd0b9725948b4a8. This will update automatically
on new commits. Configure
here.
Co-authored-by: Claude Opus 4.6 noreply@anthropic.com
Co-authored-by: Yao You yao@unstructured.io下载附件
- Replace