Uploaded image for project: 'Cost Management'
  1. Cost Management
  2. COST-4689

Pin the version of pipenv used in development and testing

XMLWordPrintable

    • False
    • None
    • False

      Currently we install the latest version of pipenv in CI for every run, and we do not specify a version for use with local development. This creates a situation where spontaneous breakage can occur.

      There is currently a bug in pipenv >2023.7.23 that causes pipenv lock to get stuck in a recursive loop, ballooning the local cache size to multipble gigabytes and eventually raising a ResolutionTooDeep exception.

      Steps to reproduce

      1. Create a Pipfile containing the minimal requirements to trigger this bug.

      [[source]]
      url = "https://pypi.python.org/simple"
      verify_ssl = true
      name = "pypi"
      
      [packages]
      boto3 = ">=1.10"
      ibm-platform-services = ">=0.17.8"

      2. Create a virtual environment and install pipenv

      python -m venv .venvs/pipenv
      .venvs/pipenv/bin/python -m pip install pipenv
      .venvs/pipenv/bin/pipenv --version

      3. Create a virtual environment for development work that pipenv will manage

      python -m venv .venvs/dev
      source .venvs/dev/bin/activate
      

      4. Clear the pipenv cache and create a lock file

      .venvs/pipenv/bin/pipenv --clear
      .venvs/pipenv/bin/pipenv lock -v
      

      This will create a lockfile successfully though sometimes it gets stuck on the first attempt.

      5. Run pipenv lock -v several more times without clearing the cache. Usually the third attempt is when things get fun.

      for test in $(seq 10); do
      .venvs/pipenv/bin/pipenv lock -v
      sleep 5
      done
      

      The cache size keeps growing as well:

      > watch -n 1 ls -l /Users/sdoran/Library/Caches/pipenv/
      Tue Feb 13 13:13:54 EST 2024 0M
      Tue Feb 13 13:13:54 EST 2024 324K	/Users/sdoran/Library/Caches/pipenv/
      Tue Feb 13 13:13:57 EST 2024 1.1M	/Users/sdoran/Library/Caches/pipenv/
      ...
      Tue Feb 13 13:15:42 EST 2024 279M	/Users/sdoran/Library/Caches/pipenv/
      Tue Feb 13 13:15:43 EST 2024 290M	/Users/sdoran/Library/Caches/pipenv/
      Tue Feb 13 13:15:43 EST 2024 300M	/Users/sdoran/Library/Caches/pipenv/
      Tue Feb 13 13:15:44 EST 2024 310M	/Users/sdoran/Library/Caches/pipenv/
      Tue Feb 13 13:15:44 EST 2024 321M	/Users/sdoran/Library/Caches/pipenv/
      ...
      Tue Feb 13 13:16:19 EST 2024 946M	/Users/sdoran/Library/Caches/pipenv/
      Tue Feb 13 13:16:23 EST 2024 1.0G	/Users/sdoran/Library/Caches/pipenv/
      ...
      Tue Feb 13 13:17:40 EST 2024 2.1G	/Users/sdoran/Library/Caches/pipenv/
      

              Unassigned Unassigned
              rh-ee-sdoran Sam Doran
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: