diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 0d900dce..00000000 --- a/.flake8 +++ /dev/null @@ -1,11 +0,0 @@ -[flake8] -; Disabling the checks that conflict with "black" and "pylint": -; E122 "continuation line missing indentation or outdented" -; E126 "continuation line over-indented for hanging indent" -; E131 "continuation line unaligned for hanging indent" -; E203 "whitespace before ':'" -; E501 "line too long (129 > 120 characters)" -; W503 "line break before binary operator" -; F401 "module imported but unused" -select = E,F,W,C,S -ignore = E122,E126,E131,E203,E501,W503,F401 diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index a327a39d..6558125f 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -1,4 +1,4 @@ -name: main +name: Main on: push: { branches: [main] } @@ -18,14 +18,14 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.11" cache: pip - name: "lint: isort" run: make isort - name: "lint: black" run: make black - - name: "lint: flake8" - run: make flake8 + - name: "lint: ruff" + run: make ruff - name: "lint: pylint" run: make pylint - name: "lint: mypy" @@ -34,6 +34,7 @@ jobs: run: make bandit test: + name: test (Python ${{ matrix.target.python }}, ClickHouse ${{ matrix.clickhouse }}) needs: lint strategy: fail-fast: false @@ -42,6 +43,8 @@ jobs: - python: "3.6" ubuntu: "20.04" - python: "3.10" + ubuntu: "22.04" + - python: "3.11" ubuntu: "latest" clickhouse: - "21.8.15.7" @@ -59,4 +62,4 @@ jobs: - name: run unit tests run: make test-unit - name: run integration tests - run: make test-integration + run: CLICKHOUSE_VERSION=${{ matrix.clickhouse }} make test-integration diff --git a/.python-version b/.python-version index c8cfe395..2c073331 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -3.10 +3.11 diff --git a/.ruff.toml b/.ruff.toml new file mode 100644 index 00000000..8e4923a6 --- /dev/null +++ b/.ruff.toml @@ -0,0 +1,9 @@ +select = ["E", "F", "W", "A"] + +ignore = [ + "A003", # "Class attribute is shadowing a Python builtin" + "E501", # "Line too long" +] + +[per-file-ignores] +"__init__.py" = ["F401"] # "Unused import" diff --git a/Makefile b/Makefile index 2f081d0d..c801a7c4 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ build: install-deps ch_backup/version.txt all: build lint test-unit test-integration .PHONY: lint -lint: install-deps isort black flake8 pylint mypy bandit +lint: install-deps isort black ruff pylint mypy bandit .PHONY: isort isort: install-deps @@ -37,9 +37,9 @@ isort: install-deps black: install-deps ${TEST_ENV} black --check --diff . -.PHONY: flake8 -flake8: install-deps - ${TEST_ENV} flake8 ch_backup tests +.PHONY: ruff +ruff: install-deps + ${TEST_ENV} ruff check ch_backup tests .PHONY: pylint pylint: install-deps @@ -157,6 +157,7 @@ install-deps: .install-deps .install-deps: requirements.txt requirements-dev.txt if [ -z "${NO_VENV}" ]; then ${PYTHON} -m venv venv; fi + ${TEST_ENV} pip install --upgrade pip ${TEST_ENV} pip install --no-cache-dir --disable-pip-version-check -r requirements.txt -r requirements-dev.txt touch .install-deps @@ -166,12 +167,12 @@ help: @echo "Targets:" @echo " build (default) Build project. It installs dependencies and generates version.txt." @echo " all Alias for \"build lint test-unit test-integration\"." - @echo " lint Run all linter tools. Alias for \"isort black flake8 pylint mypy bandit\"." + @echo " lint Run all linter tools. Alias for \"isort black ruff pylint mypy bandit\"." @echo " test-unit Run unit tests." @echo " test-integration Run integration tests." @echo " isort Perform isort checks." @echo " black Perform black checks." - @echo " flake8 Perform flake8 checks." + @echo " ruff Perform ruff checks." @echo " pylint Perform pylint checks." @echo " mypy Perform mypy checks.." @echo " bandit Perform bandit checks." diff --git a/README.md b/README.md index d0b3fa66..39562322 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Commands: ### Regression -The regression test suite contains run of static code analysis tools (isort, black, flake8, pylint, mypy, bandit), +The regression test suite contains run of static code analysis tools (isort, black, ruff, pylint, mypy, bandit), unit tests and integration tests. The tests can be run by issuing the command: diff --git a/ch_backup/type_hints/boto3/s3.py b/ch_backup/type_hints/boto3/s3.py index 3ef91a52..d0ba842b 100644 --- a/ch_backup/type_hints/boto3/s3.py +++ b/ch_backup/type_hints/boto3/s3.py @@ -4,8 +4,8 @@ from typing import TYPE_CHECKING, Any if TYPE_CHECKING: - from mypy_boto3_s3 import S3Client - from mypy_boto3_s3.type_defs import ObjectIdentifierTypeDef + from mypy_boto3_s3 import S3Client # noqa: F401 + from mypy_boto3_s3.type_defs import ObjectIdentifierTypeDef # noqa: F401 else: # TODO: Use module level __getattr_() as fallback (PEP 562) in Python 3.7+ S3Client = Any diff --git a/requirements-dev.txt b/requirements-dev.txt index 88fc4dc4..967097c7 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,8 +1,6 @@ isort black -flake8 -flake8-string-format -flake8-print +ruff; python_version >="3.7" pep8 pylint mypy==0.910 diff --git a/setup.py b/setup.py index 616b197d..9545f19b 100644 --- a/setup.py +++ b/setup.py @@ -48,6 +48,7 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Database", "Typing :: Typed", ],