From 7ed0f8e998275446bd52902e3a28c31d12f6424c Mon Sep 17 00:00:00 2001 From: Melf Date: Thu, 9 Jan 2025 14:56:53 +0000 Subject: [PATCH 01/11] add format and issue handling --- .github/workflows/issue-to-project.yml | 16 ++++++++++++++++ .github/workflows/lint.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/issue-to-project.yml create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/issue-to-project.yml b/.github/workflows/issue-to-project.yml new file mode 100644 index 0000000..621c8b2 --- /dev/null +++ b/.github/workflows/issue-to-project.yml @@ -0,0 +1,16 @@ +name: Add issues to project + +on: + issues: + types: + - opened + +jobs: + add-to-project: + name: Add issue to project + runs-on: ubuntu-latest + steps: + - uses: actions/add-to-project@v1.0.2 + with: + project-url: https://github.com/orgs/quantinuum-dev/projects/19 + github-token: ${{ secrets.ADD_TO_PROJECT_PAT }} \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..81a5a79 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,26 @@ +name: Lint python projects + +on: + pull_request: {} + workflow_dispatch: {} + +jobs: + lint: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.x + uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Install black, pylint and ruff + run: pip install black pylint ruff + - name: Check files are formatted with black + run: | + # Paths specified to avoid formatting submodules + black --check . + - name: ruff check + run: | + ruff check . \ No newline at end of file From 027326dda680eb3238f885506051832598a6bae4 Mon Sep 17 00:00:00 2001 From: Melf Date: Thu, 9 Jan 2025 16:04:07 +0000 Subject: [PATCH 02/11] update project to hugrverse --- .github/workflows/issue-to-project.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/issue-to-project.yml b/.github/workflows/issue-to-project.yml index 621c8b2..909ceac 100644 --- a/.github/workflows/issue-to-project.yml +++ b/.github/workflows/issue-to-project.yml @@ -12,5 +12,5 @@ jobs: steps: - uses: actions/add-to-project@v1.0.2 with: - project-url: https://github.com/orgs/quantinuum-dev/projects/19 + project-url: https://github.com/orgs/quantinuum-dev/projects/10 github-token: ${{ secrets.ADD_TO_PROJECT_PAT }} \ No newline at end of file From 723ef1ea5e50f824700882f4cb3902bfe350a459 Mon Sep 17 00:00:00 2001 From: Melf Date: Thu, 9 Jan 2025 16:08:01 +0000 Subject: [PATCH 03/11] add pylint --- .github/workflows/lint.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 81a5a79..64bd03c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,6 +21,9 @@ jobs: run: | # Paths specified to avoid formatting submodules black --check . + - name: pylint check + run: | + pylint - name: ruff check run: | ruff check . \ No newline at end of file From 37e8f4710694856bb3c027ade04d24e3f991cfd2 Mon Sep 17 00:00:00 2001 From: Melf Date: Thu, 9 Jan 2025 16:09:10 +0000 Subject: [PATCH 04/11] comment out pylint --- .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 64bd03c..26cc445 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,7 +23,7 @@ jobs: black --check . - name: pylint check run: | - pylint + # pylint - name: ruff check run: | ruff check . \ No newline at end of file From 5c5af9f8e64d80792dbddf97911a638b8658da57 Mon Sep 17 00:00:00 2001 From: Melf Date: Thu, 9 Jan 2025 16:10:20 +0000 Subject: [PATCH 05/11] remove pylint --- .github/workflows/lint.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 26cc445..4d109e5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,15 +15,12 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.x' - - name: Install black, pylint and ruff - run: pip install black pylint ruff + - name: Install black and ruff + run: pip install black ruff - name: Check files are formatted with black run: | # Paths specified to avoid formatting submodules black --check . - - name: pylint check - run: | - # pylint - name: ruff check run: | ruff check . \ No newline at end of file From f8a7c446e6995e4aa3a6d65248be4870ab852dda Mon Sep 17 00:00:00 2001 From: cqc-melf <70640934+cqc-melf@users.noreply.github.com> Date: Thu, 9 Jan 2025 17:29:08 +0000 Subject: [PATCH 06/11] Update .github/workflows/lint.yml Co-authored-by: Kartik Singhal --- .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 4d109e5..6c6411f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,8 +15,8 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.x' - - name: Install black and ruff - run: pip install black ruff + - name: Install ruff + run: pip install ruff - name: Check files are formatted with black run: | # Paths specified to avoid formatting submodules From 507952f0bb3623394febf7639e4cf5c35f196da6 Mon Sep 17 00:00:00 2001 From: Melf Date: Thu, 9 Jan 2025 17:29:33 +0000 Subject: [PATCH 07/11] remove black --- .github/workflows/lint.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6c6411f..81f9ab7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,10 +17,6 @@ jobs: python-version: '3.x' - name: Install ruff run: pip install ruff - - name: Check files are formatted with black - run: | - # Paths specified to avoid formatting submodules - black --check . - name: ruff check run: | ruff check . \ No newline at end of file From de623ca174b72954718577d1cd292d1664e13244 Mon Sep 17 00:00:00 2001 From: Melf Date: Thu, 9 Jan 2025 17:31:06 +0000 Subject: [PATCH 08/11] add ruff toml --- ruff.toml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 ruff.toml diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..62e4826 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,41 @@ +target-version = "py39" + +line-length = 88 + +select = [ + "E", # pycodestyle Errors + "W", # pycodestyle Warnings + + # "A", # flake8-builtins + # "B", # flake8-Bugbear + # "C4", # flake8-comprehensions + # "COM", # flake8-commas + # "EXE", # flake8-executable + "F", # pyFlakes + # "FA", # flake8-future-annotations + # "FIX", # flake8-fixme + # "FLY", # flynt + "I", # isort + # "INP", # flake8-no-pep420 + # "ISC", # flake8-implicit-str-concat + # "N", # pep8-Naming + # "NPY", # NumPy-specific + # "PERF", # Perflint + # "PGH", # pygrep-hooks + # "PIE", # flake8-pie + # "PL", # pylint + # "PT", # flake8-pytest-style + # "RSE", # flake8-raise + # "RUF", # Ruff-specific + # "S", # flake8-bandit (Security) + "SIM", # flake8-simplify + # "SLF", # flake8-self + "T20", # flake8-print + "TCH", # flake8-type-checking + # "TRY", # tryceratops + "UP", # pyupgrade + # "YTT", # flake8-2020 +] + +[per-file-ignores] +"__init__.py" = ["F401"] # module imported but unused (6) \ No newline at end of file From 1f060a4a52e6d6bc5eb4b55172fc8ff6dac97176 Mon Sep 17 00:00:00 2001 From: cqc-melf <70640934+cqc-melf@users.noreply.github.com> Date: Fri, 10 Jan 2025 11:14:14 +0000 Subject: [PATCH 09/11] Update .github/workflows/lint.yml Co-authored-by: Kartik Singhal --- .github/workflows/lint.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 81f9ab7..7015e04 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,4 +19,5 @@ jobs: run: pip install ruff - name: ruff check run: | - ruff check . \ No newline at end of file + ruff check + ruff format \ No newline at end of file From d0dc5cbe52614b667e1b74811eccb1340883e8c4 Mon Sep 17 00:00:00 2001 From: cqc-melf <70640934+cqc-melf@users.noreply.github.com> Date: Fri, 10 Jan 2025 11:14:22 +0000 Subject: [PATCH 10/11] Update ruff.toml Co-authored-by: Kartik Singhal --- ruff.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruff.toml b/ruff.toml index 62e4826..32ae7a1 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,4 +1,4 @@ -target-version = "py39" +target-version = "py312" line-length = 88 From 04e93af1a8ffe17d7c51a481ba7d8fcca470964d Mon Sep 17 00:00:00 2001 From: Melf Date: Fri, 10 Jan 2025 11:15:51 +0000 Subject: [PATCH 11/11] add template --- ruff.toml | 79 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 52 insertions(+), 27 deletions(-) diff --git a/ruff.toml b/ruff.toml index 32ae7a1..cfd5c92 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,41 +1,66 @@ +# See https://docs.astral.sh/ruff/rules/ target-version = "py312" line-length = 88 -select = [ +lint.select = [ "E", # pycodestyle Errors "W", # pycodestyle Warnings - # "A", # flake8-builtins - # "B", # flake8-Bugbear - # "C4", # flake8-comprehensions - # "COM", # flake8-commas - # "EXE", # flake8-executable + "A", # flake8-builtins + "ANN", # flake8-annotations + "ARG", # flake8-unused-arguments + "B", # flake8-Bugbear + "BLE", # flake8-blind-except + "C4", # flake8-comprehensions + "C90", # mccabe + "COM", # flake8-commas + "D", # pydocstyle + "EM", # flake8-errmsg + "ERA", # eradicate + "EXE", # flake8-executable "F", # pyFlakes - # "FA", # flake8-future-annotations - # "FIX", # flake8-fixme - # "FLY", # flynt + "FA", # flake8-future-annotations + "FBT", # flake8-boolean-trap + "FIX", # flake8-fixme + "FLY", # flynt + "FURB", # refurb + "G", # flake8-logging-format "I", # isort - # "INP", # flake8-no-pep420 - # "ISC", # flake8-implicit-str-concat - # "N", # pep8-Naming - # "NPY", # NumPy-specific - # "PERF", # Perflint - # "PGH", # pygrep-hooks - # "PIE", # flake8-pie - # "PL", # pylint - # "PT", # flake8-pytest-style - # "RSE", # flake8-raise - # "RUF", # Ruff-specific - # "S", # flake8-bandit (Security) + "ICN", # flake8-import-conventions + "INP", # flake8-no-pep420 + "INT", # flake8-gettext + "ISC", # flake8-implicit-str-concat + "LOG", # flake8-logging + "N", # pep8-Naming + "NPY", # NumPy-specific + "PERF", # Perflint + "PGH", # pygrep-hooks + "PIE", # flake8-pie + "PL", # pylint + "PT", # flake8-pytest-style + "PTH", # flake8-use-pathlib + "PYI", # flake8-pyi + "Q", # flake8-quotes + "RET", # flake8-return + "RSE", # flake8-raise + "RUF", # Ruff-specific + "S", # flake8-bandit (Security) "SIM", # flake8-simplify - # "SLF", # flake8-self - "T20", # flake8-print + "SLF", # flake8-self + "SLOT", # flake8-slots + "T10", # flake8-debugger + # "T20", # flake8-print "TCH", # flake8-type-checking - # "TRY", # tryceratops + "TD", # flake8-todos + "TID", # flake8-tidy-imports + "TRY", # tryceratops "UP", # pyupgrade - # "YTT", # flake8-2020 + "YTT", # flake8-2020 ] -[per-file-ignores] -"__init__.py" = ["F401"] # module imported but unused (6) \ No newline at end of file +[lint.per-file-ignores] +"__init__.py" = ["F401"] # module imported but unused + +[lint.pydocstyle] +convention = "google" \ No newline at end of file