Skip to content

Commit

Permalink
Misc edits.
Browse files Browse the repository at this point in the history
  • Loading branch information
taeold committed Jan 18, 2023
1 parent cfabe36 commit 4fbf060
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 3 additions & 9 deletions src/deploy/functions/runtimes/python/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,14 @@ import { Build } from "../../build";
const LATEST_VERSION: runtimes.Runtime = "python310";

/**
* This function is used to create a runtime delegate for the Python runtime.
* Create a runtime delegate for the Python runtime, if applicable.
*
* @param context runtimes.DelegateContext
* @return Delegate Python runtime delegate
*/
export async function tryCreateDelegate(
context: runtimes.DelegateContext
): Promise<Delegate | undefined> {
// TODO this can be done better by passing Options to tryCreateDelegate and
// reading the "functions.source" and ""functions.runtime" values from there
// to determine the runtime. For the sake of keeping changes to python only
// this has not been done for now.
const requirementsTextPath = path.join(context.sourceDir, "requirements.txt");

if (!(await promisify(fs.exists)(requirementsTextPath))) {
Expand Down Expand Up @@ -102,14 +99,11 @@ class Delegate implements runtimes.RuntimeDelegate {
return Promise.resolve();
}

// Watch isn't supported for Python.
watch(): Promise<() => Promise<void>> {
return Promise.resolve(() => Promise.resolve());
}

async build(): Promise<void> {
// No-op.
}
async build(): Promise<void> {}

async serveAdmin(port: number, envs: backend.EnvironmentVariables): Promise<() => Promise<void>> {
const modulesDir = await this.modulesDir();
Expand Down
2 changes: 1 addition & 1 deletion src/functions/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function runWithVirtualEnv(
return spawn(command, args, {
shell: true,
cwd,
stdio: [/* stdin= */ "ignore", /* stdout= */ "pipe", /* stderr= */ "inherit"],
stdio: [/* stdin= */ "ignore", /* stdout= */ "pipe", /* stderr= */ "pipe"],
// Linting disabled since internal types expect NODE_ENV which does not apply to Python runtimes.
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
env: envs as any,
Expand Down

0 comments on commit 4fbf060

Please sign in to comment.