From cbe6716afde4696bc1c31dec36332db47cd89f93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Mon, 26 Jun 2023 18:53:43 -0300 Subject: [PATCH 1/4] Fix execution in Python 3.11 This fixes the following error: ValueError: mutable default for field src is not allowed: use default_factory --- slither/utils/loc.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/slither/utils/loc.py b/slither/utils/loc.py index 0e51dfa46..dde91578b 100644 --- a/slither/utils/loc.py +++ b/slither/utils/loc.py @@ -1,4 +1,4 @@ -from dataclasses import dataclass +from dataclasses import dataclass, field from pathlib import Path from typing import List, Tuple @@ -19,9 +19,9 @@ class LoCInfo: @dataclass class LoC: - src: LoCInfo = LoCInfo() - dep: LoCInfo = LoCInfo() - test: LoCInfo = LoCInfo() + src: LoCInfo = field(default_factory=LoCInfo) + dep: LoCInfo = field(default_factory=LoCInfo) + test: LoCInfo = field(default_factory=LoCInfo) def to_pretty_table(self) -> MyPrettyTable: table = MyPrettyTable(["", "src", "dep", "test"]) From fa5963239efe4022d307fb290e899dd0f19866c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Mon, 26 Jun 2023 19:00:14 -0300 Subject: [PATCH 2/4] workflows: ci: run on Python 3.8 ~ 3.11 --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09582eed9..fcad34341 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest", "windows-2022"] + python: ["3.8", "3.9", "3.10", "3.11"] type: ["cli", "dapp", "data_dependency", @@ -53,10 +54,10 @@ jobs: type: truffle steps: - uses: actions/checkout@v3 - - name: Set up Python 3.8 + - name: Set up Python ${{ matrix.python }} uses: actions/setup-python@v3 with: - python-version: 3.8 + python-version: ${{ matrix.python }} - name: Install dependencies run: | pip install ".[test]" From af5e801973ec8a040f53b0cd453b949e659f6234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Mon, 26 Jun 2023 19:02:19 -0300 Subject: [PATCH 3/4] workflows: test: run on Python 3.8 ~ 3.11 --- .github/workflows/test.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a003eb168..e4de97197 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,12 +25,13 @@ jobs: matrix: os: ["ubuntu-latest", "windows-2022"] type: ["unit", "integration", "tool"] + python: ["3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v3 - - name: Set up Python 3.8 + - name: Set up Python ${{ matrix.python }} uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: ${{ matrix.python }} cache: "pip" cache-dependency-path: setup.py @@ -74,7 +75,7 @@ jobs: uses: ./.github/actions/upload-coverage # only aggregate test coverage over linux-based tests to avoid any OS-specific filesystem information stored in # coverage metadata. - if: ${{ matrix.os == 'ubuntu-latest' }} + if: ${{ matrix.os == 'ubuntu-latest' && matrix.python == '3.8' }} coverage: needs: From 98480090dba6e4595c61a1dcb9d05f75b28fefbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Mon, 26 Jun 2023 19:14:35 -0300 Subject: [PATCH 4/4] workflows: ci, tests: only run on 3.8 and 3.11 for PRs This keeps CI jobs reasonable in PRs while testing the full set of versions in the scheduled jobs and merges to dev and master. --- .github/workflows/ci.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fcad34341..76438ec73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest", "windows-2022"] - python: ["3.8", "3.9", "3.10", "3.11"] + python: ${{ (github.event_name == 'pull_request' && fromJSON('["3.8", "3.11"]')) || fromJSON('["3.8", "3.9", "3.10", "3.11"]') }} type: ["cli", "dapp", "data_dependency", diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e4de97197..b3754bfd7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: matrix: os: ["ubuntu-latest", "windows-2022"] type: ["unit", "integration", "tool"] - python: ["3.8", "3.9", "3.10", "3.11"] + python: ${{ (github.event_name == 'pull_request' && fromJSON('["3.8", "3.11"]')) || fromJSON('["3.8", "3.9", "3.10", "3.11"]') }} steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python }}