Skip to content

Commit

Permalink
upgrade runtime to python 3.10 (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
pr-Mais committed Oct 8, 2022
1 parent 91d2cca commit 81e2dcd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/deploy/functions/runtimes/index.ts
Expand Up @@ -12,7 +12,7 @@ const RUNTIMES: string[] = ["nodejs10", "nodejs12", "nodejs14", "nodejs16"];
// Experimental runtimes are part of the Runtime type, but are in a
// different list to help guard against some day accidentally iterating over
// and printing a hidden runtime to the user.
const EXPERIMENTAL_RUNTIMES = ["go113", "python39"];
const EXPERIMENTAL_RUNTIMES = ["go113", "python310"];
export type Runtime = typeof RUNTIMES[number] | typeof EXPERIMENTAL_RUNTIMES[number];

/** Runtimes that can be found in existing backends but not used for new functions. */
Expand All @@ -38,6 +38,7 @@ const MESSAGE_FRIENDLY_RUNTIMES: Record<Runtime | DeprecatedRuntime, string> = {
nodejs16: "Node.js 16",
go113: "Go 1.13",
python39: "Python 3.9",
python310: "Python 3.10",
};

/**
Expand Down
6 changes: 3 additions & 3 deletions src/deploy/functions/runtimes/python/index.ts
Expand Up @@ -12,7 +12,7 @@ import * as discovery from "../discovery";
import { FirebaseError } from "../../../../error";
import { Build } from "../../build";

export const LATEST_VERSION: runtimes.Runtime = "python39";
export const LATEST_VERSION: runtimes.Runtime = "python310";

export const PYVENV = "venv";

Expand Down Expand Up @@ -77,7 +77,7 @@ class Delegate implements runtimes.RuntimeDelegate {
if (!this.modulesDir_) {
const out = await runWithVirtualEnv(
[
"python3.9",
"python3.10",
"-c",
"'import firebase_functions; import os; print(os.path.dirname(firebase_functions.__file__))'",
],
Expand Down Expand Up @@ -112,7 +112,7 @@ class Delegate implements runtimes.RuntimeDelegate {
...envs,
ADMIN_PORT: port.toString(),
};
const args = ["python3.9", path.join(modulesDir, "serving.py")];
const args = ["python3.10", path.join(modulesDir, "serving.py")];
logger.debug(
`Running admin server with args: ${JSON.stringify(args)} and env: ${JSON.stringify(
envWithAdminPort
Expand Down
4 changes: 2 additions & 2 deletions src/init/features/functions/python.ts
Expand Up @@ -29,7 +29,7 @@ export async function setup(_setup: unknown, config: Config): Promise<void> {
config.set("functions.ignore", ["venv", "__pycache__"]);
// Setup VENV.
await runWithVirtualEnv(
["python3.9", "-m", "venv", "venv"],
["python3.10", "-m", "venv", "venv"],
config.path(Config.DEFAULT_FUNCTIONS_SOURCE),
false
).promise;
Expand All @@ -41,7 +41,7 @@ export async function setup(_setup: unknown, config: Config): Promise<void> {
).promise;
// Install dependencies.
await runWithVirtualEnv(
["python3.9", "-m", "pip", "install", "-r", "requirements.txt"],
["python3.10", "-m", "pip", "install", "-r", "requirements.txt"],
config.path(Config.DEFAULT_FUNCTIONS_SOURCE)
).promise;
}

0 comments on commit 81e2dcd

Please sign in to comment.