From f29afb4d3310a14dad3712a0e0d7aafc8d137b70 Mon Sep 17 00:00:00 2001 From: Stephanos Kuma Date: Fri, 14 Jul 2023 16:51:33 +0100 Subject: [PATCH] Use common config --- .github/workflows/lint.yml | 36 --------------- .github/workflows/tests.yml | 91 +++++++++++++++++++++++++++---------- pyproject.toml | 33 +++++++++++--- 3 files changed, 92 insertions(+), 68 deletions(-) delete mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 8cd963e..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: lint - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - lint: - - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] - - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - uses: Gr1N/setup-poetry@v8 - - uses: actions/cache@v3 - with: - path: ~/.cache/pypoetry/virtualenvs - key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('pyproject.toml') }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip wheel - pip install yamk - yam install - - name: Lint the project - run: | - yam lint diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dce7be8..f82cb7b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,36 +1,77 @@ name: tests - on: push: - branches: [ main ] + branches: + - main pull_request: - branches: [ main ] - + branches: + - main jobs: + lint: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: + - '3.8' + - '3.9' + - '3.10' + - '3.11' + steps: + - name: Checkout the repository + uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install poetry + uses: Gr1N/setup-poetry@v8 + - name: Use cache + uses: actions/cache@v3 + with: + path: ~/.cache/pypoetry/virtualenvs + key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('pyproject.toml') }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip wheel yamk + . $(poetry env use python | tail -n 1 | cut -d' ' -f3-)/bin/activate + python -m pip install --upgrade pip wheel + yam install + - name: Lint the project + run: | + . $(poetry env use python | tail -n 1 | cut -d' ' -f3-)/bin/activate + yam lint run-unittests: - runs-on: ubuntu-latest strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] - + python-version: + - '3.8' + - '3.9' + - '3.10' + - '3.11' steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - uses: Gr1N/setup-poetry@v8 - - uses: actions/cache@v3 - with: - path: ~/.cache/pypoetry/virtualenvs - key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('pyproject.toml') }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip wheel - pip install yamk - yam install - - name: Run unittests - run: | - yam tests + - name: Checkout the repository + uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install poetry + uses: Gr1N/setup-poetry@v8 + - name: Use cache + uses: actions/cache@v3 + with: + path: ~/.cache/pypoetry/virtualenvs + key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('pyproject.toml') }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip wheel yamk + . $(poetry env use python | tail -n 1 | cut -d' ' -f3-)/bin/activate + python -m pip install --upgrade pip wheel + yam install + - name: Lint the project + run: | + . $(poetry env use python | tail -n 1 | cut -d' ' -f3-)/bin/activate + yam tests diff --git a/pyproject.toml b/pyproject.toml index e86d770..2b2b424 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,14 +3,21 @@ requires = ["poetry_core>=1.0.0"] build-backend = "poetry.core.masonry.api" [tool.black] -target-version = ["py38", "py39", "py310", "py311"] +target-version = ["py38"] [tool.mypy] check_untyped_defs = true disallow_any_generics = true +disallow_incomplete_defs = true +disallow_subclassing_any = true +disallow_untyped_calls = true +disallow_untyped_decorators = true +disallow_untyped_defs = true ignore_missing_imports = true no_implicit_reexport = true show_error_codes = true +strict_concatenate = true +strict_equality = true warn_return_any = true warn_redundant_casts = true warn_unused_ignores = true @@ -63,6 +70,8 @@ target-version = "py38" [tool.ruff.per-file-ignores] "tests/**" = [ + "FBT001", + "PT011", "S101", "S105", ] @@ -74,14 +83,24 @@ ban-relative-imports = "all" "mock".msg = "Use unittest.mock" "pytz".msg = "Use zoneinfo" +[tool.ruff.isort] +combine-as-imports = true +forced-separate = ["tests"] +split-on-trailing-comma = false + [tool.pytest.ini_options] -addopts = "-vv --cov --cov-report=term-missing:skip-covered" +addopts = "-vv" testpaths = "tests" [tool.coverage.run] source = ["src/"] data_file = ".cov_cache/coverage.dat" +[tool.coverage.report] +show_missing = true +skip_covered = true +skip_empty = true + [tool.poetry] name = "pickle_secure" version = "0.99.9" @@ -112,16 +131,16 @@ cryptography = ">=39.0.1" [tool.poetry.group.dev.dependencies] ipdb = {version = "^0.13", python = "^3.9"} -ipython = {version = "^8.11", python = "^3.9"} -pipdeptree = "^2.5" +ipython = {version = "^8.12", python = "^3.9"} +pipdeptree = "^2.7" [tool.poetry.group.lint.dependencies] -black = "^23.1" -mypy = "^1.0" +black = "^23.3" +mypy = "^1.4" ruff = "^0.0" [tool.poetry.group.test.dependencies] -pytest = "^7.1" +pytest = "^7.4" pytest-cov = "^4.0" [tool.poetry.group.docs.dependencies]