You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the buildpack skips re-running pipenv install for repeat builds iff (a) the SHA256 of the Pipfile.lock file has not changed since the last successful build, and (b) the Pipfile.lock file does not contain git references:
Since editable = false the local package will be copied into site-packages on the initial build (rather than the original source linked via a .pth file, as happens for editable installs). And then on subsequent builds if no other changes have been made to Pipfile.lock, the pipenv install step will be skipped, even though changes could have been made to files under packages/mypackage/.
(Note: The above is assuming a Pipenv version is being used that is not affected by the regression pypa/pipenv#6054, since otherwise the install will be editable regardless of editable = false)
Whilst we could add "editable" as another property to check within the Pipfile.lock file:
there may also be other cases where it's not safe to assume pipenv install is a no-op (either currently, or in the future as pipenv evolves)
Ultimately, any optimisation strategy here requires us to make assumptions about pipenv implementation details, and hardcode some of those details in the buildpack, which isn't ideal.
As such, I think we should instead always run pipenv install, and defer to pipenv itself to make the determination as to whether any changes are required. Pipenv install should not take too long to run if there are no changes required (and if it does, that's an upstream bug that pipenv should fix, and not something we should hack around and risk environment correctness issues).
Previously the buildpack would skip running `pipenv install` for repeat
Pipenv builds if (a) the SHA256 of the `Pipfile.lock` file had not changed
since the last successful build, and (b) there were no Git VCS references
in the lockfile.
However, this has a few issues:
1. There are other cases where it's not safe to assume that there is no
need to re-run `pipenv install`, such as when installing a non-editable
local dependency (see #1525), or when using editable local dependencies
with the current path re-writing strategy (see #1520).
2. The current Git VCS check has false positives (see #1130, #1398).
3. Even if we try and add more checks/workarounds to resolve (1) and (2),
we're still having to make assumptions about internal Pipenv implementation
details, and hardcode these in the buildpack, hoping we didn't miss anything
and that Pipenv's behaviour doesn't change over time (which is not the case,
as seen by the recent regression pypa/pipenv#6054)
As such, we now instead always re-run `pipenv install`, and defer to Pipenv to
decide whether the environment needs updating.
This should still be fast, since the cached `site-packages` is still being used (and
if there are any scenarios in which it's not fast, then that's an upstream Pipenv
bug).
Integration tests were also added for various types of editable Pipenv installs,
since we previously only had test coverage of editable installs for Pip.
Fixes#1520.
Fixes#1525.
Closes#1130.
Closes#1398.
Currently the buildpack skips re-running
pipenv install
for repeat builds iff (a) the SHA256 of thePipfile.lock
file has not changed since the last successful build, and (b) thePipfile.lock
file does not containgit
references:heroku-buildpack-python/bin/steps/pipenv
Lines 9 to 22 in d1ca05a
However, there are other cases where
pipenv install
still needs to be run.For example, imagine a
Pipfile
containing:Since
editable = false
the local package will be copied intosite-packages
on the initial build (rather than the original source linked via a.pth
file, as happens for editable installs). And then on subsequent builds if no other changes have been made toPipfile.lock
, thepipenv install
step will be skipped, even though changes could have been made to files underpackages/mypackage/
.(Note: The above is assuming a Pipenv version is being used that is not affected by the regression pypa/pipenv#6054, since otherwise the install will be editable regardless of
editable = false
)Whilst we could add "editable" as another property to check within the
Pipfile.lock
file:git
check unless we resort to properly parsing the file (xref pipenv cache is skipped when it should not be #1398)pipenv install
is a no-op (either currently, or in the future as pipenv evolves)Ultimately, any optimisation strategy here requires us to make assumptions about pipenv implementation details, and hardcode some of those details in the buildpack, which isn't ideal.
As such, I think we should instead always run
pipenv install
, and defer to pipenv itself to make the determination as to whether any changes are required. Pipenv install should not take too long to run if there are no changes required (and if it does, that's an upstream bug that pipenv should fix, and not something we should hack around and risk environment correctness issues).GUS-W-14762837.
The text was updated successfully, but these errors were encountered: