From 44a82caaa650ef74194a1d782e2520cb649440cb Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 31 Jul 2023 20:10:41 -0700 Subject: testing nuitka, pyoxidizer, pyinstaller --- .github/workflows/main.yaml | 175 ++++++++++++++++++++++++++------------------ 1 file changed, 105 insertions(+), 70 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 9d9eb186..509faec4 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -6,77 +6,112 @@ on: - main jobs: - do-nothing: + nuitka-build: + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + + runs-on: ${{ matrix.os }} + + steps: + - name: Check-out repository + uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" # Version range or exact version of a Python version to use, using SemVer's version range syntax + architecture: "x64" # optional x64 or x86. Defaults to x64 if not specified + cache: "pip" + cache-dependency-path: | + **/requirements*.txt + + - name: Install Dependencies + run: | + pip install -r requirements.txt + + - name: Build Executable + uses: Nuitka/Nuitka-Action@main + with: + nuitka-version: main + script-name: kasa_cli + onefile: true + + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: ${{ runner.os }} Build + path: | + build/*.exe + build/*.bin + build/*.app/**/* + + publish: runs-on: ubuntu-latest + steps: - name: Checkout uses: actions/checkout@v2 - # publish: - # runs-on: ubuntu-latest - - # steps: - # - name: Checkout - # uses: actions/checkout@v2 - - # - name: Set up Python - # uses: actions/setup-python@v2 - # with: - # python-version: "3.8" - - # - name: Install Poetry - # run: | - # curl -sSL https://install.python-poetry.org | python3 - - - # - name: Install Python dependencies - # run: | - # cd continuedev - # poetry install - - # - name: Cache extension node_modules - # uses: actions/cache@v2 - # with: - # path: extension/node_modules - # key: ${{ runner.os }}-node-${{ hashFiles('extension/package-lock.json') }} - - # - name: Cache react-app node_modules - # uses: actions/cache@v2 - # with: - # path: extension/react-app/node_modules - # key: ${{ runner.os }}-node-${{ hashFiles('extension/react-app/package-lock.json') }} - - # - name: Set up Node.js - # uses: actions/setup-node@v2 - # with: - # node-version: "14" - - # - name: Install extension Dependencies - # run: | - # cd extension - # npm ci --legacy-peer-deps - - # - name: Install react-app Dependencies - # run: | - # cd extension/react-app - # npm ci --legacy-peer-deps - - # - name: Build and Publish - # run: | - # cd extension - # npm run full-package - - # - name: Commit changes - # run: | - # git config --local user.email "action@github.com" - # git config --local user.name "GitHub Action" - # git commit -am "Update package.json version [skip ci]" - - # - name: Push changes - # uses: ad-m/github-push-action@master - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - - # - name: Upload .vsix artifact - # uses: actions/upload-artifact@v2 - # with: - # name: vsix-artifact - # path: extension/build/* + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.8" + + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + + - name: Install Python dependencies + run: | + cd continuedev + poetry install + + - name: Cache extension node_modules + uses: actions/cache@v2 + with: + path: extension/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('extension/package-lock.json') }} + + - name: Cache react-app node_modules + uses: actions/cache@v2 + with: + path: extension/react-app/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('extension/react-app/package-lock.json') }} + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: "14" + + - name: Install extension Dependencies + run: | + cd extension + npm ci --legacy-peer-deps + + - name: Install react-app Dependencies + run: | + cd extension/react-app + npm ci --legacy-peer-deps + + - name: Build and Publish + run: | + cd extension + npm run full-package + + - name: Commit changes + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git commit -am "Update package.json version [skip ci]" + + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload .vsix artifact + uses: actions/upload-artifact@v2 + with: + name: vsix-artifact + path: extension/build/* -- cgit v1.2.3-70-g09d2 From fa221af037ced05018b6441575b7e22b5d6902a8 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 31 Jul 2023 20:11:43 -0700 Subject: run workflow on this branch --- .github/workflows/main.yaml | 139 ++++++++++++++++++++++---------------------- 1 file changed, 70 insertions(+), 69 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 509faec4..6642d5c0 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -4,6 +4,7 @@ on: push: branches: - main + - package-python jobs: nuitka-build: @@ -46,72 +47,72 @@ jobs: build/*.bin build/*.app/**/* - publish: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.8" - - - name: Install Poetry - run: | - curl -sSL https://install.python-poetry.org | python3 - - - - name: Install Python dependencies - run: | - cd continuedev - poetry install - - - name: Cache extension node_modules - uses: actions/cache@v2 - with: - path: extension/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('extension/package-lock.json') }} - - - name: Cache react-app node_modules - uses: actions/cache@v2 - with: - path: extension/react-app/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('extension/react-app/package-lock.json') }} - - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: "14" - - - name: Install extension Dependencies - run: | - cd extension - npm ci --legacy-peer-deps - - - name: Install react-app Dependencies - run: | - cd extension/react-app - npm ci --legacy-peer-deps - - - name: Build and Publish - run: | - cd extension - npm run full-package - - - name: Commit changes - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git commit -am "Update package.json version [skip ci]" - - - name: Push changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - - - name: Upload .vsix artifact - uses: actions/upload-artifact@v2 - with: - name: vsix-artifact - path: extension/build/* + # publish: + # runs-on: ubuntu-latest + + # steps: + # - name: Checkout + # uses: actions/checkout@v2 + + # - name: Set up Python + # uses: actions/setup-python@v2 + # with: + # python-version: "3.8" + + # - name: Install Poetry + # run: | + # curl -sSL https://install.python-poetry.org | python3 - + + # - name: Install Python dependencies + # run: | + # cd continuedev + # poetry install + + # - name: Cache extension node_modules + # uses: actions/cache@v2 + # with: + # path: extension/node_modules + # key: ${{ runner.os }}-node-${{ hashFiles('extension/package-lock.json') }} + + # - name: Cache react-app node_modules + # uses: actions/cache@v2 + # with: + # path: extension/react-app/node_modules + # key: ${{ runner.os }}-node-${{ hashFiles('extension/react-app/package-lock.json') }} + + # - name: Set up Node.js + # uses: actions/setup-node@v2 + # with: + # node-version: "14" + + # - name: Install extension Dependencies + # run: | + # cd extension + # npm ci --legacy-peer-deps + + # - name: Install react-app Dependencies + # run: | + # cd extension/react-app + # npm ci --legacy-peer-deps + + # - name: Build and Publish + # run: | + # cd extension + # npm run full-package + + # - name: Commit changes + # run: | + # git config --local user.email "action@github.com" + # git config --local user.name "GitHub Action" + # git commit -am "Update package.json version [skip ci]" + + # - name: Push changes + # uses: ad-m/github-push-action@master + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + + # - name: Upload .vsix artifact + # uses: actions/upload-artifact@v2 + # with: + # name: vsix-artifact + # path: extension/build/* -- cgit v1.2.3-70-g09d2 From e18df47cee14cde58584ffc1a8bbb2606b6f4102 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 31 Jul 2023 22:27:08 -0700 Subject: ci: :green_heart: fix file structure for pyinstaller, main.yaml updates --- .github/workflows/main.yaml | 27 ++++++++++++++-------- continuedev/main.py | 5 ++++ .../src/continuedev/libs/util/count_tokens.py | 1 + continuedev/src/run.py | 4 ---- run.py | 4 ++++ 5 files changed, 28 insertions(+), 13 deletions(-) create mode 100644 continuedev/main.py delete mode 100644 continuedev/src/run.py create mode 100644 run.py (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 6642d5c0..1d5f2cbc 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -18,14 +18,23 @@ jobs: - name: Check-out repository uses: actions/checkout@v3 - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: "3.10" # Version range or exact version of a Python version to use, using SemVer's version range syntax - architecture: "x64" # optional x64 or x86. Defaults to x64 if not specified - cache: "pip" - cache-dependency-path: | - **/requirements*.txt + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + + - name: Install Python dependencies + run: | + cd continuedev + poetry install + + # - name: Setup Python + # uses: actions/setup-python@v4 + # with: + # python-version: "3.10" # Version range or exact version of a Python version to use, using SemVer's version range syntax + # architecture: "x64" # optional x64 or x86. Defaults to x64 if not specified + # cache: "pip" + # cache-dependency-path: | + # **/requirements*.txt - name: Install Dependencies run: | @@ -35,7 +44,7 @@ jobs: uses: Nuitka/Nuitka-Action@main with: nuitka-version: main - script-name: kasa_cli + script-name: continuedev/src/run.py onefile: true - name: Upload Artifacts diff --git a/continuedev/main.py b/continuedev/main.py new file mode 100644 index 00000000..3cf4e817 --- /dev/null +++ b/continuedev/main.py @@ -0,0 +1,5 @@ +from .src.continuedev.server.main import run_server + + +def main(): + run_server() diff --git a/continuedev/src/continuedev/libs/util/count_tokens.py b/continuedev/src/continuedev/libs/util/count_tokens.py index 6add7b1a..3b594036 100644 --- a/continuedev/src/continuedev/libs/util/count_tokens.py +++ b/continuedev/src/continuedev/libs/util/count_tokens.py @@ -3,6 +3,7 @@ from typing import Dict, List, Union from ...core.main import ChatMessage from .templating import render_templated_string from ...libs.llm import LLM +from tiktoken_ext import openai_public import tiktoken # TODO move many of these into specific LLM.properties() function that diff --git a/continuedev/src/run.py b/continuedev/src/run.py deleted file mode 100644 index 089cc54d..00000000 --- a/continuedev/src/run.py +++ /dev/null @@ -1,4 +0,0 @@ -from continuedev.server.main import run_server - -if __name__ == "__main__": - run_server() diff --git a/run.py b/run.py new file mode 100644 index 00000000..7160bbc7 --- /dev/null +++ b/run.py @@ -0,0 +1,4 @@ +from continuedev.main import main + +if __name__ == "__main__": + main() -- cgit v1.2.3-70-g09d2 From 78ada9b463a41260ccf53bbdc08b396ab9783ee2 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 31 Jul 2023 22:35:13 -0700 Subject: ci: :green_heart: pyinstaller to main.yaml --- .github/workflows/main.yaml | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 1d5f2cbc..edae444f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -7,7 +7,7 @@ on: - package-python jobs: - nuitka-build: + pyinstaller: strategy: matrix: os: [macos-latest, ubuntu-latest, windows-latest] @@ -18,6 +18,11 @@ jobs: - name: Check-out repository uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.8" + - name: Install Poetry run: | curl -sSL https://install.python-poetry.org | python3 - @@ -27,34 +32,15 @@ jobs: cd continuedev poetry install - # - name: Setup Python - # uses: actions/setup-python@v4 - # with: - # python-version: "3.10" # Version range or exact version of a Python version to use, using SemVer's version range syntax - # architecture: "x64" # optional x64 or x86. Defaults to x64 if not specified - # cache: "pip" - # cache-dependency-path: | - # **/requirements*.txt + - run: pip install -r requirements.txt pyinstaller - - name: Install Dependencies - run: | - pip install -r requirements.txt - - - name: Build Executable - uses: Nuitka/Nuitka-Action@main - with: - nuitka-version: main - script-name: continuedev/src/run.py - onefile: true + - run: pyinstaller run.py - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: ${{ runner.os }} Build - path: | - build/*.exe - build/*.bin - build/*.app/**/* + path: dist/* # publish: # runs-on: ubuntu-latest -- cgit v1.2.3-70-g09d2 From 4d5c6eb0799e1a0c1af8ee8203e39c9213d1c366 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 31 Jul 2023 22:44:22 -0700 Subject: ci: :green_heart: ci download with pip, not poetry --- .github/workflows/main.yaml | 18 ++++++----- continuedev/requirements.txt | 76 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 8 deletions(-) create mode 100644 continuedev/requirements.txt (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index edae444f..03113421 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -23,16 +23,18 @@ jobs: with: python-version: "3.8" - - name: Install Poetry - run: | - curl -sSL https://install.python-poetry.org | python3 - + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.8" + architecture: "x64" # optional x64 (default) or x86 + cache: "pip" + cache-dependency-path: | + **/requirements*.txt - - name: Install Python dependencies + - name: Install Dependencies run: | - cd continuedev - poetry install - - - run: pip install -r requirements.txt pyinstaller + pip install -r requirements.txt pyinstaller - run: pyinstaller run.py diff --git a/continuedev/requirements.txt b/continuedev/requirements.txt new file mode 100644 index 00000000..970681f9 --- /dev/null +++ b/continuedev/requirements.txt @@ -0,0 +1,76 @@ +aiofiles==23.1.0 +aiohttp==3.8.4 +aiosignal==1.3.1 +anthropic==0.3.4 +anyio==3.6.2 +async-timeout==4.0.2 +attrs==23.1.0 +backoff==2.2.1 +boltons==23.0.0 +camel-converter==3.0.2 +certifi==2022.12.7 +cffi==1.15.1 +charset-normalizer==3.1.0 +chevron==0.14.0 +click==8.1.3 +-e git+https://github.com/continuedev/continue.git@78ada9b463a41260ccf53bbdc08b396ab9783ee2#egg=continuedev&subdirectory=continuedev +cryptography==41.0.2 +dataclasses-json==0.5.7 +Deprecated==1.2.14 +diff-match-patch==20230430 +directory-tree==0.0.3.1 +distro==1.8.0 +fastapi==0.95.1 +frozenlist==1.3.3 +gpt-index==0.6.8 +h11==0.14.0 +httpcore==0.17.3 +httpx==0.24.1 +idna==3.4 +jsonref==1.1.0 +jsonschema==4.17.3 +langchain==0.0.171 +marshmallow==3.19.0 +marshmallow-enum==1.5.1 +meilisearch-python-async==1.4.8 +monotonic==1.6 +multidict==6.0.4 +mypy-extensions==1.0.0 +nest-asyncio==1.5.6 +numexpr==2.8.4 +numpy==1.24.3 +openai==0.27.6 +openapi-schema-pydantic==1.2.4 +packaging==23.1 +pandas==2.0.1 +posthog==3.0.1 +psutil==5.9.5 +pycparser==2.21 +pydantic==1.10.7 +PyGithub==1.59.0 +PyJWT==2.8.0 +PyNaCl==1.5.0 +pyrsistent==0.19.3 +python-dateutil==2.8.2 +python-dotenv==1.0.0 +pytz==2023.3 +PyYAML==6.0 +regex==2023.5.5 +requests==2.29.0 +six==1.16.0 +sniffio==1.3.0 +SQLAlchemy==2.0.13 +starlette==0.26.1 +tenacity==8.2.2 +tiktoken==0.4.0 +tokenizers==0.13.3 +tqdm==4.65.0 +typer==0.7.0 +typing-inspect==0.8.0 +typing_extensions==4.5.0 +tzdata==2023.3 +urllib3==1.26.15 +uvicorn==0.21.1 +websockets==11.0.2 +wrapt==1.15.0 +yarl==1.9.2 -- cgit v1.2.3-70-g09d2 From 1295cc00950c9c6b711fc82ef5492448a1be8caf Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 31 Jul 2023 22:45:35 -0700 Subject: fix requirements.txt path --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 03113421..26d0d768 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -34,7 +34,7 @@ jobs: - name: Install Dependencies run: | - pip install -r requirements.txt pyinstaller + pip install -r continuedev/requirements.txt pyinstaller - run: pyinstaller run.py -- cgit v1.2.3-70-g09d2 From 70eb274f51c703c352865b8af39557b271fae6dd Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 00:37:24 -0700 Subject: try cx_freeze, smaller pyinstaller --- .github/workflows/main.yaml | 2 +- continuedev/pyapp/pyoxidizer.bzl | 353 --------------------- continuedev/pyproject.toml | 2 - continuedev/requirements.txt | 88 +---- .../src/continuedev/libs/util/calculate_diff.py | 35 -- cxf.py | 14 + 6 files changed, 31 insertions(+), 463 deletions(-) delete mode 100644 continuedev/pyapp/pyoxidizer.bzl create mode 100644 cxf.py (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 26d0d768..41fd174d 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -36,7 +36,7 @@ jobs: run: | pip install -r continuedev/requirements.txt pyinstaller - - run: pyinstaller run.py + - run: pyinstaller run.py --exclude-module numpy --exclude-module jedi -F - name: Upload Artifacts uses: actions/upload-artifact@v3 diff --git a/continuedev/pyapp/pyoxidizer.bzl b/continuedev/pyapp/pyoxidizer.bzl deleted file mode 100644 index 943007ff..00000000 --- a/continuedev/pyapp/pyoxidizer.bzl +++ /dev/null @@ -1,353 +0,0 @@ -# This file defines how PyOxidizer application building and packaging is -# performed. See PyOxidizer's documentation at -# https://gregoryszorc.com/docs/pyoxidizer/stable/pyoxidizer.html for details -# of this configuration file format. - -# Configuration files consist of functions which define build "targets." -# This function creates a Python executable and installs it in a destination -# directory. -def make_exe(): - # Obtain the default PythonDistribution for our build target. We link - # this distribution into our produced executable and extract the Python - # standard library from it. - dist = default_python_distribution() - - # This function creates a `PythonPackagingPolicy` instance, which - # influences how executables are built and how resources are added to - # the executable. You can customize the default behavior by assigning - # to attributes and calling functions. - policy = dist.make_python_packaging_policy() - - # Enable support for non-classified "file" resources to be added to - # resource collections. - # policy.allow_files = True - - # Control support for loading Python extensions and other shared libraries - # from memory. This is only supported on Windows and is ignored on other - # platforms. - # policy.allow_in_memory_shared_library_loading = True - - # Control whether to generate Python bytecode at various optimization - # levels. The default optimization level used by Python is 0. - # policy.bytecode_optimize_level_zero = True - # policy.bytecode_optimize_level_one = True - # policy.bytecode_optimize_level_two = True - - # Package all available Python extensions in the distribution. - # policy.extension_module_filter = "all" - - # Package the minimum set of Python extensions in the distribution needed - # to run a Python interpreter. Various functionality from the Python - # standard library won't work with this setting! But it can be used to - # reduce the size of generated executables by omitting unused extensions. - # policy.extension_module_filter = "minimal" - - # Package Python extensions in the distribution not having additional - # library dependencies. This will exclude working support for SSL, - # compression formats, and other functionality. - # policy.extension_module_filter = "no-libraries" - - # Package Python extensions in the distribution not having a dependency on - # copyleft licensed software like GPL. - # policy.extension_module_filter = "no-copyleft" - - # Controls whether the file scanner attempts to classify files and emit - # resource-specific values. - # policy.file_scanner_classify_files = True - - # Controls whether `File` instances are emitted by the file scanner. - # policy.file_scanner_emit_files = False - - # Controls the `add_include` attribute of "classified" resources - # (`PythonModuleSource`, `PythonPackageResource`, etc). - # policy.include_classified_resources = True - - # Toggle whether Python module source code for modules in the Python - # distribution's standard library are included. - # policy.include_distribution_sources = False - - # Toggle whether Python package resource files for the Python standard - # library are included. - # policy.include_distribution_resources = False - - # Controls the `add_include` attribute of `File` resources. - # policy.include_file_resources = False - - # Controls the `add_include` attribute of `PythonModuleSource` not in - # the standard library. - # policy.include_non_distribution_sources = True - - # Toggle whether files associated with tests are included. - # policy.include_test = False - - # Resources are loaded from "in-memory" or "filesystem-relative" paths. - # The locations to attempt to add resources to are defined by the - # `resources_location` and `resources_location_fallback` attributes. - # The former is the first/primary location to try and the latter is - # an optional fallback. - - # Use in-memory location for adding resources by default. - # policy.resources_location = "in-memory" - - # Use filesystem-relative location for adding resources by default. - # policy.resources_location = "filesystem-relative:prefix" - - # Attempt to add resources relative to the built binary when - # `resources_location` fails. - # policy.resources_location_fallback = "filesystem-relative:prefix" - - # Clear out a fallback resource location. - # policy.resources_location_fallback = None - - # Define a preferred Python extension module variant in the Python distribution - # to use. - # policy.set_preferred_extension_module_variant("foo", "bar") - - # Configure policy values to classify files as typed resources. - # (This is the default.) - # policy.set_resource_handling_mode("classify") - - # Configure policy values to handle files as files and not attempt - # to classify files as specific types. - # policy.set_resource_handling_mode("files") - - # This variable defines the configuration of the embedded Python - # interpreter. By default, the interpreter will run a Python REPL - # using settings that are appropriate for an "isolated" run-time - # environment. - # - # The configuration of the embedded Python interpreter can be modified - # by setting attributes on the instance. Some of these are - # documented below. - python_config = dist.make_python_interpreter_config() - - # Make the embedded interpreter behave like a `python` process. - # python_config.config_profile = "python" - - # Set initial value for `sys.path`. If the string `$ORIGIN` exists in - # a value, it will be expanded to the directory of the built executable. - # python_config.module_search_paths = ["$ORIGIN/lib"] - - # Use jemalloc as Python's memory allocator. - # python_config.allocator_backend = "jemalloc" - - # Use mimalloc as Python's memory allocator. - # python_config.allocator_backend = "mimalloc" - - # Use snmalloc as Python's memory allocator. - # python_config.allocator_backend = "snmalloc" - - # Let Python choose which memory allocator to use. (This will likely - # use the malloc()/free() linked into the program. - # python_config.allocator_backend = "default" - - # Enable the use of a custom allocator backend with the "raw" memory domain. - # python_config.allocator_raw = True - - # Enable the use of a custom allocator backend with the "mem" memory domain. - # python_config.allocator_mem = True - - # Enable the use of a custom allocator backend with the "obj" memory domain. - # python_config.allocator_obj = True - - # Enable the use of a custom allocator backend with pymalloc's arena - # allocator. - # python_config.allocator_pymalloc_arena = True - - # Enable Python memory allocator debug hooks. - # python_config.allocator_debug = True - - # Automatically calls `multiprocessing.set_start_method()` with an - # appropriate value when OxidizedFinder imports the `multiprocessing` - # module. - # python_config.multiprocessing_start_method = 'auto' - - # Do not call `multiprocessing.set_start_method()` automatically. (This - # is the default behavior of Python applications.) - # python_config.multiprocessing_start_method = 'none' - - # Call `multiprocessing.set_start_method()` with explicit values. - # python_config.multiprocessing_start_method = 'fork' - # python_config.multiprocessing_start_method = 'forkserver' - # python_config.multiprocessing_start_method = 'spawn' - - # Control whether `oxidized_importer` is the first importer on - # `sys.meta_path`. - # python_config.oxidized_importer = False - - # Enable the standard path-based importer which attempts to load - # modules from the filesystem. - # python_config.filesystem_importer = True - - # Set `sys.frozen = False` - # python_config.sys_frozen = False - - # Set `sys.meipass` - # python_config.sys_meipass = True - - # Write files containing loaded modules to the directory specified - # by the given environment variable. - # python_config.write_modules_directory_env = "/tmp/oxidized/loaded_modules" - - # Evaluate a string as Python code when the interpreter starts. - python_config.run_command = "from continuedev.server.main import run_server; run_server()" - policy.resources_location_fallback = "filesystem-relative:prefix" - - # Run a Python module as __main__ when the interpreter starts. - # python_config.run_module = "" - - # Run a Python file when the interpreter starts. - # python_config.run_filename = "/path/to/file" - - # Produce a PythonExecutable from a Python distribution, embedded - # resources, and other options. The returned object represents the - # standalone executable that will be built. - exe = dist.to_python_executable( - name="pyapp", - - # If no argument passed, the default `PythonPackagingPolicy` for the - # distribution is used. - packaging_policy=policy, - - # If no argument passed, the default `PythonInterpreterConfig` is used. - config=python_config, - ) - - for resource in exe.pip_install(["../dist/continuedev-0.1.2-py3-none-any.whl"]): - resource.add_location = "in-memory" - exe.add_python_resource(resource) - - - - # Install tcl/tk support files to a specified directory so the `tkinter` Python - # module works. - # exe.tcl_files_path = "lib" - - # Never attempt to copy Windows runtime DLLs next to the built executable. - # exe.windows_runtime_dlls_mode = "never" - - # Copy Windows runtime DLLs next to the built executable when they can be - # located. - # exe.windows_runtime_dlls_mode = "when-present" - - # Copy Windows runtime DLLs next to the build executable and error if this - # cannot be done. - # exe.windows_runtime_dlls_mode = "always" - - # Make the executable a console application on Windows. - # exe.windows_subsystem = "console" - - # Make the executable a non-console application on Windows. - # exe.windows_subsystem = "windows" - - # Invoke `pip download` to install a single package using wheel archives - # obtained via `pip download`. `pip_download()` returns objects representing - # collected files inside Python wheels. `add_python_resources()` adds these - # objects to the binary, with a load location as defined by the packaging - # policy's resource location attributes. - #exe.add_python_resources(exe.pip_download(["pyflakes==2.2.0"])) - - # Invoke `pip install` with our Python distribution to install a single package. - # `pip_install()` returns objects representing installed files. - # `add_python_resources()` adds these objects to the binary, with a load - # location as defined by the packaging policy's resource location - # attributes. - #exe.add_python_resources(exe.pip_install(["appdirs"])) - - # Invoke `pip install` using a requirements file and add the collected resources - # to our binary. - #exe.add_python_resources(exe.pip_install(["-r", "requirements.txt"])) - - - # Read Python files from a local directory and add them to our embedded - # context, taking just the resources belonging to the `foo` and `bar` - # Python packages. - #exe.add_python_resources(exe.read_package_root( - # path="/src/mypackage", - # packages=["foo", "bar"], - #)) - - # Discover Python files from a virtualenv and add them to our embedded - # context. - #exe.add_python_resources(exe.read_virtualenv(path="/path/to/venv")) - - # Filter all resources collected so far through a filter of names - # in a file. - #exe.filter_resources_from_files(files=["/path/to/filter-file"]) - - # Return our `PythonExecutable` instance so it can be built and - # referenced by other consumers of this target. - return exe - -def make_embedded_resources(exe): - return exe.to_embedded_resources() - -def make_install(exe): - # Create an object that represents our installed application file layout. - files = FileManifest() - - # Add the generated executable to our install layout in the root directory. - files.add_python_resource(".", exe) - - return files - -def make_msi(exe): - # See the full docs for more. But this will convert your Python executable - # into a `WiXMSIBuilder` Starlark type, which will be converted to a Windows - # .msi installer when it is built. - return exe.to_wix_msi_builder( - # Simple identifier of your app. - "myapp", - # The name of your application. - "My Application", - # The version of your application. - "1.0", - # The author/manufacturer of your application. - "Alice Jones" - ) - - -# Dynamically enable automatic code signing. -def register_code_signers(): - # You will need to run with `pyoxidizer build --var ENABLE_CODE_SIGNING 1` for - # this if block to be evaluated. - if not VARS.get("ENABLE_CODE_SIGNING"): - return - - # Use a code signing certificate in a .pfx/.p12 file, prompting the - # user for its path and password to open. - # pfx_path = prompt_input("path to code signing certificate file") - # pfx_password = prompt_password( - # "password for code signing certificate file", - # confirm = True - # ) - # signer = code_signer_from_pfx_file(pfx_path, pfx_password) - - # Use a code signing certificate in the Windows certificate store, specified - # by its SHA-1 thumbprint. (This allows you to use YubiKeys and other - # hardware tokens if they speak to the Windows certificate APIs.) - # sha1_thumbprint = prompt_input( - # "SHA-1 thumbprint of code signing certificate in Windows store" - # ) - # signer = code_signer_from_windows_store_sha1_thumbprint(sha1_thumbprint) - - # Choose a code signing certificate automatically from the Windows - # certificate store. - # signer = code_signer_from_windows_store_auto() - - # Activate your signer so it gets called automatically. - # signer.activate() - - -# Call our function to set up automatic code signers. -register_code_signers() - -# Tell PyOxidizer about the build targets defined above. -register_target("exe", make_exe) -register_target("resources", make_embedded_resources, depends=["exe"], default_build_script=True) -register_target("install", make_install, depends=["exe"], default=True) -register_target("msi_installer", make_msi, depends=["exe"]) - -# Resolve whatever targets the invoker of this configuration file is requesting -# be resolved. -resolve_targets() diff --git a/continuedev/pyproject.toml b/continuedev/pyproject.toml index d7505e2b..7355beb0 100644 --- a/continuedev/pyproject.toml +++ b/continuedev/pyproject.toml @@ -7,7 +7,6 @@ readme = "README.md" [tool.poetry.dependencies] python = "^3.8.1" -diff-match-patch = "^20230430" fastapi = "^0.95.1" typer = "^0.7.0" openai = "^0.27.5" @@ -18,7 +17,6 @@ python-dotenv = "^1.0.0" nest-asyncio = "^1.5.6" websockets = "^11.0.2" urllib3 = "1.26.15" -gpt-index = "^0.6.8" posthog = "^3.0.1" tiktoken = "^0.4.0" jsonref = "^1.1.0" diff --git a/continuedev/requirements.txt b/continuedev/requirements.txt index 970681f9..6a776a62 100644 --- a/continuedev/requirements.txt +++ b/continuedev/requirements.txt @@ -1,76 +1,20 @@ -aiofiles==23.1.0 -aiohttp==3.8.4 -aiosignal==1.3.1 -anthropic==0.3.4 -anyio==3.6.2 -async-timeout==4.0.2 -attrs==23.1.0 -backoff==2.2.1 -boltons==23.0.0 -camel-converter==3.0.2 -certifi==2022.12.7 -cffi==1.15.1 -charset-normalizer==3.1.0 -chevron==0.14.0 -click==8.1.3 --e git+https://github.com/continuedev/continue.git@78ada9b463a41260ccf53bbdc08b396ab9783ee2#egg=continuedev&subdirectory=continuedev -cryptography==41.0.2 -dataclasses-json==0.5.7 -Deprecated==1.2.14 -diff-match-patch==20230430 -directory-tree==0.0.3.1 -distro==1.8.0 fastapi==0.95.1 -frozenlist==1.3.3 -gpt-index==0.6.8 -h11==0.14.0 -httpcore==0.17.3 -httpx==0.24.1 -idna==3.4 -jsonref==1.1.0 -jsonschema==4.17.3 -langchain==0.0.171 -marshmallow==3.19.0 -marshmallow-enum==1.5.1 -meilisearch-python-async==1.4.8 -monotonic==1.6 -multidict==6.0.4 -mypy-extensions==1.0.0 -nest-asyncio==1.5.6 -numexpr==2.8.4 -numpy==1.24.3 -openai==0.27.6 -openapi-schema-pydantic==1.2.4 -packaging==23.1 -pandas==2.0.1 -posthog==3.0.1 -psutil==5.9.5 -pycparser==2.21 -pydantic==1.10.7 -PyGithub==1.59.0 -PyJWT==2.8.0 -PyNaCl==1.5.0 -pyrsistent==0.19.3 -python-dateutil==2.8.2 -python-dotenv==1.0.0 -pytz==2023.3 -PyYAML==6.0 -regex==2023.5.5 -requests==2.29.0 -six==1.16.0 -sniffio==1.3.0 -SQLAlchemy==2.0.13 -starlette==0.26.1 -tenacity==8.2.2 -tiktoken==0.4.0 -tokenizers==0.13.3 -tqdm==4.65.0 typer==0.7.0 -typing-inspect==0.8.0 -typing_extensions==4.5.0 -tzdata==2023.3 -urllib3==1.26.15 +openai==0.27.5 +boltons==23.0.0 +pydantic==1.10.7 uvicorn==0.21.1 +python-dotenv==1.0.0 +nest-asyncio==1.5.6 websockets==11.0.2 -wrapt==1.15.0 -yarl==1.9.2 +urllib3==1.26.15 +posthog==3.0.1 +tiktoken==0.4.0 +jsonref==1.1.0 +jsonschema==4.17.3 +directory-tree==0.0.3.1 +anthropic==0.3.4 +chevron==0.14.0 +psutil==5.9.5 +pygithub==1.59.0 +meilisearch-python-async==1.4.8 diff --git a/continuedev/src/continuedev/libs/util/calculate_diff.py b/continuedev/src/continuedev/libs/util/calculate_diff.py index 3e82bab3..e8e48839 100644 --- a/continuedev/src/continuedev/libs/util/calculate_diff.py +++ b/continuedev/src/continuedev/libs/util/calculate_diff.py @@ -2,41 +2,6 @@ import difflib from typing import List from ...models.main import Position, Range from ...models.filesystem import FileEdit -from diff_match_patch import diff_match_patch - - -def calculate_diff_match_patch(filepath: str, original: str, updated: str) -> List[FileEdit]: - dmp = diff_match_patch() - diffs = dmp.diff_main(original, updated) - dmp.diff_cleanupSemantic(diffs) - - replacements = [] - - current_index = 0 - deleted_length = 0 - - for diff in diffs: - if diff[0] == diff_match_patch.DIFF_EQUAL: - current_index += len(diff[1]) - deleted_length = 0 - elif diff[0] == diff_match_patch.DIFF_INSERT: - current_index += deleted_length - replacements.append((current_index, current_index, diff[1])) - current_index += len(diff[1]) - deleted_length = 0 - elif diff[0] == diff_match_patch.DIFF_DELETE: - replacements.append( - (current_index, current_index + len(diff[1]), '')) - deleted_length += len(diff[1]) - elif diff[0] == diff_match_patch.DIFF_REPLACE: - replacements.append( - (current_index, current_index + len(diff[1]), '')) - current_index += deleted_length - replacements.append((current_index, current_index, diff[2])) - current_index += len(diff[2]) - deleted_length = 0 - - return [FileEdit(filepath=filepath, range=Range.from_indices(original, r[0], r[1]), replacement=r[2]) for r in replacements] def calculate_diff(filepath: str, original: str, updated: str) -> List[FileEdit]: diff --git a/cxf.py b/cxf.py new file mode 100644 index 00000000..b8610999 --- /dev/null +++ b/cxf.py @@ -0,0 +1,14 @@ +from cx_Freeze import setup, Executable + +setup( + name="Continue", + version="0.1", + description="Continue Server", + executables=[Executable("run.py")], + + options={ + "build_exe": { + "excludes": ["unnecessary_module"], + }, + }, +) -- cgit v1.2.3-70-g09d2 From 9513bcd188c301e9bf412ddaff6fed4081eab002 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 15:40:01 -0700 Subject: use python 3.11 for pyinstaller --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 41fd174d..a4151777 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -21,7 +21,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: "3.8" + python-version: "3.11" - name: Setup Python uses: actions/setup-python@v4 -- cgit v1.2.3-70-g09d2 From 2d5d49856d8775e3bf9eb4ae8bd6965433a31230 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 15:49:14 -0700 Subject: main.yaml only setup python once --- .github/workflows/main.yaml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index a4151777..5d2c935f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -10,7 +10,7 @@ jobs: pyinstaller: strategy: matrix: - os: [macos-latest, ubuntu-latest, windows-latest] + os: [macos-latest] runs-on: ${{ matrix.os }} @@ -20,17 +20,8 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 - with: - python-version: "3.11" - - - name: Setup Python - uses: actions/setup-python@v4 with: python-version: "3.8" - architecture: "x64" # optional x64 (default) or x86 - cache: "pip" - cache-dependency-path: | - **/requirements*.txt - name: Install Dependencies run: | -- cgit v1.2.3-70-g09d2 From 74472c52e393281fbb5fa69ea635aaea292c51fb Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 15:54:36 -0700 Subject: main.yaml package only dist/run --- .github/workflows/main.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 5d2c935f..a783af59 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -21,7 +21,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: "3.8" + python-version: "3.11" - name: Install Dependencies run: | @@ -33,7 +33,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: ${{ runner.os }} Build - path: dist/* + path: dist/run # publish: # runs-on: ubuntu-latest -- cgit v1.2.3-70-g09d2 From 398451676d454a9e3ec436ad19c74b3c1bc379e6 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 16:01:46 -0700 Subject: newer version of setup-python workflow setp --- .devcontainer/devcontainer.json | 5 ----- .github/workflows/main.yaml | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) delete mode 100644 .devcontainer/devcontainer.json (limited to '.github/workflows') diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index ad93c14a..00000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/universal:2", - "features": { - } -} diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index a783af59..480405b8 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -19,7 +19,7 @@ jobs: uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: "3.11" -- cgit v1.2.3-70-g09d2 From f9148fd279e8af0a145308c96c4f5b5536b1e4e8 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 16:06:14 -0700 Subject: tweaking main.yml --- .github/workflows/main.yaml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 480405b8..24835d78 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -10,7 +10,7 @@ jobs: pyinstaller: strategy: matrix: - os: [macos-latest] + os: [macos-latest, ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} @@ -21,14 +21,22 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.10" + + - name: Install Pyinstaller + run: | + pip install pyinstaller - name: Install Dependencies run: | - pip install -r continuedev/requirements.txt pyinstaller + pip install -r continuedev/requirements.txt - run: pyinstaller run.py --exclude-module numpy --exclude-module jedi -F + - name: Set permissions + run: | + chmod 777 dist/run + - name: Upload Artifacts uses: actions/upload-artifact@v3 with: -- cgit v1.2.3-70-g09d2 From 2a9d057c5b173c01977e3ae5299f685b474b1eab Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 16:29:10 -0700 Subject: fixes to main.yaml, build nodejs --- .github/workflows/main.yaml | 162 +++++++++++++++------------ extension/server/.gitignore | 3 +- extension/server/exe/run-darwin | Bin 16421088 -> 0 bytes extension/server/exe/run-linux | Bin 28788480 -> 0 bytes extension/server/exe/run-win.exe | Bin 15593484 -> 0 bytes extension/src/activation/environmentSetup.ts | 2 + 6 files changed, 95 insertions(+), 72 deletions(-) delete mode 100755 extension/server/exe/run-darwin delete mode 100644 extension/server/exe/run-linux delete mode 100644 extension/server/exe/run-win.exe (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 24835d78..f866bf78 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -41,74 +41,94 @@ jobs: uses: actions/upload-artifact@v3 with: name: ${{ runner.os }} Build - path: dist/run - - # publish: - # runs-on: ubuntu-latest - - # steps: - # - name: Checkout - # uses: actions/checkout@v2 - - # - name: Set up Python - # uses: actions/setup-python@v2 - # with: - # python-version: "3.8" - - # - name: Install Poetry - # run: | - # curl -sSL https://install.python-poetry.org | python3 - - - # - name: Install Python dependencies - # run: | - # cd continuedev - # poetry install - - # - name: Cache extension node_modules - # uses: actions/cache@v2 - # with: - # path: extension/node_modules - # key: ${{ runner.os }}-node-${{ hashFiles('extension/package-lock.json') }} - - # - name: Cache react-app node_modules - # uses: actions/cache@v2 - # with: - # path: extension/react-app/node_modules - # key: ${{ runner.os }}-node-${{ hashFiles('extension/react-app/package-lock.json') }} - - # - name: Set up Node.js - # uses: actions/setup-node@v2 - # with: - # node-version: "14" - - # - name: Install extension Dependencies - # run: | - # cd extension - # npm ci --legacy-peer-deps - - # - name: Install react-app Dependencies - # run: | - # cd extension/react-app - # npm ci --legacy-peer-deps - - # - name: Build and Publish - # run: | - # cd extension - # npm run full-package - - # - name: Commit changes - # run: | - # git config --local user.email "action@github.com" - # git config --local user.name "GitHub Action" - # git commit -am "Update package.json version [skip ci]" - - # - name: Push changes - # uses: ad-m/github-push-action@master - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - - # - name: Upload .vsix artifact - # uses: actions/upload-artifact@v2 - # with: - # name: vsix-artifact - # path: extension/build/* + path: dist/* + + publish: + needs: pyinstaller + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Download Linux build + uses: actions/download-artifact@v2 + with: + name: Linux Build + path: extension/server/exe/run-linux + + - name: Download macOS build + uses: actions/download-artifact@v2 + with: + name: macOS Build + path: extension/server/exe/run-darwin + + - name: Download Windows build + uses: actions/download-artifact@v2 + with: + name: Windows Build + path: extension/server/exe/run-windows.exe + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.8" + + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + + - name: Install Python dependencies + run: | + cd continuedev + poetry install + + - name: Cache extension node_modules + uses: actions/cache@v2 + with: + path: extension/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('extension/package-lock.json') }} + + - name: Cache react-app node_modules + uses: actions/cache@v2 + with: + path: extension/react-app/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('extension/react-app/package-lock.json') }} + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: "14" + + - name: Install extension Dependencies + run: | + cd extension + npm ci --legacy-peer-deps + + - name: Install react-app Dependencies + run: | + cd extension/react-app + npm ci --legacy-peer-deps + + - name: Build and Publish + run: | + cd extension + npm run full-package + + - name: Commit changes + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git commit -am "Update package.json version [skip ci]" + + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} + + - name: Upload .vsix artifact + uses: actions/upload-artifact@v2 + with: + name: vsix-artifact + path: extension/build/* diff --git a/extension/server/.gitignore b/extension/server/.gitignore index 0b6e11dd..d501b5cd 100644 --- a/extension/server/.gitignore +++ b/extension/server/.gitignore @@ -1 +1,2 @@ -**.whl \ No newline at end of file +**.whl +exe/** \ No newline at end of file diff --git a/extension/server/exe/run-darwin b/extension/server/exe/run-darwin deleted file mode 100755 index 4d8323ef..00000000 Binary files a/extension/server/exe/run-darwin and /dev/null differ diff --git a/extension/server/exe/run-linux b/extension/server/exe/run-linux deleted file mode 100644 index 3efe5633..00000000 Binary files a/extension/server/exe/run-linux and /dev/null differ diff --git a/extension/server/exe/run-win.exe b/extension/server/exe/run-win.exe deleted file mode 100644 index 30466272..00000000 Binary files a/extension/server/exe/run-win.exe and /dev/null differ diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index 5e2e3c0f..a0d6a653 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -455,6 +455,8 @@ export async function startContinuePythonServer() { exePath = path.join(exeDir, "run-win.exe"); } else if (os.platform() === "darwin") { exePath = path.join(exeDir, "run-darwin"); + // Add permissions + await runCommand(`chmod +x ${exePath}`); await runCommand(`xattr -dr com.apple.quarantine ${exePath}`); } else { exePath = path.join(exeDir, "run-linux"); -- cgit v1.2.3-70-g09d2 From 398c48305640ae4623c4b04589bafd36c6de0f3b Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 16:36:07 -0700 Subject: run publish on macos, not ubuntu --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index f866bf78..1ae87cc5 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -45,7 +45,7 @@ jobs: publish: needs: pyinstaller - runs-on: ubuntu-latest + runs-on: macos-latest steps: - name: Checkout -- cgit v1.2.3-70-g09d2 From 5fd25cb9bc3bc647fa122a2eededa28556b94bbc Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 16:43:24 -0700 Subject: use correct poetry path --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 1ae87cc5..c55027fa 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -81,7 +81,7 @@ jobs: - name: Install Python dependencies run: | cd continuedev - poetry install + /Users/runner/.local/bin/poetry install - name: Cache extension node_modules uses: actions/cache@v2 -- cgit v1.2.3-70-g09d2 From de97604694610032d22410b4d75c5e73fd05efcd Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 16:53:43 -0700 Subject: testing buster --- .github/workflows/main.yaml | 96 +++++++++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 47 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index c55027fa..2de24e18 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -7,68 +7,52 @@ on: - package-python jobs: - pyinstaller: - strategy: - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] + # pyinstaller: + # strategy: + # matrix: + # os: [macos-latest, ubuntu-latest, windows-latest] - runs-on: ${{ matrix.os }} + # runs-on: ${{ matrix.os }} - steps: - - name: Check-out repository - uses: actions/checkout@v3 + # steps: + # - name: Check-out repository + # uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.10" + # - name: Set up Python + # uses: actions/setup-python@v4 + # with: + # python-version: "3.10" - - name: Install Pyinstaller - run: | - pip install pyinstaller + # - name: Install Pyinstaller + # run: | + # pip install pyinstaller - - name: Install Dependencies - run: | - pip install -r continuedev/requirements.txt + # - name: Install Dependencies + # run: | + # pip install -r continuedev/requirements.txt - - run: pyinstaller run.py --exclude-module numpy --exclude-module jedi -F + # - run: pyinstaller run.py --exclude-module numpy --exclude-module jedi -F - - name: Set permissions - run: | - chmod 777 dist/run + # - name: Set permissions + # run: | + # chmod 777 dist/run - - name: Upload Artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ runner.os }} Build - path: dist/* + # - name: Upload Artifacts + # uses: actions/upload-artifact@v3 + # with: + # name: ${{ runner.os }} Build + # path: dist/* publish: - needs: pyinstaller - runs-on: macos-latest + # needs: pyinstaller + runs-on: ubuntu-latest + container: + image: node:14-buster steps: - name: Checkout uses: actions/checkout@v2 - - name: Download Linux build - uses: actions/download-artifact@v2 - with: - name: Linux Build - path: extension/server/exe/run-linux - - - name: Download macOS build - uses: actions/download-artifact@v2 - with: - name: macOS Build - path: extension/server/exe/run-darwin - - - name: Download Windows build - uses: actions/download-artifact@v2 - with: - name: Windows Build - path: extension/server/exe/run-windows.exe - - name: Set up Python uses: actions/setup-python@v2 with: @@ -132,3 +116,21 @@ jobs: with: name: vsix-artifact path: extension/build/* + + - name: Download Linux build + uses: actions/download-artifact@v2 + with: + name: Linux Build + path: extension/server/exe/run-linux + + - name: Download macOS build + uses: actions/download-artifact@v2 + with: + name: macOS Build + path: extension/server/exe/run-darwin + + - name: Download Windows build + uses: actions/download-artifact@v2 + with: + name: Windows Build + path: extension/server/exe/run-windows.exe -- cgit v1.2.3-70-g09d2 From 2374d1be71541945d3ac65dd4f728fe32c671b95 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 16:57:38 -0700 Subject: delete poetry install from main.yaml --- .github/workflows/main.yaml | 14 -------------- 1 file changed, 14 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 2de24e18..1d0479f7 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -53,20 +53,6 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.8" - - - name: Install Poetry - run: | - curl -sSL https://install.python-poetry.org | python3 - - - - name: Install Python dependencies - run: | - cd continuedev - /Users/runner/.local/bin/poetry install - - name: Cache extension node_modules uses: actions/cache@v2 with: -- cgit v1.2.3-70-g09d2 From 9cabb68b02d19978625a7ec5302304014bcb684f Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 17:03:14 -0700 Subject: node-16 buster, not 14 --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 1d0479f7..5fad9a78 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -47,7 +47,7 @@ jobs: # needs: pyinstaller runs-on: ubuntu-latest container: - image: node:14-buster + image: node:16-buster steps: - name: Checkout -- cgit v1.2.3-70-g09d2 From d3152e3dbcda30859656bad7e7c8122505819887 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 17:19:45 -0700 Subject: use nodejs version 19.0.0 --- .github/workflows/main.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 5fad9a78..50de687e 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -46,13 +46,16 @@ jobs: publish: # needs: pyinstaller runs-on: ubuntu-latest - container: - image: node:16-buster steps: - name: Checkout uses: actions/checkout@v2 + - name: Use Node.js 19.0.0 + uses: actions/setup-node@v3 + with: + node-version: 19.0.0 + - name: Cache extension node_modules uses: actions/cache@v2 with: -- cgit v1.2.3-70-g09d2 From 9e94d4f1cc4e7d2e295ef0b1e5db5b4b8b5262e2 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 17:38:19 -0700 Subject: remove --legacy-peer-deps flag --- .github/workflows/main.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 50de687e..85026d02 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -76,12 +76,12 @@ jobs: - name: Install extension Dependencies run: | cd extension - npm ci --legacy-peer-deps + npm ci - name: Install react-app Dependencies run: | cd extension/react-app - npm ci --legacy-peer-deps + npm ci - name: Build and Publish run: | -- cgit v1.2.3-70-g09d2 From 9d1be8859cba212d205b6290e00727b85c53fe09 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 17:59:02 -0700 Subject: --legacy-peer-deps for react-app --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 85026d02..84961067 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -81,7 +81,7 @@ jobs: - name: Install react-app Dependencies run: | cd extension/react-app - npm ci + npm ci --legacy-peer-deps - name: Build and Publish run: | -- cgit v1.2.3-70-g09d2 From 29fd79a2d1d9bb3811e81636f2ff3f7991e7c1aa Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 18:31:06 -0700 Subject: write permissions to push package.json update --- .github/workflows/main.yaml | 2 ++ 1 file changed, 2 insertions(+) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 84961067..9f0a5115 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -99,6 +99,8 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} branch: ${{ github.ref }} + permissions: + contents: write - name: Upload .vsix artifact uses: actions/upload-artifact@v2 -- cgit v1.2.3-70-g09d2 From 5e2cf036de37e396213d32f9486c59cf9f06080b Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 18:33:00 -0700 Subject: correctly place permissions at job-level --- .github/workflows/main.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 9f0a5115..55df9c03 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -46,6 +46,8 @@ jobs: publish: # needs: pyinstaller runs-on: ubuntu-latest + permissions: + contents: write steps: - name: Checkout @@ -99,8 +101,6 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} branch: ${{ github.ref }} - permissions: - contents: write - name: Upload .vsix artifact uses: actions/upload-artifact@v2 -- cgit v1.2.3-70-g09d2 From e5a9725152e4eb575b0ba6c163ef59f670ada4f7 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 18:35:54 -0700 Subject: uncomment pyinstaller --- .github/workflows/main.yaml | 54 ++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 55df9c03..158b8ef2 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -7,41 +7,41 @@ on: - package-python jobs: - # pyinstaller: - # strategy: - # matrix: - # os: [macos-latest, ubuntu-latest, windows-latest] + pyinstaller: + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] - # runs-on: ${{ matrix.os }} + runs-on: ${{ matrix.os }} - # steps: - # - name: Check-out repository - # uses: actions/checkout@v3 + steps: + - name: Check-out repository + uses: actions/checkout@v3 - # - name: Set up Python - # uses: actions/setup-python@v4 - # with: - # python-version: "3.10" + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" - # - name: Install Pyinstaller - # run: | - # pip install pyinstaller + - name: Install Pyinstaller + run: | + pip install pyinstaller - # - name: Install Dependencies - # run: | - # pip install -r continuedev/requirements.txt + - name: Install Dependencies + run: | + pip install -r continuedev/requirements.txt - # - run: pyinstaller run.py --exclude-module numpy --exclude-module jedi -F + - run: pyinstaller run.py --exclude-module numpy --exclude-module jedi -F - # - name: Set permissions - # run: | - # chmod 777 dist/run + - name: Set permissions + run: | + chmod 777 dist/run - # - name: Upload Artifacts - # uses: actions/upload-artifact@v3 - # with: - # name: ${{ runner.os }} Build - # path: dist/* + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: ${{ runner.os }} Build + path: dist/* publish: # needs: pyinstaller -- cgit v1.2.3-70-g09d2 From 29096f502dee36c7bd68c0dc2dc26aa3006c38f9 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 18:39:15 -0700 Subject: reorder, don't push for now --- .github/workflows/main.yaml | 62 ++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 158b8ef2..872470d0 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -44,15 +44,33 @@ jobs: path: dist/* publish: - # needs: pyinstaller + needs: pyinstaller runs-on: ubuntu-latest - permissions: - contents: write + # permissions: + # contents: write steps: - name: Checkout uses: actions/checkout@v2 + - name: Download Linux build + uses: actions/download-artifact@v2 + with: + name: Linux Build + path: extension/server/exe/run-linux + + - name: Download macOS build + uses: actions/download-artifact@v2 + with: + name: macOS Build + path: extension/server/exe/run-darwin + + - name: Download Windows build + uses: actions/download-artifact@v2 + with: + name: Windows Build + path: extension/server/exe/run-windows.exe + - name: Use Node.js 19.0.0 uses: actions/setup-node@v3 with: @@ -90,38 +108,20 @@ jobs: cd extension npm run full-package - - name: Commit changes - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git commit -am "Update package.json version [skip ci]" + # - name: Commit changes + # run: | + # git config --local user.email "action@github.com" + # git config --local user.name "GitHub Action" + # git commit -am "Update package.json version [skip ci]" - - name: Push changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }} + # - name: Push changes + # uses: ad-m/github-push-action@master + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # branch: ${{ github.ref }} - name: Upload .vsix artifact uses: actions/upload-artifact@v2 with: name: vsix-artifact path: extension/build/* - - - name: Download Linux build - uses: actions/download-artifact@v2 - with: - name: Linux Build - path: extension/server/exe/run-linux - - - name: Download macOS build - uses: actions/download-artifact@v2 - with: - name: macOS Build - path: extension/server/exe/run-darwin - - - name: Download Windows build - uses: actions/download-artifact@v2 - with: - name: Windows Build - path: extension/server/exe/run-windows.exe -- cgit v1.2.3-70-g09d2 From 10e5b827147541d0911ea66a00d7953d33801ea9 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 18:53:27 -0700 Subject: fix exe paths --- .github/workflows/main.yaml | 6 +++--- extension/src/activation/environmentSetup.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 872470d0..d9bba4cd 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -57,19 +57,19 @@ jobs: uses: actions/download-artifact@v2 with: name: Linux Build - path: extension/server/exe/run-linux + path: extension/server/exe/linux - name: Download macOS build uses: actions/download-artifact@v2 with: name: macOS Build - path: extension/server/exe/run-darwin + path: extension/server/exe/mac - name: Download Windows build uses: actions/download-artifact@v2 with: name: Windows Build - path: extension/server/exe/run-windows.exe + path: extension/server/exe/windows - name: Use Node.js 19.0.0 uses: actions/setup-node@v3 diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index a0d6a653..56d5a628 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -452,14 +452,14 @@ export async function startContinuePythonServer() { const exeDir = path.join(getExtensionUri().fsPath, "server", "exe"); let exePath: string; if (os.platform() === "win32") { - exePath = path.join(exeDir, "run-win.exe"); + exePath = path.join(exeDir, "windows", "run.exe"); } else if (os.platform() === "darwin") { - exePath = path.join(exeDir, "run-darwin"); + exePath = path.join(exeDir, "mac", "run"); // Add permissions await runCommand(`chmod +x ${exePath}`); await runCommand(`xattr -dr com.apple.quarantine ${exePath}`); } else { - exePath = path.join(exeDir, "run-linux"); + exePath = path.join(exeDir, "linux", "run"); } // Run the executable -- cgit v1.2.3-70-g09d2 From 0a7cd1d0820c5f496157b9f85200dbe911b6fc8a Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 20:56:51 -0700 Subject: purge unecessary functions in envSetup (finally) --- .github/workflows/main.yaml | 2 +- extension/DEV_README.md | 2 +- extension/package.json | 6 +- extension/scripts/install_from_source.py | 2 +- extension/src/README.md | 3 +- extension/src/activation/environmentSetup.ts | 421 ++------------------------- 6 files changed, 24 insertions(+), 412 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index d9bba4cd..dc670137 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -106,7 +106,7 @@ jobs: - name: Build and Publish run: | cd extension - npm run full-package + npm run package # - name: Commit changes # run: | diff --git a/extension/DEV_README.md b/extension/DEV_README.md index 72ea5c6a..8e244bc3 100644 --- a/extension/DEV_README.md +++ b/extension/DEV_README.md @@ -10,7 +10,7 @@ This is the Continue VS Code Extension. Its primary jobs are 1. Clone this repo 2. `cd extension` -3. `npm run full-package` +3. `npm run package` > If NPM is not installed, you can use `brew install node` on Mac, or see the [installation page](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) for other platforms, or more detailed instructions. diff --git a/extension/package.json b/extension/package.json index fcf2c1a8..d350b3ee 100644 --- a/extension/package.json +++ b/extension/package.json @@ -226,11 +226,7 @@ "test": "node ./out/test/runTest.js", "jest": "jest --config ./jest.config.js", "typegen": "node scripts/typegen.js", - "package": "mkdir -p ./build && vsce package --out ./build", - "full-package": "npm install && npm run typegen && npm run clientgen && cd react-app && npm install && npm run build && cd .. && npm run package", - "install-extension": "code --install-extension ./build/continue-0.0.8.vsix", - "uninstall": "code --uninstall-extension .continue", - "reinstall": "rm -rf ./build && npm run package && npm run uninstall && npm run install-extension" + "package": "npm install && npm run typegen && npm run clientgen && cd react-app && npm install && npm run build && cd .. && mkdir -p ./build && vsce package --out ./build" }, "devDependencies": { "@nestjs/common": "^8.4.7", diff --git a/extension/scripts/install_from_source.py b/extension/scripts/install_from_source.py index d004259b..5e16bf21 100644 --- a/extension/scripts/install_from_source.py +++ b/extension/scripts/install_from_source.py @@ -53,7 +53,7 @@ def main(): resp = run("cd ../../continuedev; poetry install; poetry run typegen") resp = run( - "cd ..; npm i; cd react-app; npm i; cd ..; npm run full-package") + "cd ..; npm i; cd react-app; npm i; cd ..; npm run package") if resp.stderr: print("Error packaging the extension. Please try again.") diff --git a/extension/src/README.md b/extension/src/README.md index 4969890f..ef90c31b 100644 --- a/extension/src/README.md +++ b/extension/src/README.md @@ -12,7 +12,7 @@ 5. From `continue/extension`, run `npm install` -6. Run `npm run full-package` +6. Run `npm run package` 7. Open `src/activation/activate.ts` file (or any TypeScript file) @@ -22,7 +22,6 @@ 10. Every time you make changes to the code, you need to run `npm run esbuild` unless you make changes inside of `react-app` and then you need to run `npm run build` from there - ## Alternative: Install from source Update: directions to root README diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index 56d5a628..01fd2e5c 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -10,65 +10,6 @@ import * as vscode from "vscode"; import * as os from "os"; import fkill from "fkill"; -const WINDOWS_REMOTE_SIGNED_SCRIPTS_ERROR = - "A Python virtual enviroment cannot be activated because running scripts is disabled for this user. In order to use Continue, please enable signed scripts to run with this command in PowerShell: `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser`, reload VS Code, and then try again."; - -const MAX_RETRIES = 3; -async function retryThenFail( - fn: () => Promise, - retries: number = MAX_RETRIES -): Promise { - try { - if (retries < MAX_RETRIES && process.platform === "win32") { - let [stdout, stderr] = await runCommand("Get-ExecutionPolicy"); - if (!stdout.includes("RemoteSigned")) { - [stdout, stderr] = await runCommand( - "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser" - ); - console.log("Execution policy stdout: ", stdout); - console.log("Execution policy stderr: ", stderr); - } - } - - return await fn(); - } catch (e: any) { - if (retries > 0) { - return await retryThenFail(fn, retries - 1); - } - - // Show corresponding error message depending on the platform - let msg = - "Failed to set up Continue extension. Please email hi@continue.dev and we'll get this fixed ASAP!"; - try { - switch (process.platform) { - case "win32": - msg = WINDOWS_REMOTE_SIGNED_SCRIPTS_ERROR; - break; - case "darwin": - break; - case "linux": - const [pythonCmd] = await getPythonPipCommands(); - msg = await getLinuxAptInstallError(pythonCmd); - break; - } - } finally { - console.log("After retries, failed to set up Continue extension", msg); - vscode.window - .showErrorMessage(msg, "View Logs", "Retry") - .then((selection) => { - if (selection === "View Logs") { - vscode.commands.executeCommand("continue.viewLogs"); - } else if (selection === "Retry") { - // Reload VS Code window - vscode.commands.executeCommand("workbench.action.reloadWindow"); - } - }); - } - - throw e; - } -} - async function runCommand(cmd: string): Promise<[string, string | undefined]> { console.log("Running command: ", cmd); var stdout: any = ""; @@ -147,216 +88,6 @@ export async function getPythonPipCommands() { return [pythonCmd, pipCmd]; } -function getActivateUpgradeCommands(pythonCmd: string, pipCmd: string) { - let activateCmd = ". env/bin/activate"; - let pipUpgradeCmd = `${pipCmd} install --upgrade pip`; - if (process.platform == "win32") { - activateCmd = ".\\env\\Scripts\\activate"; - pipUpgradeCmd = `${pythonCmd} -m pip install --upgrade pip`; - } - return [activateCmd, pipUpgradeCmd]; -} - -function checkEnvExists() { - const envBinPath = path.join( - serverPath(), - "env", - process.platform == "win32" ? "Scripts" : "bin" - ); - return ( - fs.existsSync(path.join(envBinPath, "activate")) && - fs.existsSync( - path.join(envBinPath, process.platform == "win32" ? "pip.exe" : "pip") - ) - ); -} - -async function checkRequirementsInstalled() { - // First, check if the requirements have been installed most recently for a later version of the extension - if (fs.existsSync(requirementsVersionPath())) { - const requirementsVersion = fs.readFileSync( - requirementsVersionPath(), - "utf8" - ); - if (requirementsVersion !== getExtensionVersion()) { - // Remove the old version of continuedev from site-packages - const [pythonCmd, pipCmd] = await getPythonPipCommands(); - const [activateCmd] = getActivateUpgradeCommands(pythonCmd, pipCmd); - const removeOldVersionCommand = [ - `cd "${serverPath()}"`, - activateCmd, - `${pipCmd} uninstall -y continuedev`, - ].join(" ; "); - await runCommand(removeOldVersionCommand); - return false; - } - } - - let envLibsPath = path.join( - serverPath(), - "env", - process.platform == "win32" ? "Lib" : "lib" - ); - // If site-packages is directly under env, use that - if (fs.existsSync(path.join(envLibsPath, "site-packages"))) { - envLibsPath = path.join(envLibsPath, "site-packages"); - } else { - // Get the python version folder name - const pythonVersions = fs.readdirSync(envLibsPath).filter((f: string) => { - return f.startsWith("python"); - }); - if (pythonVersions.length == 0) { - return false; - } - const pythonVersion = pythonVersions[0]; - envLibsPath = path.join(envLibsPath, pythonVersion, "site-packages"); - } - - const continuePath = path.join(envLibsPath, "continuedev"); - - return fs.existsSync(continuePath); -} - -async function getLinuxAptInstallError(pythonCmd: string) { - // First, try to run the command to install python3-venv - let [stdout, stderr] = await runCommand(`${pythonCmd} --version`); - if (stderr) { - await vscode.window.showErrorMessage( - "Python3 is not installed. Please install from https://www.python.org/downloads, reload VS Code, and try again." - ); - throw new Error(stderr); - } - const version = stdout.split(" ")[1].split(".")[1]; - const installVenvCommand = `apt-get install python3.${version}-venv`; - await runCommand("apt-get update"); - return `[Important] Continue needs to create a Python virtual environment, but python3.${version}-venv is not installed. Please run this command in your terminal: \`${installVenvCommand}\`, reload VS Code, and then try again.`; -} - -async function createPythonVenv(pythonCmd: string) { - if (checkEnvExists()) { - console.log("Python env already exists, skipping..."); - } else { - // Assemble the command to create the env - const createEnvCommand = [ - `cd "${serverPath()}"`, - `${pythonCmd} -m venv env`, - ].join(" ; "); - - const [stdout, stderr] = await runCommand(createEnvCommand); - if ( - stderr && - stderr.includes("running scripts is disabled on this system") - ) { - console.log("Scripts disabled error when trying to create env"); - await vscode.window.showErrorMessage(WINDOWS_REMOTE_SIGNED_SCRIPTS_ERROR); - throw new Error(stderr); - } else if ( - stderr?.includes("On Debian/Ubuntu systems") || - stdout?.includes("On Debian/Ubuntu systems") - ) { - const msg = await getLinuxAptInstallError(pythonCmd); - console.log(msg); - await vscode.window.showErrorMessage(msg); - } else if (checkEnvExists()) { - console.log("Successfully set up python env at ", `${serverPath()}/env`); - } else if ( - stderr?.includes("Permission denied") && - stderr?.includes("python.exe") - ) { - // This might mean that another window is currently using the python.exe file to install requirements - // So we want to wait and try again - let i = 0; - await new Promise((resolve, reject) => - setInterval(() => { - if (i > 5) { - reject("Timed out waiting for other window to create env..."); - } - if (checkEnvExists()) { - resolve(null); - } else { - console.log("Waiting for other window to create env..."); - } - i++; - }, 5000) - ); - } else { - const msg = [ - "Python environment not successfully created. Trying again. Here was the stdout + stderr: ", - `stdout: ${stdout}`, - `stderr: ${stderr}`, - ].join("\n\n"); - console.log(msg); - throw new Error(msg); - } - } -} - -async function setupPythonEnv() { - console.log("Setting up python env for Continue extension..."); - - const [pythonCmd, pipCmd] = await getPythonPipCommands(); - const [activateCmd, pipUpgradeCmd] = getActivateUpgradeCommands( - pythonCmd, - pipCmd - ); - - await retryThenFail(async () => { - // First, create the virtual environment - await createPythonVenv(pythonCmd); - - // Install the requirements - if (await checkRequirementsInstalled()) { - console.log("Python requirements already installed, skipping..."); - } else { - const installRequirementsCommand = [ - `cd "${serverPath()}"`, - activateCmd, - pipUpgradeCmd, - `${pipCmd} install -r requirements.txt`, - ].join(" ; "); - const [, stderr] = await runCommand(installRequirementsCommand); - if (stderr) { - throw new Error(stderr); - } - // Write the version number for which requirements were installed - fs.writeFileSync(requirementsVersionPath(), getExtensionVersion()); - } - }); -} - -function readEnvFile(path: string) { - if (!fs.existsSync(path)) { - return {}; - } - let envFile = fs.readFileSync(path, "utf8"); - - let env: { [key: string]: string } = {}; - envFile.split("\n").forEach((line) => { - let [key, value] = line.split("="); - if (typeof key === "undefined" || typeof value === "undefined") { - return; - } - env[key] = value.replace(/"/g, ""); - }); - return env; -} - -function writeEnvFile(path: string, key: string, value: string) { - if (!fs.existsSync(path)) { - fs.writeFileSync(path, `${key}="${value}"`); - return; - } - - let env = readEnvFile(path); - env[key] = value; - - let newEnvFile = ""; - for (let key in env) { - newEnvFile += `${key}="${env[key]}"\n`; - } - fs.writeFileSync(path, newEnvFile); -} - async function checkServerRunning(serverUrl: string): Promise { // Check if already running by calling /health try { @@ -381,16 +112,6 @@ export function getContinueGlobalPath(): string { return continuePath; } -function setupServerPath() { - const sPath = serverPath(); - const extensionServerPath = path.join(getExtensionUri().fsPath, "server"); - const files = fs.readdirSync(extensionServerPath); - files.forEach((file) => { - const filePath = path.join(extensionServerPath, file); - fs.copyFileSync(filePath, path.join(sPath, file)); - }); -} - function serverPath(): string { const sPath = path.join(getContinueGlobalPath(), "server"); if (!fs.existsSync(sPath)) { @@ -411,22 +132,13 @@ function serverVersionPath(): string { return path.join(serverPath(), "server_version.txt"); } -function requirementsVersionPath(): string { - return path.join(serverPath(), "requirements_version.txt"); -} - export function getExtensionVersion() { const extension = vscode.extensions.getExtension("continue.continue"); return extension?.packageJSON.version || ""; } -export async function startContinuePythonServer() { - // Check vscode settings - const serverUrl = getContinueServerUrl(); - if (serverUrl !== "http://localhost:65432") { - return; - } - +// Returns whether a server of the current version is already running +async function checkOrKillRunningServer(serverUrl: string): Promise { console.log("Checking if server is old version"); // Kill the server if it is running an old version if (fs.existsSync(serverVersionPath())) { @@ -436,7 +148,7 @@ export async function startContinuePythonServer() { (await checkServerRunning(serverUrl)) ) { // The current version is already up and running, no need to continue - return; + return true; } } console.log("Killing old server..."); @@ -447,6 +159,20 @@ export async function startContinuePythonServer() { console.log("Failed to kill old server:", e); } } + return false; +} + +export async function startContinuePythonServer() { + // Check vscode settings + const serverUrl = getContinueServerUrl(); + if (serverUrl !== "http://localhost:65432") { + return; + } + + // Check if server is already running + if (await checkOrKillRunningServer(serverUrl)) { + return; + } // Get name of the corresponding executable for platform const exeDir = path.join(getExtensionUri().fsPath, "server", "exe"); @@ -482,115 +208,6 @@ export async function startContinuePythonServer() { console.log(`stdout: ${data.toString()}`); }); - return; - - return await retryThenFail(async () => { - console.log("Checking if server is old version"); - // Kill the server if it is running an old version - if (fs.existsSync(serverVersionPath())) { - const serverVersion = fs.readFileSync(serverVersionPath(), "utf8"); - if ( - serverVersion === getExtensionVersion() && - (await checkServerRunning(serverUrl)) - ) { - // The current version is already up and running, no need to continue - return; - } - } - console.log("Killing old server..."); - try { - await fkill(":65432"); - } catch (e: any) { - if (!e.message.includes("Process doesn't exist")) { - console.log("Failed to kill old server:", e); - } - } - - // Do this after above check so we don't have to waste time setting up the env - await setupPythonEnv(); - - // Spawn the server process on port 65432 - const [pythonCmd] = await getPythonPipCommands(); - const activateCmd = - process.platform == "win32" - ? ".\\env\\Scripts\\activate" - : ". env/bin/activate"; - - const command = `cd "${serverPath()}" && ${activateCmd} && cd .. && ${pythonCmd} -m server.run_continue_server`; - - return new Promise(async (resolve, reject) => { - console.log("Starting Continue python server..."); - try { - const child = spawn(command, { - shell: true, - }); - child.stderr.on("data", (data: any) => { - if ( - data.includes("Uvicorn running on") || // Successfully started the server - data.includes("only one usage of each socket address") || // [windows] The server is already running (probably a simultaneously opened VS Code window) - data.includes("address already in use") // [mac/linux] The server is already running (probably a simultaneously opened VS Code window) - ) { - console.log("Successfully started Continue python server"); - resolve(null); - } else if (data.includes("ERROR") || data.includes("Traceback")) { - console.log("Error starting Continue python server: ", data); - } else { - console.log(`stdout: ${data}`); - } - }); - child.on("error", (error: any) => { - console.log(`error: ${error.message}`); - }); - - child.on("close", (code: any) => { - console.log(`child process exited with code ${code}`); - }); - - child.stdout.on("data", (data: any) => { - console.log(`stdout: ${data}`); - }); - - // Write the current version of vscode to a file called server_version.txt - fs.writeFileSync(serverVersionPath(), getExtensionVersion()); - } catch (e) { - console.log("Failed to start Continue python server", e); - // If failed, check if it's because the server is already running (might have happened just after we checked above) - if (await checkServerRunning(serverUrl)) { - resolve(null); - } else { - reject(); - } - } - }); - }); -} - -export function isPythonEnvSetup(): boolean { - const pathToEnvCfg = path.join(serverPath(), "env", "pyvenv.cfg"); - return fs.existsSync(pathToEnvCfg); -} - -export async function downloadPython3() { - // Download python3 and return the command to run it (python or python3) - let os = process.platform; - let command: string = ""; - let pythonCmd = "python3"; - if (os === "darwin") { - throw new Error("python3 not found"); - } else if (os === "linux") { - command = - "sudo apt update ; upgrade ; sudo apt install python3 python3-pip"; - } else if (os === "win32") { - command = - "wget -O python_installer.exe https://www.python.org/ftp/python/3.11.3/python-3.11.3-amd64.exe ; python_installer.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0"; - pythonCmd = "python"; - } - - var [stdout, stderr] = await runCommand(command); - if (stderr) { - throw new Error(stderr); - } - console.log("Successfully downloaded python3"); - - return pythonCmd; + // Write the current version of vscode extension to a file called server_version.txt + fs.writeFileSync(serverVersionPath(), getExtensionVersion()); } -- cgit v1.2.3-70-g09d2 From f5f9d7712323756e6f94b8ee1d1c9f0c8f0be57b Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 22:37:03 -0700 Subject: full vsce publish workflow --- .github/workflows/main.yaml | 27 +++++++++++++------------- continuedev/src/continuedev/libs/util/paths.py | 11 ++--------- 2 files changed, 16 insertions(+), 22 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index dc670137..5f2571ab 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -46,8 +46,8 @@ jobs: publish: needs: pyinstaller runs-on: ubuntu-latest - # permissions: - # contents: write + permissions: + contents: write steps: - name: Checkout @@ -107,18 +107,19 @@ jobs: run: | cd extension npm run package + vsce publish patch -p ${{ secrets.VSCE_TOKEN }} - # - name: Commit changes - # run: | - # git config --local user.email "action@github.com" - # git config --local user.name "GitHub Action" - # git commit -am "Update package.json version [skip ci]" - - # - name: Push changes - # uses: ad-m/github-push-action@master - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # branch: ${{ github.ref }} + - name: Commit changes + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git commit -am "Update package.json version [skip ci]" + + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} - name: Upload .vsix artifact uses: actions/upload-artifact@v2 diff --git a/continuedev/src/continuedev/libs/util/paths.py b/continuedev/src/continuedev/libs/util/paths.py index a033d6dd..6385dc6f 100644 --- a/continuedev/src/continuedev/libs/util/paths.py +++ b/continuedev/src/continuedev/libs/util/paths.py @@ -4,15 +4,8 @@ from ..constants.main import CONTINUE_SESSIONS_FOLDER, CONTINUE_GLOBAL_FOLDER, C def find_data_file(filename): - if getattr(sys, 'frozen', False): - # The application is frozen - datadir = os.path.dirname(sys.executable) - else: - # The application is not frozen - # Change this bit to match where you store your data files: - datadir = os.path.dirname(__file__) - - return os.path.join(datadir, filename) + datadir = os.path.dirname(__file__) + return os.path.abspath(os.path.join(datadir, filename)) def getGlobalFolderPath(): -- cgit v1.2.3-70-g09d2 From 582d8d06d3f97609ef02f7aedabd6dd027b05b3c Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 22:47:17 -0700 Subject: npx vsce --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 5f2571ab..0d51d0c0 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -107,7 +107,7 @@ jobs: run: | cd extension npm run package - vsce publish patch -p ${{ secrets.VSCE_TOKEN }} + npx vsce publish patch -p ${{ secrets.VSCE_TOKEN }} - name: Commit changes run: | -- cgit v1.2.3-70-g09d2 From 48feeb55877aa95e91707beca228237fba74543a Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 1 Aug 2023 23:14:40 -0700 Subject: remove data file --- .github/workflows/main.yaml | 2 +- continuedev/src/continuedev/core/sdk.py | 2 +- .../continuedev/libs/constants/default_config.py | 128 +++++++++++++++++++++ .../libs/constants/default_config.py.txt | 126 -------------------- continuedev/src/continuedev/libs/util/paths.py | 11 +- 5 files changed, 132 insertions(+), 137 deletions(-) create mode 100644 continuedev/src/continuedev/libs/constants/default_config.py delete mode 100644 continuedev/src/continuedev/libs/constants/default_config.py.txt (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 0d51d0c0..7787ddad 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -113,7 +113,7 @@ jobs: run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - git commit -am "Update package.json version [skip ci]" + git commit -am "ci: 💚 Update package.json version [skip ci]" - name: Push changes uses: ad-m/github-push-action@master diff --git a/continuedev/src/continuedev/core/sdk.py b/continuedev/src/continuedev/core/sdk.py index a5b16168..57e2c099 100644 --- a/continuedev/src/continuedev/core/sdk.py +++ b/continuedev/src/continuedev/core/sdk.py @@ -54,7 +54,7 @@ class ContinueSDK(AbstractContinueSDK): formatted_err = '\n'.join(traceback.format_exception(e)) msg_step = MessageStep( name="Invalid Continue Config File", message=formatted_err) - msg_step.description = f"Falling back to default config settings.\n```\n{formatted_err}\n```\n\nIt's possible this error was caused by an update to the Continue config format. If you'd like to see the new recommended default `config.py`, check [here](https://github.com/continuedev/continue/blob/main/continuedev/src/continuedev/libs/constants/default_config.py.txt)." + msg_step.description = f"Falling back to default config settings.\n```\n{formatted_err}\n```\n\nIt's possible this error was caused by an update to the Continue config format. If you'd like to see the new recommended default `config.py`, check [here](https://github.com/continuedev/continue/blob/main/continuedev/src/continuedev/libs/constants/default_config.py)." sdk.history.add_node(HistoryNode( step=msg_step, observation=None, diff --git a/continuedev/src/continuedev/libs/constants/default_config.py b/continuedev/src/continuedev/libs/constants/default_config.py new file mode 100644 index 00000000..9d6d4270 --- /dev/null +++ b/continuedev/src/continuedev/libs/constants/default_config.py @@ -0,0 +1,128 @@ +default_config = """\ +\"\"\" +This is the Continue configuration file. + +If you aren't getting strong typing on these imports, +be sure to select the Python interpreter in ~/.continue/server/env. +\"\"\" + +import subprocess + +from continuedev.core.main import Step +from continuedev.core.sdk import ContinueSDK +from continuedev.core.models import Models +from continuedev.core.config import CustomCommand, SlashCommand, ContinueConfig +from continuedev.plugins.context_providers.github import GitHubIssuesContextProvider +from continuedev.plugins.context_providers.google import GoogleContextProvider +from continuedev.libs.llm.maybe_proxy_openai import MaybeProxyOpenAI +from continuedev.plugins.policies.default import DefaultPolicy + +from continuedev.plugins.steps.open_config import OpenConfigStep +from continuedev.plugins.steps.clear_history import ClearHistoryStep +from continuedev.plugins.steps.feedback import FeedbackStep +from continuedev.plugins.steps.comment_code import CommentCodeStep +from continuedev.plugins.steps.main import EditHighlightedCodeStep + + +class CommitMessageStep(Step): + \"\"\" + This is a Step, the building block of Continue. + It can be used below as a slash command, so that + run will be called when you type '/commit'. + \"\"\" + async def run(self, sdk: ContinueSDK): + + # Get the root directory of the workspace + dir = sdk.ide.workspace_directory + + # Run git diff in that directory + diff = subprocess.check_output( + ["git", "diff"], cwd=dir).decode("utf-8") + + # Ask the LLM to write a commit message, + # and set it as the description of this step + self.description = await sdk.models.default.complete( + f"{diff}\n\nWrite a short, specific (less than 50 chars) commit message about the above changes:") + + +config = ContinueConfig( + + # If set to False, we will not collect any usage data + # See here to learn what anonymous data we collect: https://continue.dev/docs/telemetry + allow_anonymous_telemetry=True, + + models=Models( + default=MaybeProxyOpenAI(model="gpt-4"), + medium=MaybeProxyOpenAI(model="gpt-3.5-turbo") + ), + + # Set a system message with information that the LLM should always keep in mind + # E.g. "Please give concise answers. Always respond in Spanish." + system_message=None, + + # Set temperature to any value between 0 and 1. Higher values will make the LLM + # more creative, while lower values will make it more predictable. + temperature=0.5, + + # Custom commands let you map a prompt to a shortened slash command + # They are like slash commands, but more easily defined - write just a prompt instead of a Step class + # Their output will always be in chat form + custom_commands=[CustomCommand( + name="test", + description="This is an example custom command. Use /config to edit it and create more", + prompt="Write a comprehensive set of unit tests for the selected code. It should setup, run tests that check for correctness including important edge cases, and teardown. Ensure that the tests are complete and sophisticated. Give the tests just as chat output, don't edit any file.", + )], + + # Slash commands let you run a Step from a slash command + slash_commands=[ + # SlashCommand( + # name="commit", + # description="This is an example slash command. Use /config to edit it and create more", + # step=CommitMessageStep, + # ) + SlashCommand( + name="edit", + description="Edit code in the current file or the highlighted code", + step=EditHighlightedCodeStep, + ), + SlashCommand( + name="config", + description="Open the config file to create new and edit existing slash commands", + step=OpenConfigStep, + ), + SlashCommand( + name="comment", + description="Write comments for the current file or highlighted code", + step=CommentCodeStep, + ), + SlashCommand( + name="feedback", + description="Send feedback to improve Continue", + step=FeedbackStep, + ), + SlashCommand( + name="clear", + description="Clear step history", + step=ClearHistoryStep, + ) + ], + + # Context providers let you quickly select context by typing '@' + # Uncomment the following to + # - quickly reference GitHub issues + # - show Google search results to the LLM + context_providers=[ + # GitHubIssuesContextProvider( + # repo_name="/", + # auth_token="" + # ), + # GoogleContextProvider( + # serper_api_key="" + # ) + ], + + # Policies hold the main logic that decides which Step to take next + # You can use them to design agents, or deeply customize Continue + policy=DefaultPolicy() +) +""" diff --git a/continuedev/src/continuedev/libs/constants/default_config.py.txt b/continuedev/src/continuedev/libs/constants/default_config.py.txt deleted file mode 100644 index cf8b0324..00000000 --- a/continuedev/src/continuedev/libs/constants/default_config.py.txt +++ /dev/null @@ -1,126 +0,0 @@ -""" -This is the Continue configuration file. - -If you aren't getting strong typing on these imports, -be sure to select the Python interpreter in ~/.continue/server/env. -""" - -import subprocess - -from continuedev.core.main import Step -from continuedev.core.sdk import ContinueSDK -from continuedev.core.models import Models -from continuedev.core.config import CustomCommand, SlashCommand, ContinueConfig -from continuedev.plugins.context_providers.github import GitHubIssuesContextProvider -from continuedev.plugins.context_providers.google import GoogleContextProvider -from continuedev.libs.llm.maybe_proxy_openai import MaybeProxyOpenAI -from continuedev.plugins.policies.default import DefaultPolicy - -from continuedev.plugins.steps.open_config import OpenConfigStep -from continuedev.plugins.steps.clear_history import ClearHistoryStep -from continuedev.plugins.steps.feedback import FeedbackStep -from continuedev.plugins.steps.comment_code import CommentCodeStep -from continuedev.plugins.steps.main import EditHighlightedCodeStep - - -class CommitMessageStep(Step): - """ - This is a Step, the building block of Continue. - It can be used below as a slash command, so that - run will be called when you type '/commit'. - """ - async def run(self, sdk: ContinueSDK): - - # Get the root directory of the workspace - dir = sdk.ide.workspace_directory - - # Run git diff in that directory - diff = subprocess.check_output( - ["git", "diff"], cwd=dir).decode("utf-8") - - # Ask the LLM to write a commit message, - # and set it as the description of this step - self.description = await sdk.models.default.complete( - f"{diff}\n\nWrite a short, specific (less than 50 chars) commit message about the above changes:") - - -config = ContinueConfig( - - # If set to False, we will not collect any usage data - # See here to learn what anonymous data we collect: https://continue.dev/docs/telemetry - allow_anonymous_telemetry=True, - - models=Models( - default=MaybeProxyOpenAI(model="gpt-4"), - medium=MaybeProxyOpenAI(model="gpt-3.5-turbo") - ), - - # Set a system message with information that the LLM should always keep in mind - # E.g. "Please give concise answers. Always respond in Spanish." - system_message=None, - - # Set temperature to any value between 0 and 1. Higher values will make the LLM - # more creative, while lower values will make it more predictable. - temperature=0.5, - - # Custom commands let you map a prompt to a shortened slash command - # They are like slash commands, but more easily defined - write just a prompt instead of a Step class - # Their output will always be in chat form - custom_commands=[CustomCommand( - name="test", - description="This is an example custom command. Use /config to edit it and create more", - prompt="Write a comprehensive set of unit tests for the selected code. It should setup, run tests that check for correctness including important edge cases, and teardown. Ensure that the tests are complete and sophisticated. Give the tests just as chat output, don't edit any file.", - )], - - # Slash commands let you run a Step from a slash command - slash_commands=[ - # SlashCommand( - # name="commit", - # description="This is an example slash command. Use /config to edit it and create more", - # step=CommitMessageStep, - # ) - SlashCommand( - name="edit", - description="Edit code in the current file or the highlighted code", - step=EditHighlightedCodeStep, - ), - SlashCommand( - name="config", - description="Open the config file to create new and edit existing slash commands", - step=OpenConfigStep, - ), - SlashCommand( - name="comment", - description="Write comments for the current file or highlighted code", - step=CommentCodeStep, - ), - SlashCommand( - name="feedback", - description="Send feedback to improve Continue", - step=FeedbackStep, - ), - SlashCommand( - name="clear", - description="Clear step history", - step=ClearHistoryStep, - ) - ], - - # Context providers let you quickly select context by typing '@' - # Uncomment the following to - # - quickly reference GitHub issues - # - show Google search results to the LLM - context_providers=[ - # GitHubIssuesContextProvider( - # repo_name="/", - # auth_token="" - # ), - # GoogleContextProvider( - # serper_api_key="" - # ) - ], - - # Policies hold the main logic that decides which Step to take next - # You can use them to design agents, or deeply customize Continue - policy=DefaultPolicy() -) diff --git a/continuedev/src/continuedev/libs/util/paths.py b/continuedev/src/continuedev/libs/util/paths.py index 6385dc6f..a659f044 100644 --- a/continuedev/src/continuedev/libs/util/paths.py +++ b/continuedev/src/continuedev/libs/util/paths.py @@ -1,6 +1,6 @@ import os -import sys from ..constants.main import CONTINUE_SESSIONS_FOLDER, CONTINUE_GLOBAL_FOLDER, CONTINUE_SERVER_FOLDER +from ..constants.default_config import default_config def find_data_file(filename): @@ -32,20 +32,13 @@ def getSessionFilePath(session_id: str): return path -def getDefaultConfigFile() -> str: - default_config_path = find_data_file(os.path.join( - "..", "constants", "default_config.py.txt")) - with open(default_config_path, 'r') as f: - return f.read() - - def getConfigFilePath() -> str: path = os.path.join(getGlobalFolderPath(), "config.py") os.makedirs(os.path.dirname(path), exist_ok=True) if not os.path.exists(path): with open(path, 'w') as f: - f.write(getDefaultConfigFile()) + f.write(default_config) return path -- cgit v1.2.3-70-g09d2 From f18ddbc962059a6df1f8cc858d1ac88d9ec04887 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 2 Aug 2023 15:41:10 -0700 Subject: attempting alternative solution to import config --- .github/workflows/main.yaml | 25 ++++++------ continuedev/src/continuedev/core/sdk.py | 50 ++++++++++++++++++++++- continuedev/src/continuedev/libs/llm/anthropic.py | 4 -- cxf.py | 14 ------- 4 files changed, 60 insertions(+), 33 deletions(-) delete mode 100644 cxf.py (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 7787ddad..365f7b7d 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -107,19 +107,18 @@ jobs: run: | cd extension npm run package - npx vsce publish patch -p ${{ secrets.VSCE_TOKEN }} - - - name: Commit changes - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git commit -am "ci: 💚 Update package.json version [skip ci]" - - - name: Push changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }} + # npx vsce publish patch -p ${{ secrets.VSCE_TOKEN }} + # - name: Commit changes + # run: | + # git config --local user.email "action@github.com" + # git config --local user.name "GitHub Action" + # git commit -am "ci: 💚 Update package.json version [skip ci]" + + # - name: Push changes + # uses: ad-m/github-push-action@master + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # branch: ${{ github.ref }} - name: Upload .vsix artifact uses: actions/upload-artifact@v2 diff --git a/continuedev/src/continuedev/core/sdk.py b/continuedev/src/continuedev/core/sdk.py index 57e2c099..42cfbcb9 100644 --- a/continuedev/src/continuedev/core/sdk.py +++ b/continuedev/src/continuedev/core/sdk.py @@ -1,7 +1,7 @@ -from functools import cached_property import traceback -from typing import Coroutine, Dict, Literal, Union +from typing import Coroutine, Union import os +import importlib from ..plugins.steps.core.core import DefaultModelEditCodeStep from ..models.main import Range @@ -164,6 +164,52 @@ class ContinueSDK(AbstractContinueSDK): _last_valid_config: ContinueConfig = None def _load_config_dot_py(self) -> ContinueConfig: + # Read the file content + with open(os.path.expanduser('~/.continue/config.py')) as file: + config_content = file.read() + + def load_module(module_name: str, class_names: List[str]): + # from anthropic import AsyncAnthropic + module = importlib.import_module(module_name) + for class_name in class_names: + globals()[class_name] = getattr(module, class_name) + + while True: + # Execute the file content + locals_var = {} + try: + import importlib.util + spec = importlib.util.spec_from_file_location( + "config", "/Users/natesesti/.continue/config.py") + config = importlib.util.module_from_spec(spec) + spec.loader.exec_module(config) + + return config.config + # exec(config_content, globals(), locals_var) + # print("Done executing, ", locals_var) + # return locals_var['config'] + except ModuleNotFoundError as e: + print("ModuleNotFoundError") + print(e) + print(traceback.format_exception(e)) + formatted = traceback.format_exception(e) + line = formatted[-2].split("\n")[-2].strip().split() + # Parse the module name and class name from the error message + # Example: ModuleNotFoundError: No module named 'continuedev.src.continuedev.plugins.context_providers.google' + + # Get the module name + module_name = line[1] + # Get the class name + class_names = list(map(lambda x: x.replace(",", ""), filter(lambda x: x.strip() != "", line[3:]))) + + # Load the module + print( + f"Loading module {module_name} with class names {class_names}") + load_module(module_name, class_names) + except Exception as e: + print("Failed to execute config.py: ", e) + raise e + # Use importlib to load the config file config.py at the given path path = getConfigFilePath() diff --git a/continuedev/src/continuedev/libs/llm/anthropic.py b/continuedev/src/continuedev/libs/llm/anthropic.py index ec1b7e40..e6b88d03 100644 --- a/continuedev/src/continuedev/libs/llm/anthropic.py +++ b/continuedev/src/continuedev/libs/llm/anthropic.py @@ -17,10 +17,6 @@ class AnthropicLLM(LLM): class Config: arbitrary_types_allowed = True - def __init__(self, model: str, system_message: str = None): - self.model = model - self.system_message = system_message - async def start(self, *, api_key: Optional[str] = None, **kwargs): self._async_client = AsyncAnthropic(api_key=api_key) diff --git a/cxf.py b/cxf.py deleted file mode 100644 index b8610999..00000000 --- a/cxf.py +++ /dev/null @@ -1,14 +0,0 @@ -from cx_Freeze import setup, Executable - -setup( - name="Continue", - version="0.1", - description="Continue Server", - executables=[Executable("run.py")], - - options={ - "build_exe": { - "excludes": ["unnecessary_module"], - }, - }, -) -- cgit v1.2.3-70-g09d2 From 54111067474b62f652c157a5f5289c9eba2555e5 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 2 Aug 2023 19:19:34 -0700 Subject: add --hidden-imports, simplify sdk.py --- .github/workflows/main.yaml | 2 +- continuedev/src/continuedev/core/sdk.py | 54 --------------------------------- 2 files changed, 1 insertion(+), 55 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 365f7b7d..1309aa24 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -31,7 +31,7 @@ jobs: run: | pip install -r continuedev/requirements.txt - - run: pyinstaller run.py --exclude-module numpy --exclude-module jedi -F + - run: pyinstaller run.py --exclude-module numpy --exclude-module jedi -F --add-data 'continuedev:continuedev' --hidden-import=anthropic --hidden-import=github - name: Set permissions run: | diff --git a/continuedev/src/continuedev/core/sdk.py b/continuedev/src/continuedev/core/sdk.py index d040ea41..5065ff88 100644 --- a/continuedev/src/continuedev/core/sdk.py +++ b/continuedev/src/continuedev/core/sdk.py @@ -18,7 +18,6 @@ from ..libs.util.telemetry import posthog_logger from ..libs.util.paths import getConfigFilePath from .models import Models from ..libs.util.logging import logger -# __import__("anthropic", globals(), locals(), ["AsyncAnthropic"], 0) class Autopilot: @@ -166,59 +165,6 @@ class ContinueSDK(AbstractContinueSDK): _last_valid_config: ContinueConfig = None def _load_config_dot_py(self) -> ContinueConfig: - # Read the file content - with open(os.path.expanduser('~/.continue/config.py')) as file: - config_content = file.read() - - def load_module(module_name: str, class_names: List[str]): - # from anthropic import AsyncAnthropic - print("IMPORTING") - # exec("from anthropic import AsyncAnthropic", globals(), locals()) - # imports = __import__("anthropic", globals(), locals(), ["AsyncAnthropic"], 0) - # print("IMPORTS: ", imports) - # for class_name in class_names: - # globals()[class_name] = getattr(imports, class_name) - # module = importlib.import_module(module_name) - # for class_name in class_names: - # globals()[class_name] = getattr(module, class_name) - - while True: - # Execute the file content - locals_var = {} - try: - import importlib.util - spec = importlib.util.spec_from_file_location( - "config", "/Users/natesesti/.continue/config.py") - config = importlib.util.module_from_spec(spec) - spec.loader.exec_module(config) - - return config.config - # exec(config_content, globals(), locals_var) - # print("Done executing, ", locals_var) - # return locals_var['config'] - except ModuleNotFoundError as e: - print("ModuleNotFoundError") - print(e) - print(traceback.format_exception(e)) - formatted = traceback.format_exception(e) - line = formatted[-2].split("\n")[-2].strip().split() - # Parse the module name and class name from the error message - # Example: ModuleNotFoundError: No module named 'continuedev.src.continuedev.plugins.context_providers.google' - - # Get the module name - module_name = line[1] - # Get the class name - class_names = list(map(lambda x: x.replace( - ",", ""), filter(lambda x: x.strip() != "", line[3:]))) - - # Load the module - print( - f"Loading module {module_name} with class names {class_names}") - load_module(module_name, class_names) - except Exception as e: - print("Failed to execute config.py: ", e) - raise e - # Use importlib to load the config file config.py at the given path path = getConfigFilePath() -- cgit v1.2.3-70-g09d2 From cad61f92776c2680ea4e5fe0ecb7e29d62e3b83a Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 2 Aug 2023 19:24:15 -0700 Subject: semi-colon for windows in --add-data flag --- .github/workflows/main.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 1309aa24..f915419c 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -31,7 +31,13 @@ jobs: run: | pip install -r continuedev/requirements.txt - - run: pyinstaller run.py --exclude-module numpy --exclude-module jedi -F --add-data 'continuedev:continuedev' --hidden-import=anthropic --hidden-import=github + - name: Build PyInstaller Executable + run: | + if [[ "${{ runner.os }}" == "Windows" ]]; then + pyinstaller run.py --exclude-module numpy --exclude-module jedi -F --add-data 'continuedev;continuedev' --hidden-import=anthropic --hidden-import=github + else + pyinstaller run.py --exclude-module numpy --exclude-module jedi -F --add-data 'continuedev:continuedev' --hidden-import=anthropic --hidden-import=github + fi - name: Set permissions run: | -- cgit v1.2.3-70-g09d2 From 66ca6647cbad2a0e7525919e7aa3a28acb8dad8b Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 2 Aug 2023 19:32:15 -0700 Subject: fix if statement --- .github/workflows/main.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index f915419c..1b1e397c 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -31,13 +31,13 @@ jobs: run: | pip install -r continuedev/requirements.txt - - name: Build PyInstaller Executable - run: | - if [[ "${{ runner.os }}" == "Windows" ]]; then - pyinstaller run.py --exclude-module numpy --exclude-module jedi -F --add-data 'continuedev;continuedev' --hidden-import=anthropic --hidden-import=github - else - pyinstaller run.py --exclude-module numpy --exclude-module jedi -F --add-data 'continuedev:continuedev' --hidden-import=anthropic --hidden-import=github - fi + - name: Build PyInstaller Executable for Windows + run: pyinstaller run.py --exclude-module numpy --exclude-module jedi -F --add-data 'continuedev;continuedev' --hidden-import=anthropic --hidden-import=github + if: matrix.os == 'windows-latest' + + - name: Build PyInstaller Executable for Mac/Linux + run: pyinstaller run.py --exclude-module numpy --exclude-module jedi -F --add-data 'continuedev:continuedev' --hidden-import=anthropic --hidden-import=github + if: matrix.os != 'windows-latest' - name: Set permissions run: | -- cgit v1.2.3-70-g09d2 From e3c6e18143d1751a33d65d92ea133b789492eade Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 2 Aug 2023 20:09:46 -0700 Subject: sync with AWS S3 bucket --- .github/workflows/main.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 1b1e397c..c928a5fa 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -131,3 +131,17 @@ jobs: with: name: vsix-artifact path: extension/build/* + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-west-2 + + - name: Upload binaries to S3 + uses: aws-actions/s3-sync@v1 + with: + source_dir: extension/server/exe + bucket: continue-server-binaries + bucket_path: exe -- cgit v1.2.3-70-g09d2 From 979be7ff6260b985b01df555e32d0b91bfaa0128 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 2 Aug 2023 20:15:40 -0700 Subject: fix s3-sync step --- .github/workflows/main.yaml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index c928a5fa..69b3578d 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -140,8 +140,12 @@ jobs: aws-region: us-west-2 - name: Upload binaries to S3 - uses: aws-actions/s3-sync@v1 + uses: jakejarvis/s3-sync-action@master with: - source_dir: extension/server/exe - bucket: continue-server-binaries - bucket_path: exe + args: --acl public-read --follow-symlinks --delete + env: + AWS_S3_BUCKET: continue-server-binaries + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: "us-west-1" + SOURCE_DIR: "extension/server/exe" -- cgit v1.2.3-70-g09d2 From 2744e4807aec614c887808cf725bbf20fb0848bd Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 2 Aug 2023 20:23:41 -0700 Subject: remove acl --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 69b3578d..ad5a70a2 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -142,7 +142,7 @@ jobs: - name: Upload binaries to S3 uses: jakejarvis/s3-sync-action@master with: - args: --acl public-read --follow-symlinks --delete + args: --follow-symlinks --delete env: AWS_S3_BUCKET: continue-server-binaries AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} -- cgit v1.2.3-70-g09d2 From d8958e3ca256cacdd2073ef390e842d3f3ffbc54 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 2 Aug 2023 20:34:20 -0700 Subject: add back acl --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index ad5a70a2..69b3578d 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -142,7 +142,7 @@ jobs: - name: Upload binaries to S3 uses: jakejarvis/s3-sync-action@master with: - args: --follow-symlinks --delete + args: --acl public-read --follow-symlinks --delete env: AWS_S3_BUCKET: continue-server-binaries AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} -- cgit v1.2.3-70-g09d2 From 9e14a2984d0c83c944cd76270fad8d1debc6b042 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 2 Aug 2023 21:28:32 -0700 Subject: publish in github workflow --- .github/workflows/main.yaml | 24 ++++++++++++------------ extension/package.json | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 69b3578d..46b50ef3 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -113,18 +113,18 @@ jobs: run: | cd extension npm run package - # npx vsce publish patch -p ${{ secrets.VSCE_TOKEN }} - # - name: Commit changes - # run: | - # git config --local user.email "action@github.com" - # git config --local user.name "GitHub Action" - # git commit -am "ci: 💚 Update package.json version [skip ci]" - - # - name: Push changes - # uses: ad-m/github-push-action@master - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # branch: ${{ github.ref }} + npx vsce publish patch -p ${{ secrets.VSCE_TOKEN }} + - name: Commit changes + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git commit -am "ci: 💚 Update package.json version [skip ci]" + + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} - name: Upload .vsix artifact uses: actions/upload-artifact@v2 diff --git a/extension/package.json b/extension/package.json index 49182af6..a8345887 100644 --- a/extension/package.json +++ b/extension/package.json @@ -14,7 +14,7 @@ "displayName": "Continue", "pricing": "Free", "description": "The open-source coding autopilot", - "version": "0.0.240", + "version": "0.0.241", "publisher": "Continue", "engines": { "vscode": "^1.67.0" -- cgit v1.2.3-70-g09d2 From b194a66f392fe67a9a8d0dbd58fb4d8055ca7261 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 2 Aug 2023 21:40:21 -0700 Subject: don't include binaries with extension --- .github/workflows/main.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 46b50ef3..8610f363 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -63,19 +63,19 @@ jobs: uses: actions/download-artifact@v2 with: name: Linux Build - path: extension/server/exe/linux + path: exe/linux - name: Download macOS build uses: actions/download-artifact@v2 with: name: macOS Build - path: extension/server/exe/mac + path: exe/mac - name: Download Windows build uses: actions/download-artifact@v2 with: name: Windows Build - path: extension/server/exe/windows + path: exe/windows - name: Use Node.js 19.0.0 uses: actions/setup-node@v3 @@ -148,4 +148,4 @@ jobs: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_REGION: "us-west-1" - SOURCE_DIR: "extension/server/exe" + SOURCE_DIR: "exe" -- cgit v1.2.3-70-g09d2 From fdb043a2320abcea3f9c835c6dcdec0050e89553 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 2 Aug 2023 22:20:26 -0700 Subject: logging --- .github/workflows/main.yaml | 24 ++++++++++++------------ extension/src/activation/environmentSetup.ts | 17 ++++++++++++++--- 2 files changed, 26 insertions(+), 15 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 8610f363..67d248e2 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -113,18 +113,18 @@ jobs: run: | cd extension npm run package - npx vsce publish patch -p ${{ secrets.VSCE_TOKEN }} - - name: Commit changes - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git commit -am "ci: 💚 Update package.json version [skip ci]" - - - name: Push changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }} + # npx vsce publish patch -p ${{ secrets.VSCE_TOKEN }} + # - name: Commit changes + # run: | + # git config --local user.email "action@github.com" + # git config --local user.name "GitHub Action" + # git commit -am "ci: 💚 Update package.json version [skip ci]" + + # - name: Push changes + # uses: ad-m/github-push-action@master + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # branch: ${{ github.ref }} - name: Upload .vsix artifact uses: actions/upload-artifact@v2 diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index b25c7b82..6bfa7d07 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -139,16 +139,17 @@ export async function startContinuePythonServer() { // Check vscode settings const serverUrl = getContinueServerUrl(); if (serverUrl !== "http://localhost:65432") { + console.log("Continue server is being run manually, skipping start"); return; } // Check if server is already running if (await checkOrKillRunningServer(serverUrl)) { + console.log("Continue server already running"); return; } // Download the server executable - const bucket = "continue-server-binaries"; const fileName = os.platform() === "win32" @@ -189,14 +190,24 @@ export async function startContinuePythonServer() { ); } + console.log("Downloaded server executable at ", destination); // Get name of the corresponding executable for platform if (os.platform() === "darwin") { // Add necessary permissions - await runCommand(`chmod +x ${destination}`); - await runCommand(`xattr -dr com.apple.quarantine ${destination}`); + const [stdout, stderr] = await runCommand(`chmod +x ${destination}`); + console.log("Setting permissions for Continue server..."); + console.log(stdout); + console.log(stderr); + const [stdout1, stderr1] = await runCommand( + `xattr -dr com.apple.quarantine ${destination}` + ); + console.log("..."); + console.log(stdout1); + console.log(stderr1); } // Run the executable + console.log("Starting Continue server..."); const child = spawn(destination, { shell: true, }); -- cgit v1.2.3-70-g09d2 From 0e6a0c94254de045bf3c722089228b0e033f7255 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 2 Aug 2023 22:40:54 -0700 Subject: await file download --- .github/workflows/main.yaml | 24 ++++++++++++------------ extension/src/activation/environmentSetup.ts | 11 ++++------- 2 files changed, 16 insertions(+), 19 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 67d248e2..8610f363 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -113,18 +113,18 @@ jobs: run: | cd extension npm run package - # npx vsce publish patch -p ${{ secrets.VSCE_TOKEN }} - # - name: Commit changes - # run: | - # git config --local user.email "action@github.com" - # git config --local user.name "GitHub Action" - # git commit -am "ci: 💚 Update package.json version [skip ci]" - - # - name: Push changes - # uses: ad-m/github-push-action@master - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # branch: ${{ github.ref }} + npx vsce publish patch -p ${{ secrets.VSCE_TOKEN }} + - name: Commit changes + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git commit -am "ci: 💚 Update package.json version [skip ci]" + + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} - name: Upload .vsix artifact uses: actions/upload-artifact@v2 diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index 6bfa7d07..a1c4f7ee 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -178,7 +178,7 @@ export async function startContinuePythonServer() { } if (shouldDownload) { - vscode.window.withProgress( + await vscode.window.withProgress( { location: vscode.ProgressLocation.Notification, title: "Installing Continue server...", @@ -194,16 +194,13 @@ export async function startContinuePythonServer() { // Get name of the corresponding executable for platform if (os.platform() === "darwin") { // Add necessary permissions - const [stdout, stderr] = await runCommand(`chmod +x ${destination}`); console.log("Setting permissions for Continue server..."); - console.log(stdout); - console.log(stderr); + fs.chmodSync(destination, 0o7_5_5); const [stdout1, stderr1] = await runCommand( `xattr -dr com.apple.quarantine ${destination}` ); - console.log("..."); - console.log(stdout1); - console.log(stderr1); + console.log("stdout: ", stdout1); + console.log("stderr: ", stderr1); } // Run the executable -- cgit v1.2.3-70-g09d2