check for secondary installed python versions

This commit is contained in:
Nate Sesti 2023-06-30 22:09:26 -07:00
parent 1d97c9c76e
commit b72285f11c
4 changed files with 29 additions and 8 deletions

View file

@ -0,0 +1 @@
.continue

View file

@ -184,7 +184,7 @@ class Autopilot(ContinueBaseModel):
is_continue_custom_exception = issubclass(
e.__class__, ContinueCustomException)
error_string = e.message if is_continue_custom_exception else '\n\n'.join(
error_string = e.message if is_continue_custom_exception else '\n'.join(
traceback.format_tb(e.__traceback__)) + f"\n\n{e.__repr__()}"
error_title = e.title if is_continue_custom_exception else get_error_title(
e)

View file

@ -157,7 +157,7 @@ class DefaultModelEditCodeStep(Step):
async def describe(self, models: Models) -> Coroutine[str, None, None]:
description = await models.gpt3516k.complete(
f"{self._prompt_and_completion}\n\nPlease give brief a description of the changes made above using markdown bullet points. Be concise and only mention changes made to the commit before, not prefix or suffix:")
self.name = await models.gpt3516k.complete(f"Write a very short title to describe this requested change: '{self.user_input}'. This is the title:")
self.name = await models.gpt3516k.complete(f"Write a very short title to describe this requested change (no quotes): '{self.user_input}'. This is the title:")
# Remove quotes from title and description if they are wrapped
if description.startswith('"') and description.endswith('"'):
@ -244,7 +244,7 @@ class DefaultModelEditCodeStep(Step):
file_suffix = "\n" + file_suffix
rif.contents = rif.contents[:-1]
return file_prefix, rif.contents, file_suffix, model_to_use
return file_prefix, rif.contents, file_suffix, model_to_use
def compile_prompt(self, file_prefix: str, contents: str, file_suffix: str, sdk: ContinueSDK) -> str:
prompt = self._prompt

View file

@ -67,17 +67,37 @@ async function getPythonPipCommands() {
vscode.window.showErrorMessage(
"Continue requires Python3. Please install from https://www.python.org/downloads, reload VS Code, and try again."
);
throw new Error("Python 3.7 or greater is not installed.");
throw new Error("Python 3 is not installed.");
}
}
const version = stdout.split(" ")[1];
const [major, minor] = version.split(".");
if (parseInt(major) !== 3 || parseInt(minor) < 7) {
vscode.window.showErrorMessage(
"Continue requires Python3 version 3.7 or greater. Please update your Python3 installation, reload VS Code, and try again."
);
throw new Error("Python3 is not installed.");
// Need to check specific versions
const checkPython3VersionExists = async (minorVersion: number) => {
const [stdout, stderr] = await runCommand(
`python3.${minorVersion} --version`
);
return typeof stderr === "undefined" || stderr === "";
};
const validVersions = [7, 8, 9, 10, 11, 12];
let versionExists = false;
for (const minorVersion of validVersions) {
if (await checkPython3VersionExists(minorVersion)) {
versionExists = true;
break;
}
}
if (!versionExists) {
vscode.window.showErrorMessage(
"Continue requires Python3 version 3.7 or greater. Please update your Python3 installation, reload VS Code, and try again."
);
throw new Error("Python3 is not installed.");
}
}
const pipCmd = pythonCmd.endsWith("3") ? "pip3" : "pip";
return [pythonCmd, pipCmd];