Skip to content

ci(unstructured2graph): download NLTK data explicitly - #258

Merged
antejavor merged 3 commits into
mainfrom
ci-unstructured2graph-nltk-data
Aug 10, 2026
Merged

antejavor merged 3 commits into
mainfrom
ci-unstructured2graph-nltk-data

Conversation

@antejavor

Copy link
Copy Markdown
Contributor

Summary

Fixes #257.

unstructured.nlp.tokenize auto-downloads averaged_perceptron_tagger_eng and punkt_tab on first import (AUTO_DOWNLOAD_NLTK, defaults to on, quiet=True). In the test-unstructured2graph CI job this wasn't succeeding, and since quiet=True suppresses nltk.download()'s own diagnostic output, the failure was silent — it only surfaced later as 22 unrelated-looking pytest failures (LookupError deep inside unstructured's text-partitioning path via pos_tag/contains_verb), not as a clear "download failed" error.

Splits the previous single Install dependencies and run tests step into three: Install dependencies, Download NLTK data (new — explicit python -m nltk.downloader averaged_perceptron_tagger_eng punkt_tab, no quiet flag), and Run tests. If the download ever fails again, this step now fails loudly on its own instead of masquerading as broken test logic across 22 different test failures.

What I couldn't pin down: the exact reason the silent auto-download wasn't succeeding in CI specifically. I verified the download mechanism itself works fine given a real network path — reproduced it locally against a fully isolated HOME (no pre-existing nltk_data, matching CI's fresh-runner conditions) and it succeeded cleanly. So this doesn't look like a fundamental incompatibility with the nltk<3.10 pin from #251, more likely a runner-specific network/timing hiccup. Either way, the actual problem — a silent failure surfacing as 22 confusing, unrelated-looking test failures — is fixed regardless of the exact CI-side trigger, and any future recurrence will now fail loudly on its own step.

Test plan

  • Reproduced the CI job's exact command sequence locally (uv venv → uv pip install -e .[test] → download → pytest .) in a from-scratch venv with an isolated HOME, faithfully simulating a fresh runner with no cached NLTK data.
  • Full suite passes: 74 passed, 1 skipped, against a live Memgraph + real OpenAI calls.
  • YAML validated; diff scoped to only the test-unstructured2graph job's steps.

…silent auto-download

Fixes #257. unstructured.nlp.tokenize auto-downloads averaged_perceptron_tagger_eng
and punkt_tab on first import (AUTO_DOWNLOAD_NLTK, quiet=True by default) --
in the test-unstructured2graph CI job this wasn't succeeding, and since
quiet=True suppresses nltk.download()'s own diagnostic output, the failure
was silent and only surfaced later as 22 unrelated-looking pytest failures
(LookupError deep inside unstructured's text-partitioning path), not as a
clear "download failed" error.

Splits the previous single "Install dependencies and run tests" step into
three: Install dependencies, Download NLTK data (new -- explicit, visible
`python -m nltk.downloader averaged_perceptron_tagger_eng punkt_tab`, no
quiet flag), and Run tests. If the download ever fails again, this step
fails loudly on its own instead of masquerading as broken test logic.

Root cause of *why* the silent auto-download wasn't succeeding in CI
specifically is still unconfirmed -- the download mechanism itself works
fine given a real network path (verified locally against a fully isolated
HOME, matching CI's fresh-runner conditions), so this doesn't appear to be
a fundamental incompatibility with the nltk<3.10 pin from #251. This fix
makes the dependency explicit and any future failure diagnosable, which was
the actual problem (22 confusing test failures instead of one clear one),
independent of pinning down the exact CI-side cause.

Verified: full suite (74 passed, 1 skipped) against a live Memgraph +
OpenAI in a from-scratch venv + isolated HOME, replicating the CI job's
exact command sequence (uv venv -> uv pip install -e .[test] -> download ->
pytest .).
The workflow's own paths filters (top-level trigger and each
dorny/paths-filter entry) didn't include tests.yaml, so a PR that only
edits this file never runs any test-* job -- including the NLTK-data
fix in this PR, which touches only this workflow. Since every job is
defined in this one shared file, an edit to it can affect any of them,
so it's added everywhere memgraph-toolbox already is: the shared-
dependency case.
@antejavor
antejavor merged commit 90c7719 into main Aug 10, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unstructured2graph: NLTK data (averaged_perceptron_tagger_eng / punkt_tab) not available in CI

1 participant