From 64638d88df4b089b4b32fafe9519e4484f3364ca Mon Sep 17 00:00:00 2001 From: Aditya Gudimella Date: Mon, 20 Mar 2023 10:43:11 -0700 Subject: [PATCH 01/12] Adding ruff workflow --- .github/workflows/lint.yml | 27 +++++++++++++++++++++++++++ python/poetry.lock | 31 +++++++++++++++++++++++++++++-- python/pyproject.toml | 1 + 3 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000000..a4113d897168 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,27 @@ +name: Lint +on: push +# concurrency: +# group: lint-${{ github.ref }} +# cancel-in-progress: true + +jobs: + ruff: + strategy: + fail-fast: false + matrix: + python-version: ["3.8"] + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + - name: Install poetry + run: pipx install poetry + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: "poetry" + cache-dependency-path: "pyproject.toml" + - name: Install SemanticKernel + run: pip install -e '.[all]' + - name: Run lint + run: ruff check . diff --git a/python/poetry.lock b/python/poetry.lock index 654ec17b4dae..eb21fded5cf9 100644 --- a/python/poetry.lock +++ b/python/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.4.0 and should not be changed by hand. +# This file is automatically @generated by Poetry and should not be changed by hand. [[package]] name = "aiohttp" @@ -1494,6 +1494,33 @@ urllib3 = ">=1.21.1,<1.27" socks = ["PySocks (>=1.5.6,!=1.5.7)"] use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] +[[package]] +name = "ruff" +version = "0.0.257" +description = "An extremely fast Python linter, written in Rust." +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "ruff-0.0.257-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:7280640690c1d0046b20e0eb924319a89d8e22925d7d232180ce31196e7478f8"}, + {file = "ruff-0.0.257-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:4582b73da61ab410ffda35b2987a6eacb33f18263e1c91810f0b9779ec4f41a9"}, + {file = "ruff-0.0.257-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5acae9878f1136893e266348acdb9d30dfae23c296d3012043816432a5abdd51"}, + {file = "ruff-0.0.257-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d9f0912d045eee15e8e02e335c16d7a7f9fb6821aa5eb1628eeb5bbfa3d88908"}, + {file = "ruff-0.0.257-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4a9542c34ee5298b31be6c6ba304f14b672dcf104846ee65adb2466d3e325870"}, + {file = "ruff-0.0.257-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:3464f1ad4cea6c4b9325da13ae306bd22bf15d226e18d19c52db191b1f4355ac"}, + {file = "ruff-0.0.257-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5a54bfd559e558ee0df2a2f3756423fe6a9de7307bc290d807c3cdf351cb4c24"}, + {file = "ruff-0.0.257-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3438fd38446e1a0915316f4085405c9feca20fe00a4b614995ab7034dbfaa7ff"}, + {file = "ruff-0.0.257-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:358cc2b547bd6451dcf2427b22a9c29a2d9c34e66576c693a6381c5f2ed3011d"}, + {file = "ruff-0.0.257-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:783390f1e94a168c79d7004426dae3e4ae2999cc85f7d00fdd86c62262b71854"}, + {file = "ruff-0.0.257-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:aaa3b5b6929c63a854b6bcea7a229453b455ab26337100b2905fae4523ca5667"}, + {file = "ruff-0.0.257-py3-none-musllinux_1_2_i686.whl", hash = "sha256:4ecd7a84db4816df2dcd0f11c5365a9a2cf4fa70a19b3ac161b7b0bfa592959d"}, + {file = "ruff-0.0.257-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:3db8d77d5651a2c0d307102d717627a025d4488d406f54c2764b21cfbe11d822"}, + {file = "ruff-0.0.257-py3-none-win32.whl", hash = "sha256:d2c8755fa4f6c5e5ec032ad341ca3beeecd16786e12c3f26e6b0cc40418ae998"}, + {file = "ruff-0.0.257-py3-none-win_amd64.whl", hash = "sha256:3cec07d6fecb1ebbc45ea8eeb1047b929caa2f7dfb8dd4b0e1869ff789326da5"}, + {file = "ruff-0.0.257-py3-none-win_arm64.whl", hash = "sha256:352f1bdb9b433b3b389aee512ffb0b82226ae1e25b3d92e4eaf0e7be6b1b6f6a"}, + {file = "ruff-0.0.257.tar.gz", hash = "sha256:fedfd06a37ddc17449203c3e38fc83fb68de7f20b5daa0ee4e60d3599b38bab0"}, +] + [[package]] name = "setuptools" version = "67.6.0" @@ -1782,4 +1809,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "9a402301e33bc7b47dc3fe8de479100af889e251761063431b5d6a10fa6ff182" +content-hash = "7ea1896a8f05ba84a08fcade21b11f6996eb8778f1688f6146761fdda125ac5f" diff --git a/python/pyproject.toml b/python/pyproject.toml index c3b638553594..452a716161df 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -16,6 +16,7 @@ pre-commit = "^2.21.0" black = {version = "^23.1.0", allow-prereleases = true} ipykernel = "^6.21.1" pytest = "7.2.0" +ruff = "^0.0.257" [tool.isort] profile = "black" From 744a9d9bae3082fc457474294c88a1ed60658c93 Mon Sep 17 00:00:00 2001 From: Aditya Gudimella Date: Mon, 20 Mar 2023 10:44:28 -0700 Subject: [PATCH 02/12] Fix repo path in lint.yml --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a4113d897168..fff3f64041a7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,4 +24,4 @@ jobs: - name: Install SemanticKernel run: pip install -e '.[all]' - name: Run lint - run: ruff check . + run: ruff check ./python/ From f67f8801c96c011c3e39da06ad4b76d7aed3ccce Mon Sep 17 00:00:00 2001 From: Aditya Gudimella Date: Mon, 20 Mar 2023 10:45:48 -0700 Subject: [PATCH 03/12] Fix another repo path in lint.yml --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index fff3f64041a7..69ec266df2cb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,7 +20,7 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: "poetry" - cache-dependency-path: "pyproject.toml" + cache-dependency-path: "python/pyproject.toml" - name: Install SemanticKernel run: pip install -e '.[all]' - name: Run lint From 8d40eb26ae2a0b66ee9bda612ccb26ec75c4766b Mon Sep 17 00:00:00 2001 From: Aditya Gudimella Date: Mon, 20 Mar 2023 10:50:16 -0700 Subject: [PATCH 04/12] cd to project root in install project --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 69ec266df2cb..ac4e57e5c516 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,6 +22,6 @@ jobs: cache: "poetry" cache-dependency-path: "python/pyproject.toml" - name: Install SemanticKernel - run: pip install -e '.[all]' + run: cd python && pip install -e '.[all]' - name: Run lint run: ruff check ./python/ From 18cf897f180ee9c21c8738b3ae9a40cf498263d8 Mon Sep 17 00:00:00 2001 From: Aditya Gudimella Date: Mon, 20 Mar 2023 10:54:26 -0700 Subject: [PATCH 05/12] Change pip install to poetry install --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ac4e57e5c516..11363cdcc028 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,6 +22,6 @@ jobs: cache: "poetry" cache-dependency-path: "python/pyproject.toml" - name: Install SemanticKernel - run: cd python && pip install -e '.[all]' + run: cd python && poetry install - name: Run lint run: ruff check ./python/ From 0f6df0300da7c3f4e73e458034c3c976ae387860 Mon Sep 17 00:00:00 2001 From: Aditya Gudimella Date: Mon, 20 Mar 2023 10:55:50 -0700 Subject: [PATCH 06/12] Change run command to poetry run --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 11363cdcc028..b4ef9782f83d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,4 +24,4 @@ jobs: - name: Install SemanticKernel run: cd python && poetry install - name: Run lint - run: ruff check ./python/ + run: poetry run ruff check ./python/ From 11d1e2fa21faa7f74d7458b71606617f6230796d Mon Sep 17 00:00:00 2001 From: Aditya Gudimella Date: Mon, 20 Mar 2023 10:57:15 -0700 Subject: [PATCH 07/12] cd to python in run lint --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b4ef9782f83d..aa1aba112744 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,4 +24,4 @@ jobs: - name: Install SemanticKernel run: cd python && poetry install - name: Run lint - run: poetry run ruff check ./python/ + run: cd python && poetry run ruff check ./python/ From d8760742ff881d1fd9f949ea3af664b7423a4bae Mon Sep 17 00:00:00 2001 From: Aditya Gudimella Date: Mon, 20 Mar 2023 10:58:15 -0700 Subject: [PATCH 08/12] Fix path in run lint --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index aa1aba112744..98d63d7c49f4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,4 +24,4 @@ jobs: - name: Install SemanticKernel run: cd python && poetry install - name: Run lint - run: cd python && poetry run ruff check ./python/ + run: cd python && poetry run ruff check . From df1387b3546ec48e523a339620c1b3faf0f45120 Mon Sep 17 00:00:00 2001 From: Aditya Gudimella Date: Mon, 20 Mar 2023 11:32:13 -0700 Subject: [PATCH 09/12] Add black check to lint --- .github/workflows/lint.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 98d63d7c49f4..9cf15880a014 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -25,3 +25,23 @@ jobs: run: cd python && poetry install - name: Run lint run: cd python && poetry run ruff check . + black: + strategy: + fail-fast: false + matrix: + python-version: ["3.8"] + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + - name: Install poetry + run: pipx install poetry + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: "poetry" + cache-dependency-path: "python/pyproject.toml" + - name: Install SemanticKernel + run: cd python && poetry install + - name: Run lint + run: cd python && poetry run black --check . From 73ff789d2b9c920494f35c837628ec0472f45971 Mon Sep 17 00:00:00 2001 From: Aditya Gudimella Date: Mon, 20 Mar 2023 11:36:21 -0700 Subject: [PATCH 10/12] Fix formatting issues --- python/semantic_kernel/core_skills/text_memory_skill.py | 1 - 1 file changed, 1 deletion(-) diff --git a/python/semantic_kernel/core_skills/text_memory_skill.py b/python/semantic_kernel/core_skills/text_memory_skill.py index 6b6d482a6f45..ff8eaa64ca09 100644 --- a/python/semantic_kernel/core_skills/text_memory_skill.py +++ b/python/semantic_kernel/core_skills/text_memory_skill.py @@ -11,7 +11,6 @@ class TextMemorySkill: - COLLECTION_PARAM = "collection" RELEVANCE_PARAM = "relevance" KEY_PARAM = "key" From de7893ec8ad0e945484d046aaae2f3dd360eb410 Mon Sep 17 00:00:00 2001 From: Aditya Gudimella Date: Thu, 23 Mar 2023 15:40:37 -0700 Subject: [PATCH 11/12] Use suggestion --- .github/workflows/lint.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9cf15880a014..e647b6c74b1c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,6 +13,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 steps: + - run: echo "/root/.local/bin" >> $GITHUB_PATH - uses: actions/checkout@v3 - name: Install poetry run: pipx install poetry @@ -33,6 +34,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 steps: + - run: echo "/root/.local/bin" >> $GITHUB_PATH - uses: actions/checkout@v3 - name: Install poetry run: pipx install poetry From ad535c90fff5305caa9745b3ed653d10a815295c Mon Sep 17 00:00:00 2001 From: Aditya Gudimella Date: Thu, 23 Mar 2023 15:43:14 -0700 Subject: [PATCH 12/12] Use suggestion --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e647b6c74b1c..9e96349325fd 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,7 +23,7 @@ jobs: cache: "poetry" cache-dependency-path: "python/pyproject.toml" - name: Install SemanticKernel - run: cd python && poetry install + run: cd python && poetry install --no-ansi - name: Run lint run: cd python && poetry run ruff check . black: @@ -44,6 +44,6 @@ jobs: cache: "poetry" cache-dependency-path: "python/pyproject.toml" - name: Install SemanticKernel - run: cd python && poetry install + run: cd python && poetry install --no-ansi - name: Run lint run: cd python && poetry run black --check .