diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index de00e5d..0000000 --- a/.coveragerc +++ /dev/null @@ -1,10 +0,0 @@ -[run] -branch = True -omit = - tests/* -parallel = true -data_file = reports/.coverage - -[report] -exclude_lines = - if __name__ == .__main__.: diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index b50d046..0000000 --- a/.dockerignore +++ /dev/null @@ -1,158 +0,0 @@ -# Source: -# https://github.com/github/gitignore/blob/master/Python.gitignore - -# Git folder -.git/ - -# Docker-compose.yml -*docker-compose* - -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -parts/ -sdist/ -var/ -wheels/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt -pip-selfcheck.json - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ -docs/build -docs/*.tar.gz - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -.python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -*.env -.env -.venv -ve/ -env/ -venv/ -virtualenv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# Old stuff -.project/ -.pydevproject/ -.settings/ -.idea/ - -# Configuration Pycharm -.run/ - -# Configuration VS Code -.vscode/ - -# Spark folders -**/spark_warehouse -**/metastore_db diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 05fd863..f1d3b5a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,14 +1,12 @@ -name: CodeQL +name: Code analysis on: push: - branches-ignore: - - dependabot/** - - pre-commit-ci-update-config - - master - pull_request: branches: - develop + pull_request: + branches-ignore: + - master workflow_dispatch: concurrency: @@ -16,8 +14,8 @@ concurrency: cancel-in-progress: true jobs: - analyze: - name: Analyze + linters: + name: Linters runs-on: ubuntu-latest permissions: actions: read @@ -50,27 +48,39 @@ jobs: - name: Install dependencies run: | pip install -I -r requirements-dev.txt + # Set the `CODEQL-PYTHON` environment variable to the Python executable # that includes the dependencies echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV - name: Run flake8 - run: flake8 . + run: python3 -m flake8 --config setup.cfg . - name: Run mypy run: python3 -m mypy --config-file setup.cfg evacuator + codeql: + name: CodeQL + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: '3.11' + # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: languages: python - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml index 6423b7c..c2ddb4b 100644 --- a/.github/workflows/dev-release.yml +++ b/.github/workflows/dev-release.yml @@ -8,34 +8,34 @@ on: - master workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + jobs: - wait-tests: - name: Wait for tests + wait-code-analysis: + name: Release package runs-on: ubuntu-latest + if: github.repository == 'MobileTeleSystems/evacuator' # prevent running on forks steps: - uses: fountainhead/action-wait-for-check@v1.1.0 - id: wait-for-tests + id: wait-for-linters with: token: ${{ secrets.GITHUB_TOKEN }} - checkName: Tests done + checkName: Linters ref: ${{ github.sha }} timeoutSeconds: 3600 - name: Fail the Build uses: cutenode/action-always-fail@v1 - if: steps.wait-for-tests.outputs.conclusion != 'success' - - wait-codeql: - name: Wait for CodeQL - runs-on: ubuntu-latest + if: steps.wait-for-linters.outputs.conclusion != 'success' - steps: - uses: fountainhead/action-wait-for-check@v1.1.0 id: wait-for-codeql with: token: ${{ secrets.GITHUB_TOKEN }} - checkName: Analyze + checkName: CodeQL ref: ${{ github.sha }} timeoutSeconds: 3600 @@ -43,12 +43,18 @@ jobs: uses: cutenode/action-always-fail@v1 if: steps.wait-for-codeql.outputs.conclusion != 'success' - release: - name: Release package - runs-on: ubuntu-latest - needs: [wait-tests, wait-codeql] + - uses: fountainhead/action-wait-for-check@v1.1.0 + id: wait-for-tests + with: + token: ${{ secrets.GITHUB_TOKEN }} + checkName: Tests done + ref: ${{ github.sha }} + timeoutSeconds: 3600 + + - name: Fail the Build + uses: cutenode/action-always-fail@v1 + if: steps.wait-for-tests.outputs.conclusion != 'success' - steps: - name: Checkout code uses: actions/checkout@v3 with: @@ -59,17 +65,6 @@ jobs: with: python-version: '3.11' - - name: Cache pip - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-python-3.11-release-${{ hashFiles('requirements*.txt') }} - restore-keys: | - ${{ runner.os }}-python-3.11-release-${{ hashFiles('requirements*.txt') }} - ${{ runner.os }}-python-3.11-release- - ${{ runner.os }}-python - ${{ runner.os }}- - - name: Upgrade pip run: python -m pip install --upgrade pip setuptools wheel @@ -80,4 +75,4 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ + repository-url: https://test.pypi.org/legacy/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4cb9664..006c6a3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,12 +3,13 @@ name: Release on: push: tags: - - '*' + - '[0-9]+.[0-9]+.[0-9]+' jobs: release: name: Release package runs-on: ubuntu-latest + if: github.repository == 'MobileTeleSystems/evacuator' # prevent running on forks steps: - name: Checkout code @@ -21,17 +22,6 @@ jobs: with: python-version: '3.11' - - name: Cache pip - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-python-3.11-release-${{ hashFiles('requirements*.txt') }} - restore-keys: | - ${{ runner.os }}-python-3.11-release-${{ hashFiles('requirements*.txt') }} - ${{ runner.os }}-python-3.11-release- - ${{ runner.os }}-python - ${{ runner.os }}- - - name: Upgrade pip run: python -m pip install --upgrade pip setuptools wheel @@ -41,4 +31,4 @@ jobs: - name: Publish package uses: pypa/gh-action-pypi-publish@release/v1 with: - password: ${{ secrets.PYPI_TOKEN }} + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 585e32f..7c07283 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,13 +1,11 @@ name: Tests on: push: - branches-ignore: - - dependabot/** - - pre-commit-ci-update-config - - master - pull_request: branches: - develop + pull_request: + branches-ignore: + - master workflow_dispatch: concurrency: @@ -16,7 +14,7 @@ concurrency: jobs: tests: - name: Run ${{ matrix.mark }} tests (${{ matrix.python-version }} on ${{ matrix.os }}) + name: Run tests (${{ matrix.python-version }} on ${{ matrix.os }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -54,8 +52,6 @@ jobs: - name: Build package run: | - git version - git tag -l --sort=-creatordate --merged python setup.py --version python setup.py bdist_wheel sdist @@ -63,18 +59,13 @@ jobs: run: | mkdir reports/ || echo "Directory exists" pip install -e . --no-build-isolation - coverage run -m pytest - - - name: Combine coverage - run: | - coverage combine - coverage xml -o reports/coverage-${{ matrix.python-version }}.xml -i + ./pytest_runner.sh - name: Upload coverage results uses: actions/upload-artifact@v3 with: - name: code-coverage-${{ matrix.python-version }} - path: reports/coverage-${{ matrix.python-version }}.xml + name: coverage-${{ matrix.python-version }}-os-${{ matrix.os }} + path: reports/* all_done: name: Tests done @@ -85,14 +76,39 @@ jobs: - name: Checkout code uses: actions/checkout@v3 + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Cache pip + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-python-3.11-coverage-${{ hashFiles('requirements*.txt') }} + restore-keys: | + ${{ runner.os }}-python-3.11-coverage-${{ hashFiles('requirements*.txt') }} + ${{ runner.os }}-python-3.11-coverage- + ${{ runner.os }}-python + ${{ runner.os }}- + + - name: Upgrade pip + run: python -m pip install --upgrade pip setuptools wheel + + - name: Install dependencies + run: pip install -I -r requirements-test.txt + - name: Download all coverage reports uses: actions/download-artifact@v3 with: path: reports - - name: Move coverage reports to the root folder + - name: Move coverage data to the root folder run: find reports -type f -exec mv '{}' reports \; + - name: Generate coverate reports + run: ./combine_coverage.sh + - name: Check coverage uses: codecov/codecov-action@v3 with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5734344..bab8c15 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,17 +21,17 @@ repos: args: [--django] - id: trailing-whitespace - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.4.2 + rev: v1.5.1 hooks: - id: remove-tabs exclude: ^docs/(make.bat|Makefile) - repo: https://github.com/codespell-project/codespell - rev: v2.2.2 + rev: v2.2.4 hooks: - id: codespell args: [-w] - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - rev: v2.7.0 + rev: v2.9.0 hooks: - id: pretty-format-yaml args: [--autofix, --indent, '2'] @@ -49,12 +49,12 @@ repos: - id: rst-inline-touching-normal - id: text-unicode-replacement-char - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.4.0 hooks: - id: pyupgrade args: [--py37-plus, --keep-runtime-typing] - repo: https://github.com/ambv/black - rev: 23.1.0 + rev: 23.3.0 hooks: - id: black language_version: python3 @@ -80,3 +80,8 @@ repos: language: system types: [python] pass_filenames: false + +ci: + skip: + - flake8 # checked with Github Actions + - mypy # checked with Github Actions diff --git a/MANIFEST.in b/MANIFEST.in index 5df6f10..24da00a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -include README.rst evacuator/VERSION +include README.rst evacuator/VERSION evacuator/py.typed recursive-exclude * __pycache__ recursive-exclude * *.pyc recursive-exclude * *.pyo diff --git a/README.rst b/README.rst index 4faf10a..892932e 100644 --- a/README.rst +++ b/README.rst @@ -7,15 +7,13 @@ Evacuator |Documentation| |Build Status| |Coverage| .. |Repo Status| image:: https://www.repostatus.org/badges/latest/active.svg - :target: https://www.repostatus.org/#active + :target: https://github.com/MobileTeleSystems/evacuator .. |PyPI| image:: https://img.shields.io/pypi/v/evacuator :target: https://pypi.org/project/evacuator/ .. |PyPI License| image:: https://img.shields.io/pypi/l/evacuator.svg :target: https://github.com/MobileTeleSystems/evacuator/blob/develop/LICENSE.txt .. |PyPI Python Version| image:: https://img.shields.io/pypi/pyversions/evacuator.svg :target: https://badge.fury.io/py/evacuator -.. |ReadTheDocs| image:: https://img.shields.io/readthedocs/evacuator.svg - :target: https://evacuator.readthedocs.io .. |Build Status| image:: https://github.com/MobileTeleSystems/evacuator/workflows/Tests/badge.svg :target: https://github.com/MobileTeleSystems/evacuator/actions .. |Documentation| image:: https://readthedocs.org/projects/evacuator/badge/?version=stable diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..045842d --- /dev/null +++ b/codecov.yml @@ -0,0 +1,6 @@ +coverage: + status: + project: + default: + target: 100% + threshold: 1% diff --git a/combine_coverage.sh b/combine_coverage.sh new file mode 100755 index 0000000..175fd4c --- /dev/null +++ b/combine_coverage.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +root_path=$(dirname $(realpath $0)) +coverage combine --rcfile=tests/.coveragerc +coverage xml --rcfile=tests/.coveragerc -o $root_path/reports/coverage.xml -i diff --git a/docs/conf.py b/docs/conf.py index 2786c95..72bfc44 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,17 +1,3 @@ -# Copyright 2023 MTS (Mobile Telesystems) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - # Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full @@ -25,10 +11,16 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. # + +import os import subprocess +import sys +from pathlib import Path from packaging import version as Version +sys.path.insert(0, os.fspath(Path(__file__).parent.parent.absolute())) + # -- Project information ----------------------------------------------------- project = "Evacuator" @@ -51,7 +43,12 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ["sphinx.ext.autosummary", "numpydoc", "sphinx_rtd_theme", "sphinx.ext.autodoc"] +extensions = [ + "numpydoc", + "sphinx_copybutton", + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", +] numpydoc_show_class_members = False # Add any paths that contain templates here, relative to this directory. @@ -68,7 +65,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = "sphinx_rtd_theme" +html_theme = "furo" # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, diff --git a/evacuator/core.py b/evacuator/core.py index d81e69b..2cac9ac 100644 --- a/evacuator/core.py +++ b/evacuator/core.py @@ -123,5 +123,5 @@ def __exit__(self, exc_type, exc_value, _traceback): def _handle(self) -> NoReturn: logger.exception("Caught an exception") - logger.exception("Die with exit code %s", self.exit_code, exc_info=False) # noqa: WPS323 + logger.exception("Die with exit code %s", self.exit_code, exc_info=False) sys.exit(self.exit_code) diff --git a/evacuator/exception.py b/evacuator/exception.py index ad0a825..3b31cee 100644 --- a/evacuator/exception.py +++ b/evacuator/exception.py @@ -14,4 +14,4 @@ class NeedEvacuation(RuntimeError): - pass # noqa: WPS604 WPS420 + pass diff --git a/evacuator/py.typed b/evacuator/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml index 3355055..7e56421 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,21 +4,14 @@ multi_line_output = 3 [tool.black] line-length = 120 -target-version = ['py37', 'py38', 'py39', 'py310'] # указываем версии python, с которыми должна сохраняться совместимость +target-version = ['py37', 'py38', 'py39', 'py310', 'py311'] include = '\.pyi?$' -exclude = ''' +exclude = '''(\.eggs|\.git|\.mypy_cache|\.tox|\.venv|_build|buck-out|build|dist)''' -( - /( - \.eggs # exclude a few common directories in the - | \.git # root of the project - | \.mypy_cache - | \.tox - | \.venv - | _build - | buck-out - | build - | dist - )/ -) -''' +[tool.mypy] +python_version = 3.7 +follow_imports = "silent" +ignore_missing_imports = true +pretty = true +show_error_codes = true +strict_optional = true diff --git a/pytest.ini b/pytest.ini index 0223d56..4ce15b5 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,5 +1,5 @@ [pytest] testpaths = tests -norecursedirs = .git docker evacuator +norecursedirs = .git evacuator cache_dir = .pytest_cache log_cli_level = INFO diff --git a/pytest_runner.sh b/pytest_runner.sh new file mode 100755 index 0000000..565e7aa --- /dev/null +++ b/pytest_runner.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +_term() { + echo "Caught SIGTERM signal!" + exit 255 +} + +trap _term SIGTERM SIGINT + +if [[ "x$CI" == "xtrue" ]]; then + root_path=$(dirname $(realpath $0)) + python_version=$(python -c 'import sys; print("{0}.{1}".format(*sys.version_info))') + coverage run --rcfile=tests/.coveragerc -m pytest --junitxml=$root_path/reports/junit/python${python_version}.xml "$@" +else + pytest "$@" +fi + +ret=$? +if [[ "x$ret" == "x5" ]]; then + echo "No tests collected. Exiting with 0 (instead of 5)." + exit 0 +fi +exit "$ret" diff --git a/requirements-docs.txt b/requirements-docs.txt index caee04d..2e1f6f1 100644 --- a/requirements-docs.txt +++ b/requirements-docs.txt @@ -1,4 +1,8 @@ +furo numpydoc packaging sphinx -sphinx_rtd_theme +sphinx-copybutton +# ReadTheDocs uses old OpenSSL version +# https://github.com/urllib3/urllib3/issues/2168 +urllib3<2.0 diff --git a/setup.cfg b/setup.cfg index 7bf7a7b..33ad7bf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -66,7 +66,9 @@ max-line-length = 120 max-doc-length = 120 # https://pypi.org/project/flake8-quotes/ -inline-quotes = " +inline-quotes = double +multiline-quotes = double +docstring-quotes = double # https://wemake-python-stylegui.de/en/latest/pages/usage/formatter.html show-source = True @@ -114,8 +116,27 @@ ignore = # [sometimes flask imports cannot be placed alphabetically] #FIXME: change where can be done, later switch on I, + ANN, # Found name reserved for first argument: cls [opinionated] WPS117, +# __future__ import "division" missing + FI10, +# __future__ import "absolute_import" missing + FI11, +# __future__ import "with_statement" missing + FI12, +# __future__ import "print_function" missing + FI13, +# __future__ import "unicode_literals" missing + FI14, +# __future__ import "generator_stop" missing + FI15, +# __future__ import "nested_scopes" missing + FI16, +# __future__ import "generators" missing + FI17, +# __future__ import "annotations" present + FI58, # Found `f` string [opinionated] WPS305, # Found explicit string concat [opinionated] @@ -144,10 +165,10 @@ ignore = WPS504, # WPS529:Found implicit `.get()` dict usage WPS529, -#FIXME: handle with docstring later +# FIXME: handle with docstring later # Docstrings [opinionated] D, -#P101 and P103 string does contain unindexed parameters' +# P101 and P103 string does contain unindexed parameters' P101, P103, # WPS237:Found a too complex `f` string @@ -158,8 +179,10 @@ ignore = WPS326, # WPS347 Found vague import that may cause confusion WPS347, -#WPS421 Found wrong function call: locals' +# WPS421 Found wrong function call: locals' WPS421, +# WPS348 Found a line that starts with a dot + WPS348, # WPS440 Found block variables overlap WPS440, # WPS459 Found comparison with float or complex number [buggy] @@ -178,8 +201,6 @@ ignore = E402, # RST399: Document or section may not begin with a transition. RST399, -# F821 undefined name - F821, # WPS432 Found magic number WPS432, # WPS615 Found unpythonic getter or setter @@ -188,6 +209,48 @@ ignore = RST213, # RST307: Error in "code" directive RST307, +# WPS428 Found statement that has no effect + WPS428, +# WPS462 Wrong multiline string usage + WPS462, +# WPS303 Found underscored number: + WPS303, +# WPS431 Found nested class + WPS431, +# WPS317 Invalid multiline string usage + WPS317, +# WPS226 Found string literal over-use: | [bug] + WPS226, +# WPS323 Found `%` string formatting + WPS323, +# RST305 Undefined substitution referenced: support_hooks + RST305, +# RST303 Unknown directive type tabs + RST303, +# WPS402 Found `noqa` comments overuse + WPS402, +# WPS214 Found too many methods + WPS214, +# WPS605 Found method without arguments + WPS605, +# N805 first argument of a method should be named 'self' + N805, +# WPS238 Found too many raises in a function + WPS238, +# W505: doc line too long + W505, +# E501: line too long + E501, +# WPS114 Found underscored number name pattern: package_spark_2_3 + WPS114, +# WPS420 Found wrong keyword pass + WPS420 +# WPS600 Found subclassing a builtin: str + WPS600, +# WPS601 Found shadowed class attribute + WPS601, +# WPS604 Found incorrect node inside `class` body: pass + WPS604, # http://flake8.pycqa.org/en/latest/user/options.html?highlight=per-file-ignores#cmdoption-flake8-per-file-ignores @@ -195,8 +258,6 @@ per-file-ignores = __init__.py: # * imports are valid for __init__.py scripts F403, - WPS347, - WPS440, # F401 imported but unused F401, core.py: @@ -219,8 +280,6 @@ per-file-ignores = WPS442, # WPS118 Found too long name [test usage] WPS118, -# WPS214 Found too many methods - WPS214, # WPS213 Found too many expressions WPS213, # WPS430 Found nested function: main @@ -229,24 +288,5 @@ per-file-ignores = [darglint] docstring_style = sphinx - -[isort] -# https://isort.readthedocs.io/en/latest/#configuring-isort -indent = ' ' -multi_line_output = 3 -known_third_party = marshmallow -known_standard_library = typing - -[mypy] -python_version = 3.7 -# TODO: remove later -exclude = ^(?=.*file).* -strict_optional=True -# ignore typing in third-party packages -ignore_missing_imports = True -follow_imports = silent -show_error_codes = True -disable_error_code = name-defined, misc - [codespell] ignore-words-list = INOUT, inout diff --git a/setup.py b/setup.py index 5a32d08..5942a77 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ def get_version(): return os.environ["GITHUB_REF_NAME"] version_file = here / "evacuator" / "VERSION" - version = version_file.read_text().strip() # noqa: WPS410 + version = version_file.read_text().strip() build_num = os.environ.get("GITHUB_RUN_ID", "0") branch_name = os.environ.get("GITHUB_REF_NAME", "") @@ -32,7 +32,7 @@ def get_version(): license="Apache License 2.0", license_files=("LICENSE.txt",), url="https://github.com/MobileTeleSystems/evacuator", - packages=find_packages(), + packages=find_packages(exclude=["docs", "docs.*", "tests", "tests.*"]), author="ONEtools Team", author_email="onetools@mts.ru", python_requires=">=3.7", @@ -49,7 +49,7 @@ def get_version(): "Operating System :: OS Independent", ], project_urls={ - "Documentation": "https://evacuator.readthedocs.io/en/stable/", + "Documentation": "https://evacuator.readthedocs.io", "Source": "https://github.com/MobileTeleSystems/evacuator", "CI/CD": "https://github.com/MobileTeleSystems/evacuator/actions", "Tracker": "https://github.com/MobileTeleSystems/evacuator/issues", diff --git a/tests/.coveragerc b/tests/.coveragerc new file mode 100644 index 0000000..b148286 --- /dev/null +++ b/tests/.coveragerc @@ -0,0 +1,18 @@ +[run] +branch = True +omit = tests/* +parallel = true +data_file = reports/.coverage + +[report] +exclude_lines = + pragma: no cover + def __repr__ + if self.debug: + if settings.DEBUG + raise AssertionError + raise NotImplementedError + if __name__ == .__main__.: + if TYPE_CHECKING: + class .*\bProtocol\): + @(abc\.)?abstractmethod