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
Describe the bug
The way that Pants installs into a Google Cloud function is incorrect, and leads to versioning issues. Specifically, Pants does its normal thing of packaging up all of the dependencies into a package in the dist directory, which can then be uploaded to gcloud and used in the deploy. However, what should be done is only package first-party dependencies, and for everything else, create a requirements.txt and put it into the same directory as the one holding the function, and let GCF manage the dependencies (see their docs).
Because this isn't done, other dependencies that are installed by default into the pip environment are used instead of Pants dependencies, so for the set of packages that GCF install automatically, the wrong version will be used. This results in bugs ranging in severity up to not being able to start the GCF function due to unexpected incompatibilities.
Pants version
Which version of Pants are you using?
2.21.0
OS
Are you encountering the bug on MacOS, Linux, or both?
Mac OS
Additional info
Add any other information about the problem here, such as attachments or links to gists, if relevant.
The text was updated successfully, but these errors were encountered:
it is frustrating/confusing to me that the system libraries would take precedence over the user-supplied ones 😦
for supply chain assurance, it'd be good to include --hashes in the requirements file... but this may interfere with some types of dependencies (eg git repos)
I think, unfortunately, always putting all third party dependencies into a requirements file, may inhibit some use cases, like private repositories (git or PyPI-indices), where someone can't (or doesn't want to) get GCF configured with secrets to read them... so we may need customisation and control about what goes into the requirements file.
Note: I only have direct experience with Lambda, not GCF, so these thoughts could easily be wrong.
I did manage to workaround this by setting PYTHONPATH="." in my GCF. That should work with how Pants does things, but let me know if I'm missing something.
Describe the bug
The way that Pants installs into a Google Cloud function is incorrect, and leads to versioning issues. Specifically, Pants does its normal thing of packaging up all of the dependencies into a package in the
dist
directory, which can then be uploaded to gcloud and used in the deploy. However, what should be done is only package first-party dependencies, and for everything else, create arequirements.txt
and put it into the same directory as the one holding the function, and let GCF manage the dependencies (see their docs).Because this isn't done, other dependencies that are installed by default into the pip environment are used instead of Pants dependencies, so for the set of packages that GCF install automatically, the wrong version will be used. This results in bugs ranging in severity up to not being able to start the GCF function due to unexpected incompatibilities.
Pants version
Which version of Pants are you using?
2.21.0
OS
Are you encountering the bug on MacOS, Linux, or both?
Mac OS
Additional info
Add any other information about the problem here, such as attachments or links to gists, if relevant.
The text was updated successfully, but these errors were encountered: