diff --git a/.github/workflows/python.yaml b/.github/workflows/python.yaml new file mode 100644 index 000000000..af5291531 --- /dev/null +++ b/.github/workflows/python.yaml @@ -0,0 +1,38 @@ +on: + push: + branches: [main] + pull_request: + +defaults: + run: + working-directory: ./server + +jobs: + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: "3.12" + - uses: snok/install-poetry@v1 + - name: Install dependencies + run: poetry install --only lint + - name: Run Ruff + run: poetry run ruff check --output-format=github . + + # test: + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v4 + # - name: Install Python + # uses: actions/setup-python@v4 + # with: + # python-version: "3.12" + # - uses: snok/install-poetry@v1 + # - run: poetry run python -m pip install --upgrade pip setuptools + # - name: Install dependencies + # run: poetry install + # - run: poetry run pytest diff --git a/server/continuedev/core/steps.py b/server/continuedev/core/steps.py index 6948f4755..724324de3 100644 --- a/server/continuedev/core/steps.py +++ b/server/continuedev/core/steps.py @@ -24,7 +24,6 @@ from .main import ( ChatMessage, ContextItem, ContinueCustomException, - DeltaStep, SessionUpdate, SetStep, Step, diff --git a/server/continuedev/libs/index/pipelines/main.py b/server/continuedev/libs/index/pipelines/main.py index 63ea34df9..396e598c8 100644 --- a/server/continuedev/libs/index/pipelines/main.py +++ b/server/continuedev/libs/index/pipelines/main.py @@ -5,7 +5,6 @@ from ..chunkers.chunk import Chunk from ..hyde import code_hyde from ..indices.chroma_index import ChromaCodebaseIndex from ..indices.meilisearch_index import MeilisearchCodebaseIndex -from ..rerankers.default import default_reranker_parallel from ..rerankers.single_token import single_token_reranker_parallel @@ -59,7 +58,7 @@ async def main_retrieval_pipeline( ) # Rerank to select top results if use_reranking: - print(f"Selecting most important files...") + print("Selecting most important files...") chunks = await single_token_reranker_parallel( chunks, query, diff --git a/server/continuedev/libs/util/copy_codebase.py b/server/continuedev/libs/util/copy_codebase.py index 78f381487..7e26f15fe 100644 --- a/server/continuedev/libs/util/copy_codebase.py +++ b/server/continuedev/libs/util/copy_codebase.py @@ -3,6 +3,8 @@ import shutil from pathlib import Path from typing import Iterable, List, Union +from continuedev.libs.util.calculate_diff import calculate_diff + from watchdog.events import PatternMatchingEventHandler from watchdog.observers import Observer diff --git a/server/continuedev/plugins/recipes/TemplateRecipe/main.py b/server/continuedev/plugins/recipes/TemplateRecipe/main.py index 682762ac2..8f21ea435 100644 --- a/server/continuedev/plugins/recipes/TemplateRecipe/main.py +++ b/server/continuedev/plugins/recipes/TemplateRecipe/main.py @@ -1,6 +1,6 @@ from typing import Coroutine -from ....core.main import Observation, Step +from ....core.main import Step from ....core.sdk import ContinueSDK, Models diff --git a/server/continuedev/plugins/steps/codebase.py b/server/continuedev/plugins/steps/codebase.py index 568dadb37..9645bfd01 100644 --- a/server/continuedev/plugins/steps/codebase.py +++ b/server/continuedev/plugins/steps/codebase.py @@ -2,7 +2,7 @@ import asyncio import os from typing import List, Optional, Union -from ...core.config import ModelDescription, RetrievalSettings +from ...core.config import RetrievalSettings from ...core.main import ( ContextItem, ContextItemDescription, diff --git a/server/continuedev/plugins/steps/steps_on_startup.py b/server/continuedev/plugins/steps/steps_on_startup.py index 2791ea500..6abd82822 100644 --- a/server/continuedev/plugins/steps/steps_on_startup.py +++ b/server/continuedev/plugins/steps/steps_on_startup.py @@ -1,5 +1,3 @@ -from typing import Type - from ...core.main import Step from ...core.sdk import ContinueSDK, Models diff --git a/server/poetry.lock b/server/poetry.lock index e3bb9e3e4..6f68f49c3 100644 --- a/server/poetry.lock +++ b/server/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. [[package]] name = "aiofiles" @@ -1671,6 +1671,16 @@ files = [ {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win32.whl", hash = "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-win32.whl", hash = "sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-win_amd64.whl", hash = "sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707"}, @@ -3449,6 +3459,32 @@ files = [ [package.dependencies] pyasn1 = ">=0.1.3" +[[package]] +name = "ruff" +version = "0.1.8" +description = "An extremely fast Python linter and code formatter, written in Rust." +optional = false +python-versions = ">=3.7" +files = [ + {file = "ruff-0.1.8-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:7de792582f6e490ae6aef36a58d85df9f7a0cfd1b0d4fe6b4fb51803a3ac96fa"}, + {file = "ruff-0.1.8-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:c8e3255afd186c142eef4ec400d7826134f028a85da2146102a1172ecc7c3696"}, + {file = "ruff-0.1.8-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ff78a7583020da124dd0deb835ece1d87bb91762d40c514ee9b67a087940528b"}, + {file = "ruff-0.1.8-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bd8ee69b02e7bdefe1e5da2d5b6eaaddcf4f90859f00281b2333c0e3a0cc9cd6"}, + {file = "ruff-0.1.8-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a05b0ddd7ea25495e4115a43125e8a7ebed0aa043c3d432de7e7d6e8e8cd6448"}, + {file = "ruff-0.1.8-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:e6f08ca730f4dc1b76b473bdf30b1b37d42da379202a059eae54ec7fc1fbcfed"}, + {file = "ruff-0.1.8-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f35960b02df6b827c1b903091bb14f4b003f6cf102705efc4ce78132a0aa5af3"}, + {file = "ruff-0.1.8-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7d076717c67b34c162da7c1a5bda16ffc205e0e0072c03745275e7eab888719f"}, + {file = "ruff-0.1.8-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b6a21ab023124eafb7cef6d038f835cb1155cd5ea798edd8d9eb2f8b84be07d9"}, + {file = "ruff-0.1.8-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:ce697c463458555027dfb194cb96d26608abab920fa85213deb5edf26e026664"}, + {file = "ruff-0.1.8-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:db6cedd9ffed55548ab313ad718bc34582d394e27a7875b4b952c2d29c001b26"}, + {file = "ruff-0.1.8-py3-none-musllinux_1_2_i686.whl", hash = "sha256:05ffe9dbd278965271252704eddb97b4384bf58b971054d517decfbf8c523f05"}, + {file = "ruff-0.1.8-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:5daaeaf00ae3c1efec9742ff294b06c3a2a9db8d3db51ee4851c12ad385cda30"}, + {file = "ruff-0.1.8-py3-none-win32.whl", hash = "sha256:e49fbdfe257fa41e5c9e13c79b9e79a23a79bd0e40b9314bc53840f520c2c0b3"}, + {file = "ruff-0.1.8-py3-none-win_amd64.whl", hash = "sha256:f41f692f1691ad87f51708b823af4bb2c5c87c9248ddd3191c8f088e66ce590a"}, + {file = "ruff-0.1.8-py3-none-win_arm64.whl", hash = "sha256:aa8ee4f8440023b0a6c3707f76cadce8657553655dcbb5fc9b2f9bb9bee389f6"}, + {file = "ruff-0.1.8.tar.gz", hash = "sha256:f7ee467677467526cfe135eab86a40a0e8db43117936ac4f9b469ce9cdb3fb62"}, +] + [[package]] name = "setuptools" version = "69.0.2" @@ -4569,4 +4605,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "^3.8.1" -content-hash = "5900b36dc15aa206ccc85fafe7aecdf58a6ec3aa1ff52cdde8efa83a5dc85654" +content-hash = "f55a872cb4ea78845d12c1176cd9d350128c4fa25d07d7a99a1b0b302e82f4fa" diff --git a/server/pyproject.toml b/server/pyproject.toml index d33f3a875..80c3e59f3 100644 --- a/server/pyproject.toml +++ b/server/pyproject.toml @@ -56,6 +56,9 @@ pytest = "^7.4.1" pytest-asyncio = "^0.21.1" ipykernel = "^6.26.0" +[tool.poetry.group.lint.dependencies] +ruff = "==0.1.8" + [build-system] requires = ["poetry-core", "maturin>=1,<2"] # build-backend = "poetry.core.masonry.api" diff --git a/server/tests/config/examples/config_1.py b/server/tests/config/examples/config_1.py index 9dd334c22..1329d6b06 100644 --- a/server/tests/config/examples/config_1.py +++ b/server/tests/config/examples/config_1.py @@ -9,7 +9,6 @@ from continuedev.core.models import Models from continuedev.libs.llm import OpenAIFreeTrial from continuedev.plugins.context_providers import ( DiffContextProvider, - GitHubIssuesContextProvider, TerminalContextProvider, URLContextProvider, ) diff --git a/server/tests/gui_socketio_test.py b/server/tests/gui_socketio_test.py index dbf2cad37..7f228356b 100644 --- a/server/tests/gui_socketio_test.py +++ b/server/tests/gui_socketio_test.py @@ -1,15 +1,15 @@ import asyncio -import threading +#import threading from contextlib import asynccontextmanager -from multiprocessing import Process +#from multiprocessing import Process from typing import Any from uuid import uuid4 import pytest import socketio from continuedev.core.main import StepDescription -from continuedev.server.main import run_server -from continuedev.server.meilisearch_server import kill_proc +#from continuedev.server.main import run_server +#from continuedev.server.meilisearch_server import kill_proc PORT = 8001 diff --git a/server/tests/meilisearch_test.py b/server/tests/meilisearch_test.py index 661daf5f8..9c0928ddf 100644 --- a/server/tests/meilisearch_test.py +++ b/server/tests/meilisearch_test.py @@ -1,15 +1,15 @@ -import os +# import os -import pytest -from continuedev.libs.util.paths import getServerFolderPath -from continuedev.server.meilisearch_server import ( - check_meilisearch_running, - download_meilisearch, - ensure_meilisearch_installed, - kill_proc, - poll_meilisearch_running, - start_meilisearch, -) +# import pytest +# from continuedev.libs.util.paths import getServerFolderPath +# from continuedev.server.meilisearch_server import ( +# check_meilisearch_running, +# download_meilisearch, +# ensure_meilisearch_installed, +# kill_proc, +# poll_meilisearch_running, +# start_meilisearch, +# ) # @pytest.mark.asyncio # async def test_meilisearch():