Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [Unreleased]

- Updated Pipenv from 2025.0.4 to 2026.0.3. ([#2000](https://github.com/heroku/heroku-buildpack-python/pull/2000))

## [v328] - 2026-01-07

Expand Down
12 changes: 0 additions & 12 deletions lib/pipenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,29 +81,17 @@ function pipenv::install_pipenv() {
export PATH="${pipenv_bin_dir}:${PATH}"
# Force Pipenv to manage the system Python site-packages instead of using venvs.
export PIPENV_SYSTEM="1"
# Hide Pipenv's notice about finding/using an existing virtual environment.
export PIPENV_VERBOSITY="-1"
# Work around a Pipenv bug when using `--system`, whereby it doesn't correctly install
# dependencies that happen to also be a dependency of Pipenv (such as `certifi`).
# In general Pipenv's support for its `--system` mode seems very buggy. Longer term we
# should explore moving to venvs, however, that will need to be coordinated across all
# package managers and also change paths for Python which could break other use cases.
export VIRTUAL_ENV="${python_home}"
Copy link

Choose a reason for hiding this comment

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

this appears to have broken our builds, as of a few hours ago djangos collectstatic is failing due to not being able to import certifi and packaging

Copy link
Member

Choose a reason for hiding this comment

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

@tolomea Ah strange - the test that was added at the time of the workaround is still passing (when it was failing before the workaround), so this must be a subtly different failure mode. I'm honestly pretty weary with the buginess of Pipenv. I'm very close to just deprecating support for it, now that much more reliable/well maintained (and faster) alternatives are available, such as uv.

Thank you for letting my know anyway! I'll take a closer look now.

Copy link

Choose a reason for hiding this comment

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

I'm not attached to pipenv, my predecessor choose it and nothing has pushed me to change it

Copy link
Member

Choose a reason for hiding this comment

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

@tolomea I've reapplied the workaround in #2011 which has just been released in v330 - could you try building again and confirm that resolves the issue?

Copy link

Choose a reason for hiding this comment

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

That seems to be working fine, thank you


# Set the same env vars in the environment used by later buildpacks.
cat >>"${export_file}" <<-EOF
export PATH="${pipenv_bin_dir}:\${PATH}"
export PIPENV_SYSTEM="1"
export PIPENV_VERBOSITY="-1"
export VIRTUAL_ENV="${python_home}"
EOF

# And the environment used at app run-time.
cat >>"${profile_d_file}" <<-EOF
export PATH="${pipenv_bin_dir}:\${PATH}"
export PIPENV_SYSTEM="1"
export PIPENV_VERBOSITY="-1"
export VIRTUAL_ENV="${python_home}"
EOF
}

Expand Down
2 changes: 1 addition & 1 deletion requirements/pipenv.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pipenv==2025.0.4
pipenv==2026.0.3
6 changes: 0 additions & 6 deletions spec/hatchet/ci_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,8 @@
LIBRARY_PATH=/app/.heroku/python/lib
PATH=/app/.heroku/python/pipenv/bin:/app/.heroku/python/bin:/usr/local/bin:/usr/bin:/bin:/app/.sprettur/bin/
PIPENV_SYSTEM=1
PIPENV_VERBOSITY=-1
PKG_CONFIG_PATH=/app/.heroku/python/lib/pkg-config
PYTHONUNBUFFERED=1
VIRTUAL_ENV=/app/.heroku/python
-----> Saving cache

! Note: We recently added support for the package manager uv:
Expand All @@ -145,11 +143,9 @@
LIBRARY_PATH=/app/.heroku/python/lib
PATH=/app/.heroku/python/bin:/app/.heroku/python/pipenv/bin:/usr/local/bin:/usr/bin:/bin:/app/.sprettur/bin/
PIPENV_SYSTEM=1
PIPENV_VERBOSITY=-1
PYTHONHOME=/app/.heroku/python
PYTHONPATH=/app
PYTHONUNBUFFERED=true
VIRTUAL_ENV=/app/.heroku/python
-----> No test-setup command provided. Skipping.
-----> Running test command `./bin/print-env-vars.sh && pytest --version`...
CI=true
Expand All @@ -161,11 +157,9 @@
LIBRARY_PATH=/app/.heroku/python/lib
PATH=/app/.heroku/python/bin:/app/.heroku/python/pipenv/bin:/usr/local/bin:/usr/bin:/bin:/app/.sprettur/bin/:/app/.sprettur/bin/
PIPENV_SYSTEM=1
PIPENV_VERBOSITY=-1
PYTHONHOME=/app/.heroku/python
PYTHONPATH=/app
PYTHONUNBUFFERED=true
VIRTUAL_ENV=/app/.heroku/python
WEB_CONCURRENCY=5
pytest .+
-----> test command `./bin/print-env-vars.sh && pytest --version` completed successfully
Expand Down
43 changes: 22 additions & 21 deletions spec/hatchet/pipenv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@
remote: LIBRARY_PATH=/app/.heroku/python/lib
remote: PATH=/app/.heroku/python/pipenv/bin:/app/.heroku/python/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
remote: PIPENV_SYSTEM=1
remote: PIPENV_VERBOSITY=-1
remote: PKG_CONFIG_PATH=/app/.heroku/python/lib/pkg-config
remote: PYTHONUNBUFFERED=1
remote: VIRTUAL_ENV=/app/.heroku/python
remote: -----> Saving cache
remote:
remote: ! Note: We recently added support for the package manager uv:
Expand All @@ -49,11 +47,9 @@
remote: LIBRARY_PATH=/app/.heroku/python/lib
remote: PATH=/app/.heroku/python/bin:/app/.heroku/python/pipenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
remote: PIPENV_SYSTEM=1
remote: PIPENV_VERBOSITY=-1
remote: PYTHONHOME=/app/.heroku/python
remote: PYTHONPATH=/app
remote: PYTHONUNBUFFERED=true
remote: VIRTUAL_ENV=/app/.heroku/python
remote:
remote: \\['',
remote: '/app',
Expand Down Expand Up @@ -119,11 +115,9 @@
LIBRARY_PATH=/app/.heroku/python/lib
PATH=/app/.heroku/python/bin:/app/.heroku/python/pipenv/bin:/usr/local/bin:/usr/bin:/bin
PIPENV_SYSTEM=1
PIPENV_VERBOSITY=-1
PYTHONHOME=/app/.heroku/python
PYTHONPATH=/app
PYTHONUNBUFFERED=true
VIRTUAL_ENV=/app/.heroku/python
WEB_CONCURRENCY=2
pipenv, version #{PIPENV_VERSION}
OUTPUT
Expand Down Expand Up @@ -455,8 +449,7 @@
end
end

# TODO: Rename this test description back this when the Pipenv version next changes.
context 'when the Python version has changed since the last build' do
context 'when the Pipenv and Python versions have changed since the last build' do
let(:buildpacks) { ['https://github.com/heroku/heroku-buildpack-python#v313'] }
let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_basic', buildpacks:) }

Expand All @@ -471,6 +464,7 @@
remote: -----> Using Python 3.14 specified in Pipfile.lock
remote: -----> Discarding cache since:
remote: - The Python version has changed from 3.14.0 to #{LATEST_PYTHON_3_14}
remote: - The Pipenv version has changed from 2025.0.4 to #{PIPENV_VERSION}
remote: -----> Installing Python #{LATEST_PYTHON_3_14}
remote: -----> Installing Pipenv #{PIPENV_VERSION}
remote: -----> Installing dependencies using 'pipenv install --deploy'
Expand Down Expand Up @@ -560,21 +554,28 @@
end
end

# This is disabled since it's currently broken upstream: https://github.com/pypa/pipenv/issues/6403
# This tests that Pipenv doesn't fall back to system Python if the Python version in
# pyproject.toml doesn't match that in Pipfile / Pipfile.lock.
# context 'when requires-python in pyproject.toml is incompatible with .python-version' do
# let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_mismatched_python_version', allow_failure: true) }
#
# it 'fails the build' do
# app.deploy do |app|
# expect(clean_output(app.output)).to include(<<~OUTPUT)
# remote: -----> Installing dependencies using 'pipenv install --deploy'
# remote: <TODO whatever error message Pipenv displays if they fix their bug>
# OUTPUT
# end
# end
# end
context 'when requires-python in pyproject.toml is incompatible with .python-version' do
let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_mismatched_python_version', allow_failure: true) }

it 'fails the build' do
app.deploy do |app|
expect(clean_output(app.output)).to include(<<~OUTPUT)
remote: -----> Installing dependencies using 'pipenv install --deploy'
remote: Warning: Your Pipfile requires "python_version" 3.12, but you are using #{LATEST_PYTHON_3_13}
remote: from //app/./python/bin/python3.
remote: Usage: pipenv install [OPTIONS] [PACKAGES]...
remote:
remote: ERROR:: Aborting deploy
remote:
remote: ! Error: Unable to install dependencies using Pipenv.
remote: !
remote: ! See the log output above for more information.
OUTPUT
end
end
end

# This tests not only our handling of failing dependency installation, but also that we're running
# Pipenv in such a way that it errors if the lockfile is out of sync, rather than simply updating it.
Expand Down