Skip to content

Implement pip dependency caching for Azure Pipelines#5267

Open
unnatikdm wants to merge 2 commits intoMDAnalysis:developfrom
unnatikdm:add-pip-caching
Open

Implement pip dependency caching for Azure Pipelines#5267
unnatikdm wants to merge 2 commits intoMDAnalysis:developfrom
unnatikdm:add-pip-caching

Conversation

@unnatikdm
Copy link

@unnatikdm unnatikdm commented Mar 1, 2026

## Description
Implements pip dependency caching for Azure Pipelines to reduce CI runtime (Issue #5255)

## Changes Made

### 1. Dynamic Cache Path Configuration
Added platform-specific cache path detection:
- **Linux/macOS**: `$(HOME)/.cache/pip`
- **Windows**: `$(LocalAppData)\pip\Cache`

```yaml
- bash: |
    if [ "$(Agent.OS)" == "Windows_NT" ]; then
      echo "##vso[task.setvariable variable=PIP_CACHE_DIR]$(LocalAppData)\pip\Cache"
    else
      echo "##vso[task.setvariable variable=PIP_CACHE_DIR]$(HOME)/.cache/pip"
    fi
  displayName: 'Set pip cache directory'

2. Cache@2 Task Integration

Added the caching task to save/restore pip dependencies:

- task: Cache@2
  inputs:
    key: 'pip | "$(Agent.OS)" | "$(PYTHON_VERSION)" | "$(BUILD_TYPE)" | "$(imageName)" | **/requirements.txt'
    restoreKeys: |
      pip | "$(Agent.OS)" | "$(PYTHON_VERSION)" | "$(BUILD_TYPE)" | "$(imageName)"
      pip | "$(Agent.OS)" | "$(PYTHON_VERSION)" | "$(BUILD_TYPE)"
      pip | "$(Agent.OS)" | "$(PYTHON_VERSION)"
    path: $(PIP_CACHE_DIR)
  displayName: 'Cache pip dependencies'

Testing Done

  • ✅ Verified cache works on Linux
  • ✅ Verified cache works on Windows
  • ✅ Confirmed cache hits on subsequent runs
  • ✅ Tested cache isolation across Python versions
  • ✅ Validated fallback keys work

Related

Closes #5255

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hello there first time contributor! Welcome to the MDAnalysis community! We ask that all contributors abide by our Code of Conduct and that first time contributors introduce themselves on GitHub Discussions so we can get to know you. You can learn more about participating here. Please also add yourself to package/AUTHORS as part of this PR.

@codecov
Copy link

codecov bot commented Mar 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.82%. Comparing base (900d20b) to head (855f366).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5267      +/-   ##
===========================================
- Coverage    93.83%   93.82%   -0.01%     
===========================================
  Files          180      180              
  Lines        22473    22473              
  Branches      3189     3189              
===========================================
- Hits         21088    21086       -2     
- Misses         923      924       +1     
- Partials       462      463       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Improve Azure CI performance by enabling pip dependency caching

1 participant