Skip to content

ci: use uv for test dependency installation (fixes Poetry resolve hang)#2152

Open
RonShakutai wants to merge 1 commit into
mainfrom
ronshakutai/fix-ci-poetry-timeout
Open

ci: use uv for test dependency installation (fixes Poetry resolve hang)#2152
RonShakutai wants to merge 1 commit into
mainfrom
ronshakutai/fix-ci-poetry-timeout

Conversation

@RonShakutai

@RonShakutai RonShakutai commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Change Description

The analyzer test job runs poetry install --all-extras with no committed lock, so Poetry does 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 (google-genai, google-cloud-storage, aiohttp…).

Reproduced locally (Python 3.13, warm cache): Poetry >6 min, never completed; uv resolves the same 158-package set in ~2s.

Fix — swap the test jobs to uv

  • Install uv via astral-sh/setup-uv.
  • Per-component uv venv --seed (seed keeps pip for 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).
  • Job-level timeout-minutes: 60 (and 30 on the install step) so a bad resolve fails fast instead of hanging.

pyproject.toml is untouched (aligned to main) — 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

  • I have reviewed the contribution guidelines
  • I agree to follow this project's Code of Conduct
  • I confirm that I have the right to submit this contribution and that it does not knowingly contain proprietary or confidential code.
  • My code includes unit tests (CI-only change)
  • All unit tests and lint checks pass locally
  • My PR contains documentation updates / additions if required (CHANGELOG)

Copilot AI review requested due to automatic review settings July 9, 2026 17:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 matrix test job 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-interaction to poetry install to avoid CI waiting on prompts.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Coverage report (presidio-anonymizer)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  presidio-anonymizer/presidio_anonymizer
  anonymizer_engine.py
  presidio-anonymizer/presidio_anonymizer/operators
  custom.py
Project Total  

This report was generated by python-coverage-comment-action

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Coverage report (presidio-image-redactor)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  presidio-image-redactor/presidio_image_redactor
  dicom_image_pii_verify_engine.py
  document_intelligence_ocr.py
  image_analyzer_engine.py
Project Total  

This report was generated by python-coverage-comment-action

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Coverage report (presidio-cli)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  presidio-cli/presidio_cli
  cli.py
Project Total  

This report was generated by python-coverage-comment-action

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Coverage report (presidio-structured)

This PR does not seem to contain any modification to coverable code.

Copilot AI review requested due to automatic review settings July 9, 2026 18:22
@RonShakutai RonShakutai changed the title fix(ci): add timeout-minutes to prevent Poetry hanging fix(ci): revert analyzer to Python <3.14 to fix Poetry resolve hang Jul 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread presidio-analyzer/pyproject.toml Outdated
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)",
Copilot AI review requested due to automatic review settings July 9, 2026 20:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread presidio-analyzer/pyproject.toml Outdated
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>
Copilot AI review requested due to automatic review settings July 12, 2026 08:04
@RonShakutai RonShakutai force-pushed the ronshakutai/fix-ci-poetry-timeout branch from a029bf8 to 7340a02 Compare July 12, 2026 08:04
@RonShakutai RonShakutai changed the title fix(ci): revert analyzer to Python <3.14 to fix Poetry resolve hang ci: use uv for test dependency installation (fixes Poetry resolve hang) Jul 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread .github/workflows/ci.yml
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]'
Comment thread CHANGELOG.md
### 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.
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.

2 participants