[python] Use pip --upgrade when installing function dependencies (#6683)

Co-authored-by: Steven <steven@ceriously.com>
This commit is contained in:
Noa
2021-09-08 12:54:03 -05:00
committed by GitHub
parent e8fec4b69c
commit 38503103c3
4 changed files with 28 additions and 1 deletions

View File

@@ -86,6 +86,10 @@ interface InstallRequirementArg {
args?: string[];
}
// note that any internal dependency that vc_init.py requires that's installed
// with this function can get overriden by a newer version from requirements.txt,
// so vc_init should do runtime version checks to be compatible with any recent
// version of its dependencies
export async function installRequirement({
dependency,
version,
@@ -120,5 +124,5 @@ export async function installRequirementsFile({
debug(`Skipping requirements file installation, already installed`);
return;
}
await pipInstall(workPath, ['-r', filePath, ...args]);
await pipInstall(workPath, ['--upgrade', '-r', filePath, ...args]);
}

View File

@@ -0,0 +1,11 @@
import werkzeug
from flask import Flask
app = Flask(__name__)
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def main(path):
return werkzeug.__version__
if __name__ == '__main__':
app.run(debug=True, port=8002)

View File

@@ -0,0 +1,2 @@
flask==2.0.1
werkzeug==2.0.1

View File

@@ -0,0 +1,10 @@
{
"version": 2,
"builds": [{ "src": "api/*.py", "use": "@vercel/python" }],
"probes": [
{
"path": "/api/werkzeug_version.py",
"mustContain": "2.0.1"
}
]
}