diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-06-30 22:09:26 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-06-30 22:09:26 -0700 |
commit | ae32caa515ee6926358118e4a7d40e2e78604b20 (patch) | |
tree | b1ea5131737a45269a0defe8aaa454c9d4b0fde2 | |
parent | 0d7223825009571f90465af2aa07b99910b86cb0 (diff) | |
download | sncontinue-ae32caa515ee6926358118e4a7d40e2e78604b20.tar.gz sncontinue-ae32caa515ee6926358118e4a7d40e2e78604b20.tar.bz2 sncontinue-ae32caa515ee6926358118e4a7d40e2e78604b20.zip |
check for secondary installed python versions
-rw-r--r-- | continuedev/src/continuedev/.gitignore | 1 | ||||
-rw-r--r-- | continuedev/src/continuedev/core/autopilot.py | 2 | ||||
-rw-r--r-- | continuedev/src/continuedev/steps/core/core.py | 4 | ||||
-rw-r--r-- | extension/src/activation/environmentSetup.ts | 30 |
4 files changed, 29 insertions, 8 deletions
diff --git a/continuedev/src/continuedev/.gitignore b/continuedev/src/continuedev/.gitignore new file mode 100644 index 00000000..13bafb25 --- /dev/null +++ b/continuedev/src/continuedev/.gitignore @@ -0,0 +1 @@ +.continue diff --git a/continuedev/src/continuedev/core/autopilot.py b/continuedev/src/continuedev/core/autopilot.py index 3beebbf0..3c7fbdef 100644 --- a/continuedev/src/continuedev/core/autopilot.py +++ b/continuedev/src/continuedev/core/autopilot.py @@ -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) diff --git a/continuedev/src/continuedev/steps/core/core.py b/continuedev/src/continuedev/steps/core/core.py index f59ef33c..a84263cc 100644 --- a/continuedev/src/continuedev/steps/core/core.py +++ b/continuedev/src/continuedev/steps/core/core.py @@ -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 diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index 1593153c..d4c81d2e 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -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]; |