From cdbcf54cb504f4179383f32f3672158e8f55b161 Mon Sep 17 00:00:00 2001 From: Nikhil Benesch Date: Fri, 13 Aug 2021 14:46:05 -0400 Subject: [PATCH] pyfmt: enforce isort in CI too This will prevent the next person who runs `bin/pyfmt` from seeing spurious diffs on their branch. Also run flake8 to prevent unused imports and variables. --- bin/lint | 2 +- bin/pycheck | 19 ++------- bin/pyfmt | 9 +++- ci/builder/nightly.stamp | 2 +- ci/builder/stable.stamp | 2 +- ci/cleanup/aws.py | 1 - ci/deploy/deploy_util.py | 2 +- ci/deploy/linux.py | 2 - ci/load/periodic.py | 3 +- ci/nightly/coverage.py | 3 +- ci/test/build.py | 1 - ci/test/mkpipeline.py | 4 +- misc/mzutil/scripts/wait_for_view_states.py | 3 -- .../materialize/cli/deploy_antithesis.py | 1 - misc/python/materialize/cli/mkrelease.py | 8 ++-- .../materialize/cli/mock_telemetry_server.py | 1 - misc/python/materialize/cli/mzbench.py | 4 +- misc/python/materialize/cli/mzcompose.py | 5 +-- misc/python/materialize/cli/mzimage.py | 4 +- .../materialize/cli/scratch/__init__.py | 1 - .../materialize/cli/scratch/__main__.py | 7 +--- misc/python/materialize/cli/scratch/create.py | 4 +- .../python/materialize/cli/scratch/destroy.py | 1 + misc/python/materialize/cli/scratch/mine.py | 3 +- misc/python/materialize/git.py | 4 +- misc/python/materialize/mzbuild.py | 19 +-------- misc/python/materialize/mzcompose.py | 21 ++++------ misc/python/materialize/scratch.py | 4 +- misc/python/materialize/spawn.py | 4 +- misc/python/requirements-dev.txt | 1 + misc/python/requirements.txt | 1 - misc/python/tests/test_git.py | 1 - misc/python/tests/test_mzconduct.py | 2 - misc/shlib/shlib.bash | 4 +- mypy.ini | 24 ----------- pyproject.toml | 41 +++++++++++++++++++ 36 files changed, 91 insertions(+), 127 deletions(-) delete mode 100644 mypy.ini create mode 100644 pyproject.toml diff --git a/bin/lint b/bin/lint index df5c0ba1bcce5..19ae52107c981 100755 --- a/bin/lint +++ b/bin/lint @@ -80,7 +80,7 @@ fi if [[ ! "${MZDEV_NO_PYTHON:-}" ]]; then try bin/pycheck - try bin/pyfmt --diff --check --quiet + try bin/pyfmt --check --diff if try_last_failed; then echo "lint: $(red error:) python formatting discrepancies found" echo "hint: run bin/pyfmt" >&2 diff --git a/bin/pycheck b/bin/pycheck index d9827b04a76a2..24c92973eb744 100755 --- a/bin/pycheck +++ b/bin/pycheck @@ -17,22 +17,9 @@ cd "$(dirname "$0")/.." . misc/shlib/shlib.bash -py_files=$(git_files "ci/*.py" "misc/python/*.py" "misc/mzutil/scripts/*.py" "misc/kafka-util/scripts/*.py") +py_folders=(ci misc/kafka-util/scripts misc/mzutil/scripts misc/python) -# Bail out with a nice error message if we discover any syntax errors, so that -# mypy and pytest don't spew nonsense. -if ! bin/pyactivate --dev -m compileall -q -l -i - <<< "$py_files"; then - echo "pycheck: $(red error:) python syntax errors found" - exit 1 -fi - -try xargs bin/pyactivate --dev -m mypy \ - --pretty \ - --no-error-summary \ - --namespace-packages \ - --explicit-package-bases \ - --python-version 3.8 \ - <<< "$py_files" +try bin/pyactivate --dev -m mypy "${py_folders[@]}" +try bin/pyactivate --dev -m flake8 --select F --ignore F541 --extend-exclude venv "${py_folders[@]}" try bin/pyactivate --dev -m pytest -qq --doctest-modules misc/python - try_finish diff --git a/bin/pyfmt b/bin/pyfmt index 27c39d24aa5a4..1f63479291365 100755 --- a/bin/pyfmt +++ b/bin/pyfmt @@ -13,5 +13,10 @@ set -euo pipefail -"$(dirname "$0")"/pyactivate --dev -m black --target-version py38 . "$@" -"$(dirname "$0")"/pyactivate --dev -m isort --profile black . +cd "$(dirname "$0")/.." + +. misc/shlib/shlib.bash + +try bin/pyactivate --dev -m black . "$@" +try bin/pyactivate --dev -m isort . "$@" +try_finish diff --git a/ci/builder/nightly.stamp b/ci/builder/nightly.stamp index 83435e63091dc..d16c96d227e83 100644 --- a/ci/builder/nightly.stamp +++ b/ci/builder/nightly.stamp @@ -1 +1 @@ -nightly-20210810-190658 +nightly-20210814-011646 diff --git a/ci/builder/stable.stamp b/ci/builder/stable.stamp index f2d0bc68d2647..f907087abb812 100644 --- a/ci/builder/stable.stamp +++ b/ci/builder/stable.stamp @@ -1 +1 @@ -1.54.0-20210810-184007 +1.54.0-20210814-010705 diff --git a/ci/cleanup/aws.py b/ci/cleanup/aws.py index 2911e2ec5f25f..e2f2efe14ff8b 100644 --- a/ci/cleanup/aws.py +++ b/ci/cleanup/aws.py @@ -12,7 +12,6 @@ from urllib.parse import unquote, urlparse import boto3 -import botocore from materialize import scratch diff --git a/ci/deploy/deploy_util.py b/ci/deploy/deploy_util.py index 9c60f79627e48..3f7845dc43b49 100644 --- a/ci/deploy/deploy_util.py +++ b/ci/deploy/deploy_util.py @@ -16,7 +16,7 @@ import boto3 import humanize -from materialize import git, spawn +from materialize import git APT_BUCKET = "materialize-apt" BINARIES_BUCKET = "materialize-binaries" diff --git a/ci/deploy/linux.py b/ci/deploy/linux.py index b68a41e49f5c1..ceffa3708f369 100644 --- a/ci/deploy/linux.py +++ b/ci/deploy/linux.py @@ -7,9 +7,7 @@ # the Business Source License, use of this software will be governed # by the Apache License, Version 2.0. -import io import os -import subprocess from pathlib import Path import boto3 diff --git a/ci/load/periodic.py b/ci/load/periodic.py index 173effa73e86f..c8347d47bae17 100644 --- a/ci/load/periodic.py +++ b/ci/load/periodic.py @@ -9,14 +9,13 @@ import datetime +from materialize import scratch from materialize.cli.scratch import ( DEFAULT_INSTPROF_NAME, DEFAULT_SG_ID, DEFAULT_SUBNET_ID, ) -from materialize import scratch - def main() -> None: desc = scratch.MachineDesc( diff --git a/ci/nightly/coverage.py b/ci/nightly/coverage.py index 064c5eea4ab3f..2cf515cfc86f2 100644 --- a/ci/nightly/coverage.py +++ b/ci/nightly/coverage.py @@ -22,9 +22,10 @@ import sys from pathlib import Path -import materialize.cli.mzcompose import yaml +import materialize.cli.mzcompose + def main() -> int: with open(Path(__file__).parent.parent / "test" / "pipeline.template.yml") as f: diff --git a/ci/test/build.py b/ci/test/build.py index 155e9915ac0ac..4fdbcbfe7b9c1 100644 --- a/ci/test/build.py +++ b/ci/test/build.py @@ -13,7 +13,6 @@ from pathlib import Path import boto3 -import humanize from materialize import cargo, ci_util, deb, errors, git, mzbuild, spawn diff --git a/ci/test/mkpipeline.py b/ci/test/mkpipeline.py index f64d1934b7cab..1549ff9f81806 100644 --- a/ci/test/mkpipeline.py +++ b/ci/test/mkpipeline.py @@ -25,11 +25,11 @@ from collections import OrderedDict from pathlib import Path from tempfile import TemporaryFile -from typing import Any, Iterable, List, Sequence, Set +from typing import Any, Iterable, Set import yaml -from materialize import git, mzbuild, mzcompose, spawn +from materialize import mzbuild, mzcompose, spawn # These paths contain "CI glue code", i.e., the code that powers CI itself, # including this very script! All of CI implicitly depends on this code, so diff --git a/misc/mzutil/scripts/wait_for_view_states.py b/misc/mzutil/scripts/wait_for_view_states.py index a9a2d0d30209e..ad382437d2958 100755 --- a/misc/mzutil/scripts/wait_for_view_states.py +++ b/misc/mzutil/scripts/wait_for_view_states.py @@ -17,9 +17,7 @@ """ import argparse -import glob import io -import json import os import pathlib import sys @@ -125,7 +123,6 @@ def wait_for_materialize_views(args: argparse.Namespace) -> None: if view not in view_snapshots: continue - sources: typing.List[str] = query_info["sources"] if len(query_info["sources"]) != 1: print( f"ERROR: Expected just one source for view {view}: {query_info['sources']}" diff --git a/misc/python/materialize/cli/deploy_antithesis.py b/misc/python/materialize/cli/deploy_antithesis.py index 2fd69a2f3dba3..7aa80b331a4c8 100644 --- a/misc/python/materialize/cli/deploy_antithesis.py +++ b/misc/python/materialize/cli/deploy_antithesis.py @@ -7,7 +7,6 @@ # the Business Source License, use of this software will be governed # by the Apache License, Version 2.0. -import itertools import os from pathlib import Path diff --git a/misc/python/materialize/cli/mkrelease.py b/misc/python/materialize/cli/mkrelease.py index f788e9782eabf..6ca321c9bd315 100644 --- a/misc/python/materialize/cli/mkrelease.py +++ b/misc/python/materialize/cli/mkrelease.py @@ -7,15 +7,14 @@ # the Business Source License, use of this software will be governed # by the Apache License, Version 2.0. -import base64 import concurrent.futures import os import re import subprocess import sys -from datetime import date, timedelta +from datetime import date from pathlib import Path -from typing import Any, Dict, Optional +from typing import Any, Optional import click import requests @@ -198,7 +197,6 @@ def release( raise errors.MzConfigurationError( "working directory is not clean, stash or commit your changes" ) - sys.exit(1) the_tag = f"v{version}" confirm_version_is_next(version, affect_remote) @@ -364,7 +362,7 @@ def update_upgrade_tests_inner(released_version: Version) -> None: spawn.capture( "bin/mzcompose --mz-find upgrade list-workflows".split(), stderr_too=True ) - except subprocess.CalledProcessError as e: + except subprocess.CalledProcessError: say( f"The generated test/upgrade/mzcompose.yml file appears to be broken, " f"please consult {readme}" diff --git a/misc/python/materialize/cli/mock_telemetry_server.py b/misc/python/materialize/cli/mock_telemetry_server.py index 0ac80167bedbb..bc2774da5341b 100644 --- a/misc/python/materialize/cli/mock_telemetry_server.py +++ b/misc/python/materialize/cli/mock_telemetry_server.py @@ -54,7 +54,6 @@ from http.server import BaseHTTPRequestHandler, HTTPServer from pathlib import Path -import toml from materialize.cargo import Workspace diff --git a/misc/python/materialize/cli/mzbench.py b/misc/python/materialize/cli/mzbench.py index 860d2ee303916..0a2d8318ad6b7 100644 --- a/misc/python/materialize/cli/mzbench.py +++ b/misc/python/materialize/cli/mzbench.py @@ -10,7 +10,6 @@ # mzbench.py -- script to run materialized benchmarks import argparse -import collections import csv import itertools import multiprocessing @@ -20,7 +19,6 @@ import sys import typing import uuid -import webbrowser from typing import Any, Dict, List, Optional, Tuple, Union @@ -250,7 +248,7 @@ def main(args: argparse.Namespace) -> None: "web", f"perf-dash-web", ] - output = subprocess.check_output(web_command, stderr=subprocess.STDOUT) + subprocess.check_output(web_command, stderr=subprocess.STDOUT) except (subprocess.CalledProcessError,) as e: print(f"Failed to open browser to perf-dash:\n{e.output.decode()}") raise diff --git a/misc/python/materialize/cli/mzcompose.py b/misc/python/materialize/cli/mzcompose.py index 1601c441919ba..8e7e83418da56 100644 --- a/misc/python/materialize/cli/mzcompose.py +++ b/misc/python/materialize/cli/mzcompose.py @@ -10,16 +10,13 @@ # mzcompose.py — runs Docker Compose with Materialize customizations. import argparse -import json import os -import subprocess import sys import webbrowser from pathlib import Path -from typing import IO, List, Optional, Sequence, Text, Tuple +from typing import IO, List, NoReturn, Optional, Sequence, Text, Tuple from materialize import errors, mzbuild, mzcompose, spawn, ui -from typing_extensions import NoReturn announce = ui.speaker("==> ") say = ui.speaker("") diff --git a/misc/python/materialize/cli/mzimage.py b/misc/python/materialize/cli/mzimage.py index 6f70e49bf54ea..a448d68624538 100644 --- a/misc/python/materialize/cli/mzimage.py +++ b/misc/python/materialize/cli/mzimage.py @@ -13,9 +13,9 @@ import os import sys from pathlib import Path -from typing import Any, List +from typing import Any -from materialize import git, mzbuild, ui +from materialize import mzbuild, ui def main() -> int: diff --git a/misc/python/materialize/cli/scratch/__init__.py b/misc/python/materialize/cli/scratch/__init__.py index 0c12569c1b480..4b044ecce3731 100644 --- a/misc/python/materialize/cli/scratch/__init__.py +++ b/misc/python/materialize/cli/scratch/__init__.py @@ -7,7 +7,6 @@ # the Business Source License, use of this software will be governed # by the Apache License, Version 2.0. -import argparse import os # Sane defaults for internal Materialize use in the scratch account diff --git a/misc/python/materialize/cli/scratch/__main__.py b/misc/python/materialize/cli/scratch/__main__.py index bea736c3b3c8c..e6836ed675795 100644 --- a/misc/python/materialize/cli/scratch/__main__.py +++ b/misc/python/materialize/cli/scratch/__main__.py @@ -8,17 +8,12 @@ # by the Apache License, Version 2.0. import argparse -import types -from typing import Callable, NamedTuple - -from materialize.cli.scratch import create, mine from materialize import errors +from materialize.cli.scratch import create, destroy, mine def main() -> None: - from materialize.cli.scratch import create, destroy, mine - parser = argparse.ArgumentParser() subparsers = parser.add_subparsers(dest="subcommand") for name, configure, run in [ diff --git a/misc/python/materialize/cli/scratch/create.py b/misc/python/materialize/cli/scratch/create.py index 02748e75ba0ca..1980e5c5bec54 100644 --- a/misc/python/materialize/cli/scratch/create.py +++ b/misc/python/materialize/cli/scratch/create.py @@ -9,13 +9,11 @@ import argparse import json -import os import random import sys from datetime import datetime, timedelta, timezone from typing import Any, Dict, List -import boto3 from materialize.cli.scratch import ( DEFAULT_INSTPROF_NAME, DEFAULT_SG_ID, @@ -89,7 +87,7 @@ def run(args: argparse.Namespace) -> None: for obj in multi_json(sys.stdin.read()) ] - nonce = "".join(random.choice("0123456789abcdef") for n in range(8)) + nonce = "".join(random.choice("0123456789abcdef") for _ in range(8)) delete_after = int(datetime.now(timezone.utc).timestamp() + MAX_AGE.total_seconds()) instances = launch_cluster( diff --git a/misc/python/materialize/cli/scratch/destroy.py b/misc/python/materialize/cli/scratch/destroy.py index 9243dd5f0cb1c..b429355d9c134 100644 --- a/misc/python/materialize/cli/scratch/destroy.py +++ b/misc/python/materialize/cli/scratch/destroy.py @@ -10,6 +10,7 @@ import argparse import boto3 + from materialize.cli.scratch import check_required_vars from materialize.scratch import print_instances diff --git a/misc/python/materialize/cli/scratch/mine.py b/misc/python/materialize/cli/scratch/mine.py index b50826db8cc7e..f7260a0d88edf 100644 --- a/misc/python/materialize/cli/scratch/mine.py +++ b/misc/python/materialize/cli/scratch/mine.py @@ -11,9 +11,10 @@ from typing import Callable import boto3 +from mypy_boto3_ec2.service_resource import Instance + from materialize.cli.scratch import check_required_vars from materialize.scratch import launched_by, print_instances, tags, whoami -from mypy_boto3_ec2.service_resource import Instance def configure_parser(parser: argparse.ArgumentParser) -> None: diff --git a/misc/python/materialize/git.py b/misc/python/materialize/git.py index 3885b06a687a0..1e1087812a747 100644 --- a/misc/python/materialize/git.py +++ b/misc/python/materialize/git.py @@ -11,9 +11,9 @@ import subprocess import sys -from functools import lru_cache, total_ordering +from functools import lru_cache from pathlib import Path -from typing import List, NamedTuple, Optional, Set, Union +from typing import List, Optional, Set, Union import semver.version diff --git a/misc/python/materialize/mzbuild.py b/misc/python/materialize/mzbuild.py index 0a6cb827a4cc4..5e6713f4dbe28 100644 --- a/misc/python/materialize/mzbuild.py +++ b/misc/python/materialize/mzbuild.py @@ -16,7 +16,6 @@ """ import base64 -import contextlib import enum import hashlib import json @@ -31,23 +30,9 @@ from functools import lru_cache from pathlib import Path from tempfile import TemporaryFile -from typing import ( - IO, - Any, - Dict, - Iterable, - Iterator, - List, - Optional, - Sequence, - Set, - Union, - cast, - overload, -) +from typing import IO, Any, Dict, Iterable, Iterator, List, Sequence, Set import yaml -from typing_extensions import Literal from materialize import cargo, git, spawn, ui @@ -677,7 +662,7 @@ def acquire(self, force_build: bool = False) -> None: d.build() else: announce(f"Acquiring {spec}") - acquired_from = d.acquire() + d.acquire() else: announce(f"Already built {spec}") diff --git a/misc/python/materialize/mzcompose.py b/misc/python/materialize/mzcompose.py index 1f1c67a156e8d..494bcbd369b88 100644 --- a/misc/python/materialize/mzcompose.py +++ b/misc/python/materialize/mzcompose.py @@ -21,7 +21,6 @@ import ipaddress import json import os -import pathlib import random import re import shlex @@ -32,17 +31,17 @@ from pathlib import Path from tempfile import TemporaryFile from typing import ( - IO, Any, Callable, Collection, - Container, Dict, Iterable, List, + Literal, Match, Optional, Type, + TypedDict, TypeVar, Union, cast, @@ -51,8 +50,8 @@ import pg8000 # type: ignore import pymysql import yaml + from materialize import errors, mzbuild, spawn, ui -from typing_extensions import Literal, TypedDict T = TypeVar("T") say = ui.speaker("C> ") @@ -351,9 +350,9 @@ def lint(cls, repo: mzbuild.Repository, name: str) -> List[LintError]: with open(path) as f: composition = yaml.safe_load(f) - errors: List[LintError] = [] - lint_composition(path, composition, errors) - return errors + errs: List[LintError] = [] + lint_composition(path, composition, errs) + return errs def run( self, @@ -1041,10 +1040,8 @@ def run(self, workflow: Workflow) -> None: cmd = f"docker run --rm -t --network {workflow.composition.name}_default ubuntu:bionic-20200403".split() try: - executed = _check_tcp( - cmd[:], self._host, self._port, self._timeout_secs - ) - except subprocess.CalledProcessError as e: + _check_tcp(cmd[:], self._host, self._port, self._timeout_secs) + except subprocess.CalledProcessError: ui.progress(" {}".format(int(remaining))) else: ui.progress(" success!", finish=True) @@ -1056,7 +1053,7 @@ def run(self, workflow: Workflow) -> None: _check_tcp( cmd[:], host, port, self._timeout_secs, kind="dependency " ) - except subprocess.CalledProcessError as e: + except subprocess.CalledProcessError: message = f"Dependency is down {host}:{port}" if "hint" in dep: message += f"\n hint: {dep['hint']}" diff --git a/misc/python/materialize/scratch.py b/misc/python/materialize/scratch.py index 87b9f59d48421..9a1c16df835a0 100644 --- a/misc/python/materialize/scratch.py +++ b/misc/python/materialize/scratch.py @@ -15,7 +15,7 @@ import shlex import sys import tempfile -from datetime import datetime, timedelta, timezone +from datetime import datetime, timezone from subprocess import CalledProcessError from typing import Dict, List, NamedTuple, Optional @@ -28,7 +28,7 @@ ) from prettytable import PrettyTable -from materialize import errors, git, spawn, ssh, ui +from materialize import git, spawn, ssh, ui SPEAKER = ui.speaker("scratch> ") ROOT = os.environ["MZ_ROOT"] diff --git a/misc/python/materialize/spawn.py b/misc/python/materialize/spawn.py index 850a006fbdfe0..4120c09e20105 100644 --- a/misc/python/materialize/spawn.py +++ b/misc/python/materialize/spawn.py @@ -17,9 +17,7 @@ import subprocess from pathlib import Path -from typing import IO, Dict, Optional, Sequence, Union, overload - -from typing_extensions import Literal +from typing import IO, Dict, Literal, Optional, Sequence, Union, overload from materialize import ui diff --git a/misc/python/requirements-dev.txt b/misc/python/requirements-dev.txt index 485900e046387..4a8f25561f9b8 100644 --- a/misc/python/requirements-dev.txt +++ b/misc/python/requirements-dev.txt @@ -3,6 +3,7 @@ boto3-stubs[ec2,kinesis,s3,sqs,ssm,sts]==1.18.13 boto3==1.17.46 humanize==3.11.0 isort==5.9.3 +flake8==3.9.2 mypy==0.910 pdoc3==0.8.1 prettytable==2.1.0 diff --git a/misc/python/requirements.txt b/misc/python/requirements.txt index 76961d2e1417e..4f19ff1e51d80 100644 --- a/misc/python/requirements.txt +++ b/misc/python/requirements.txt @@ -4,4 +4,3 @@ PyMySQL==1.0.2 pyyaml==5.4.1 semver==3.0.0-dev.2 toml==0.10.2 -typing-extensions==3.10.0.0 diff --git a/misc/python/tests/test_git.py b/misc/python/tests/test_git.py index a77a33475eb7c..7d9af9941e40b 100644 --- a/misc/python/tests/test_git.py +++ b/misc/python/tests/test_git.py @@ -9,7 +9,6 @@ from unittest.mock import patch -import pytest # type: ignore from semver.version import Version from materialize import git diff --git a/misc/python/tests/test_mzconduct.py b/misc/python/tests/test_mzconduct.py index 159a510edfb9a..fd7ed4f549d24 100644 --- a/misc/python/tests/test_mzconduct.py +++ b/misc/python/tests/test_mzconduct.py @@ -7,8 +7,6 @@ # the Business Source License, use of this software will be governed # by the Apache License, Version 2.0. -import os - from materialize import mzcompose diff --git a/misc/shlib/shlib.bash b/misc/shlib/shlib.bash index 5e8ae560d7c5c..e554537aa46b6 100644 --- a/misc/shlib/shlib.bash +++ b/misc/shlib/shlib.bash @@ -24,7 +24,7 @@ die() { # Runs PROGRAM, but informs the user first. Specifically, run outputs "PROGRAM # ARGS..." to stderr, then executes PROGRAM with the specified ARGS. run() { - echo "$*" >&2 + echo "\$ $*" >&2 "$@" } @@ -84,7 +84,7 @@ git_files() { # command fails. See also try_last_failed and try_finish. try() { try_last_failed=false - if ! "$@"; then + if ! run "$@"; then try_failed=true try_last_failed=true fi diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index 6e86997a2e9f9..0000000000000 --- a/mypy.ini +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright Materialize, Inc. and contributors. All rights reserved. -# -# Use of this software is governed by the Business Source License -# included in the LICENSE file at the root of this repository. -# -# As of the Change Date specified in that file, in accordance with -# the Business Source License, use of this software will be governed -# by the Apache License, Version 2.0. - -[mypy] -allow_redefinition = True -disallow_incomplete_defs = True -disallow_subclassing_any = True -disallow_untyped_calls = True -disallow_untyped_decorators = True -disallow_untyped_defs = True -no_implicit_optional = True -python_version = 3.6 -strict_equality = True -warn_unused_configs = True -warn_redundant_casts = True -warn_unused_ignores = True -warn_return_any = True -warn_unreachable = True diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000000..6d2d3dd2af8e1 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,41 @@ +# Copyright Materialize, Inc. and contributors. All rights reserved. +# +# Use of this software is governed by the Business Source License +# included in the LICENSE file at the root of this repository. +# +# As of the Change Date specified in that file, in accordance with +# the Business Source License, use of this software will be governed +# by the Apache License, Version 2.0. + +[tool.black] +target_version = ["py38"] + +[tool.isort] +extend_skip = ["target"] +known_first_party = ["materialize"] +profile = "black" +py_version = "38" + +[tool.mypy] +# Basic mypy configuration. +error_summary = false +exclude = "/venv/" +explicit_package_bases = true +namespace_packages = true +pretty = true +python_version = "3.8" + +# Lint rules. +allow_redefinition = true +disallow_incomplete_defs = true +disallow_subclassing_any = true +disallow_untyped_calls = true +disallow_untyped_decorators = true +disallow_untyped_defs = true +no_implicit_optional = true +strict_equality = true +warn_unused_configs = true +warn_redundant_casts = true +warn_unused_ignores = true +warn_return_any = true +warn_unreachable = true