-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Functions Framework buildpack fails when .venv
folder is present in the repo
#303
Comments
#301 (reply in thread) |
But how is that thread related to this one? Is it a requirement to always exclude local virtual env? The problem is that there is a compileall with a |
Sorry for the categorization whiplash, if its an issue with the functions framework buildpack our team might have to dive deeper into it |
The one described in this issue probably is. The exclude/include thing we're discussing here #301 is not directly related. |
any updates? |
Hi @xSAVIKx, I just looked through the buildpack and it seems like this behavior is intentional. We're compiling all the source code that's provided to ensure that any code that's potentially reachable at runtime is syntactically valid. We currently expect that you will only provide the bulidpack with source code that's relevant to the running of your function and would exclude the rest. Can you help us understand more about your use-case here so we can try to come up with an appropriate solution? Thanks! |
@josephlewis42, thx for checking this. The problem is that libraries sometimes bring their test code with them and test code may intentionally have invalid code that is run and tested in a controlled environment. This particular problem we've seen with the Functions Framework. The one that was built by the Google teams for cloud functions and it was failing to compile while they had intentionally wrong code in the tests. |
Describe the bug
While using a local
.venv
folder the buildpack fails to complete thepython3 -m compileall -f -q .
command with the following errors:Additional context
How are you using GCP buildpacks?
pack
and thegcr.io/buildpacks/builder
What language is your project primarily written in?
Python
Steps To Reproduce
Steps to reproduce the behavior:
git clone https://github.com/xSAVIKx/python-functions-cloud-run-buildpacks.git
cd python-functions-cloud-run-buildpacks
poetry install
./build.sh
Or just see the GH build here: https://github.com/xSAVIKx/python-functions-cloud-run-buildpacks/actions/runs/4957968805/jobs/8870285151
Expected behavior
The build completes successfully.
Actual behavior
The buildpack fails to compile files that do not belong to the build scope and are not accessible.
Similar problem happens when e.g. you have a source package with some on-purpose invalid Python code in the tests. The
compileall
tries to compile an invalid Python file from the tests and this makes the whole build fail as well.The text was updated successfully, but these errors were encountered: