ci: use uv for test dependency installation (fixes Poetry resolve hang)#2152
Open
RonShakutai wants to merge 1 commit into
Open
ci: use uv for test dependency installation (fixes Poetry resolve hang)#2152RonShakutai wants to merge 1 commit into
RonShakutai wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the CI workflow against indefinite hangs during Poetry dependency resolution by adding explicit timeouts and ensuring Poetry runs non-interactively, improving reliability of the test matrix runs across Presidio components.
Changes:
- Add a job-level timeout (
timeout-minutes: 60) for the matrixtestjob to prevent unbounded runtime. - Add a step-level timeout (
timeout-minutes: 30) specifically for the “Install dependencies” step to cap Poetry resolution time. - Add
--no-interactiontopoetry installto avoid CI waiting on prompts.
Contributor
Coverage report (presidio-anonymizer)Click to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
Contributor
Coverage report (presidio-image-redactor)Click to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
Contributor
Coverage report (presidio-cli)Click to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
Contributor
Comment on lines
+23
to
+27
| include = ["conf/*",] | ||
|
|
||
| requires-python = ">=3.10,<3.15" | ||
| requires-python = ">=3.10,<3.14" | ||
| dependencies = [ | ||
| "spacy (>=3.4.4,!=3.7.0,<4.0.0); python_version < '3.14'", | ||
| "spacy (>=3.4.4,!=3.7.0,!=3.8.14,<4.0.0); python_version >= '3.14'", | ||
| "spacy (>=3.4.4,!=3.7.0,<4.0.0)", |
| include = ["conf/*",] | ||
|
|
||
| requires-python = ">=3.10,<3.15" | ||
| requires-python = ">=3.10,<3.14" |
The analyzer test job runs `poetry install --all-extras` with no committed lock, so Poetry performs a universal resolve of the full optional-dependencies graph on every run. That resolve backtracks for many minutes — effectively hanging — driven by the langextract extra's deep, loosely-bounded transitive tree. Reproduced locally: Poetry >6 min (never completed); uv ~2s for the same 158-package resolution. Switch the test jobs to uv: - Install uv via astral-sh/setup-uv. - Create a per-component venv with `uv venv --seed` (seed keeps pip for the wheel-build step) and expose it via $GITHUB_PATH / $VIRTUAL_ENV. - `uv pip install -e '.<extras>'` plus the test tooling that previously came from the Poetry dev group (uv does not read that group). - Add a job-level `timeout-minutes: 60` (and 30 on the install step) so a bad resolve fails fast instead of hanging. No package metadata changed — pyproject.toml is untouched; this only swaps the CI install tooling. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
a029bf8 to
7340a02
Compare
Comment on lines
93
to
+97
| - python-version: '3.14' | ||
| component: | ||
| name: 'Analyzer' | ||
| path: 'presidio-analyzer' | ||
| extras: '--all-extras' | ||
| extras: '[server,transformers,stanza,azure-ai-language,ahds,gliner,langextract]' |
| ### Anonymizer | ||
| ### General | ||
| #### Fixed | ||
| - Switched the test CI jobs from Poetry to [uv](https://github.com/astral-sh/uv) for dependency installation, and added a job-level `timeout-minutes` safety net. Poetry's lockless universal resolve backtracked for many minutes (effectively hanging) on the analyzer's large `--all-extras` / `optional-dependencies` graph; uv resolves and installs the same set in seconds. No package metadata changed — only the CI install tooling. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Description
The analyzer test job runs
poetry install --all-extraswith no committed lock, so Poetry does a universal resolve of the fulloptional-dependenciesgraph on every run. That resolve backtracks for many minutes — effectively hanging — driven by thelangextractextra's deep, loosely-bounded transitive tree (google-genai, google-cloud-storage, aiohttp…).Reproduced locally (Python 3.13, warm cache): Poetry >6 min, never completed;
uvresolves the same 158-package set in ~2s.Fix — swap the test jobs to uv
astral-sh/setup-uv.uv venv --seed(seed keepspipfor the wheel-build step), exposed via$GITHUB_PATH/$VIRTUAL_ENV.uv pip install -e '.<extras>'+ the test tooling that previously came from the Poetry dev group (uv doesn't read that group).timeout-minutes: 60(and30on the install step) so a bad resolve fails fast instead of hanging.pyproject.tomlis untouched (aligned tomain) — this only changes the CI install tooling. The Python 3.14 matrix job is kept as-is.Verified locally: the exact CI install command completes in ~17s and pytest collects all 2618 analyzer tests with every extra importable.
Issue reference
N/A
Checklist