Skip to content

Conversation

@Borda
Copy link
Contributor

@Borda Borda commented Dec 30, 2025

This pull request simplifies the caching setup for pip dependencies in the GitHub Actions workflow and ensures that all pip installs use the PyTorch CPU wheel index. The main changes involve replacing custom cache steps with the built-in cache: 'pip' option in actions/setup-python, and adding the --extra-index-url flag to all relevant pip install commands for consistent dependency resolution.

Workflow caching improvements:

  • Replaced custom pip cache steps (using actions/cache and manual timestamp keys) with the built-in cache: 'pip' option in actions/setup-python, streamlining cache management across all jobs. [1] [2] [3] [4]

Dependency installation updates:

  • Updated all pip install commands to include --extra-index-url https://download.pytorch.org/whl/cpu, ensuring that PyTorch and related packages are consistently installed from the CPU wheel index. This affects installation from wheels, tarballs, requirements files, and direct package installs. [1] [2] [3] [4] [5]

Copilot AI review requested due to automatic review settings December 30, 2025 12:59
@Borda Borda requested a review from KumoLiu as a code owner December 30, 2025 12:59
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 30, 2025

📝 Walkthrough

Walkthrough

Replaces custom multi-step pip caching in the GitHub Actions workflow with the built-in cache: 'pip' across multiple jobs and steps. Adds --extra-index-url https://download.pytorch.org/whl/cpu to numerous pip install invocations (torch, torchvision, monai, docs, requirements-dev, wheel/packaging steps, and installs from wheel/tar.gz). Applies the built-in pip cache to additional job steps and aligns indentation/structure in the workflow. In setup.py, adds an inline # type: ignore to a package_data literal (no functional change).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers workflow caching improvements and dependency installation updates with specific details and links. However, it does not follow the required template structure with 'Fixes #', 'Types of changes' checklist, or test verification items. Add the required template sections: issue reference ('Fixes #'), and 'Types of changes' checklist with applicable items marked.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title mentions CI disk space, cache pruning, and CPU PyTorch wheels—directly matching the PR's main objectives. It is concise and relevant.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 0d0fc56 and e85a623.

📒 Files selected for processing (1)
  • setup.py
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

⚙️ CodeRabbit configuration file

Review the Python code for quality and correctness. Ensure variable names adhere to PEP8 style guides, are sensible and informative in regards to their function, though permitting simple names for loop and comprehension variables. Ensure routine names are meaningful in regards to their function and use verbs, adjectives, and nouns in a semantically appropriate way. Docstrings should be present for all definition which describe each variable, return value, and raised exception in the appropriate section of the Google-style of docstrings. Examine code for logical error or inconsistencies, and suggest what may be changed to addressed these. Suggest any enhancements for code improving efficiency, maintainability, comprehensibility, and correctness. Ensure new or modified definitions will be covered by existing or new unit tests.

Files:

  • setup.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
  • GitHub Check: flake8-py3 (mypy)
  • GitHub Check: flake8-py3 (codeformat)
  • GitHub Check: flake8-py3 (pytype)
  • GitHub Check: packaging
  • GitHub Check: quick-py3 (ubuntu-latest)
  • GitHub Check: quick-py3 (windows-latest)
  • GitHub Check: build-docs
  • GitHub Check: quick-py3 (macOS-latest)
  • GitHub Check: min-dep-py3 (3.12)
  • GitHub Check: min-dep-py3 (3.9)
  • GitHub Check: min-dep-pytorch (2.8.0)
  • GitHub Check: min-dep-pytorch (2.6.0)
  • GitHub Check: min-dep-pytorch (2.7.1)
  • GitHub Check: min-dep-pytorch (2.5.1)
  • GitHub Check: min-dep-py3 (3.10)
  • GitHub Check: min-dep-py3 (3.11)
  • GitHub Check: min-dep-os (macOS-latest)
  • GitHub Check: min-dep-os (ubuntu-latest)
  • GitHub Check: min-dep-os (windows-latest)
🔇 Additional comments (1)
setup.py (1)

149-149: Type ignore comment is correctly formatted with specific error code.

The # type: ignore[arg-type] suppression addresses an upstream mypy issue with the unpacked list in package_data. This specific error code is more precise than a bare ignore.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

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 optimizes CI workflow resource usage by simplifying pip caching and ensuring consistent use of PyTorch CPU-only wheels to resolve drive space issues.

  • Replaced custom cache management with built-in actions/setup-python caching
  • Added --extra-index-url https://download.pytorch.org/whl/cpu to pip install commands for smaller PyTorch installations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/pythonapp.yml (1)

86-86: Missing CPU wheel index flag.

Line 86 installs PyTorch without --extra-index-url https://download.pytorch.org/whl/cpu, causing CUDA wheels (~2GB+) to be downloaded instead of CPU wheels, defeating the PR's disk space reduction objective.

🔎 Proposed fix
-        python -m pip install torch==2.5.1 torchvision==0.20.1
+        python -m pip install torch==2.5.1 torchvision==0.20.1 --extra-index-url https://download.pytorch.org/whl/cpu
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 15fd428 and dca59ee.

📒 Files selected for processing (1)
  • .github/workflows/pythonapp.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: Agent
  • GitHub Check: flake8-py3 (pytype)
  • GitHub Check: flake8-py3 (mypy)
  • GitHub Check: flake8-py3 (codeformat)
  • GitHub Check: quick-py3 (macOS-latest)
  • GitHub Check: quick-py3 (ubuntu-latest)
  • GitHub Check: min-dep-py3 (3.10)
  • GitHub Check: build-docs
  • GitHub Check: quick-py3 (windows-latest)
  • GitHub Check: min-dep-os (windows-latest)
  • GitHub Check: packaging
  • GitHub Check: min-dep-pytorch (2.5.1)
  • GitHub Check: min-dep-py3 (3.11)
  • GitHub Check: min-dep-pytorch (2.8.0)
  • GitHub Check: min-dep-py3 (3.12)
  • GitHub Check: min-dep-pytorch (2.7.1)
  • GitHub Check: min-dep-py3 (3.9)
  • GitHub Check: min-dep-pytorch (2.6.0)
  • GitHub Check: min-dep-os (macOS-latest)
  • GitHub Check: min-dep-os (ubuntu-latest)
🔇 Additional comments (3)
.github/workflows/pythonapp.yml (3)

36-36: Built-in pip caching correctly applied.

This simplifies cache management as intended.


69-69: LGTM: Consistent pip caching across all jobs.

Built-in caching mechanism correctly applied.

Also applies to: 119-119, 190-190


127-127: CPU wheel index correctly applied.

All pip install commands properly configured to use CPU PyTorch wheels.

Also applies to: 156-156, 167-167, 177-177, 194-194

@ericspod
Copy link
Member

ericspod commented Jan 4, 2026

Hi @Borda thanks for this fix, I think this is good to work as the tests have passed here without the space issue occurring. Please do follow the instructions for the DCO issue and have a look at anything Coderabbit said, even the ones outside the diff range. For the mypy problem, I think some library somewhere else we haven't pinned closely was updated and so the typing is broken, you may need to put # type: ignore on the line in setup.py where the complaint originates to sidestep the problem for now.

@Borda
Copy link
Contributor Author

Borda commented Jan 4, 2026

Please do follow the instructions for the DCO issue and have a look at anything Coderabbit said, even the ones outside the diff range.

In fact, it complains about the fix, but it is not correct as GHA uses a pure CPU machine, and so installing the CUDA/GPU version doesn't have any impact, only takes extra space which in this case is the root of the problem...

For the mypy problem, I think some library somewhere else we haven't pinned closely was updated and so the typing is broken, you may need to put # type: ignore on the line in setup.py where the complaint originates to sidestep the problem for now.

Yes, I planned to tackle the mypy in a separate PR to keep the changes focused and minimal to be easier reviewed, but sure I can add it here :)

Borda added 2 commits January 4, 2026 09:22
…f `torch`

Signed-off-by: jirka <jirka.borovec@seznam.cz>
Signed-off-by: jirka <jirka.borovec@seznam.cz>
Copy link

Copilot AI left a comment

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 no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Borda added 2 commits January 4, 2026 10:01
Signed-off-by: jirka <jirka.borovec@seznam.cz>
Signed-off-by: jirka <jirka.borovec@seznam.cz>
@Borda
Copy link
Contributor Author

Borda commented Jan 4, 2026

@ericspod @KumoLiu all is 🟢 🦩

@KumoLiu
Copy link
Contributor

KumoLiu commented Jan 4, 2026

/build

@Borda
Copy link
Contributor Author

Borda commented Jan 4, 2026

/build

@KumoLiu passed 🟢 🎉

@ericspod ericspod merged commit 29d47b0 into Project-MONAI:dev Jan 5, 2026
27 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.

3 participants