diff --git a/Makefile b/Makefile index 9025b8b..c7fe69b 100644 --- a/Makefile +++ b/Makefile @@ -16,13 +16,11 @@ style: ## Run code style checks. @poetry run isort --check --diff . @echo "🚀 Checking code formatting with black: Running black --check --diff ." @poetry run black --check --diff . - @echo "🚀 Static type checking: Running mypy -p dream_team_gpt" - @poetry run mypy -p dream_team_gpt test: ## Test the code with pytest @echo "🚀 Testing code: Running pytest" - @#poetry run pytest tests/ + @poetry run pytest tests/ verify: ## Run style and tests check diff --git a/dream_team_gpt/clients/base.py b/dream_team_gpt/clients/base.py index 8cc094b..f44d8d4 100644 --- a/dream_team_gpt/clients/base.py +++ b/dream_team_gpt/clients/base.py @@ -3,5 +3,5 @@ class AIClient(ABC): @abstractmethod - def query(self, transcript: str): + def query(self, transcript: str) -> str: pass diff --git a/dream_team_gpt/main.py b/dream_team_gpt/main.py index e79730a..783a4d6 100644 --- a/dream_team_gpt/main.py +++ b/dream_team_gpt/main.py @@ -28,7 +28,6 @@ ) @click.option("-v", "--verbose", default=1, count=True) def main(idea: str, config: Path = None, verbose: int = 1): - print(idea) configure_logging(verbose) load_dotenv() diff --git a/dream_team_gpt/utils/logging.py b/dream_team_gpt/utils/logging.py index 9ccf003..7265fd0 100644 --- a/dream_team_gpt/utils/logging.py +++ b/dream_team_gpt/utils/logging.py @@ -3,7 +3,7 @@ from loguru import logger -def configure_logging(verbose: int): +def configure_logging(verbose: int = 0) -> None: logging_levels = {0: "ERROR", 1: "INFO", 2: "DEBUG"} logger.remove(0) logger.add(sys.stdout, level=logging_levels.get(verbose)) diff --git a/dream_team_gpt/utils/parse_config.py b/dream_team_gpt/utils/parse_config.py index a82be4f..b986863 100644 --- a/dream_team_gpt/utils/parse_config.py +++ b/dream_team_gpt/utils/parse_config.py @@ -20,7 +20,7 @@ def parse_yaml_config(file_path: Path) -> list[dict]: return items -def read_yaml(file_path): +def read_yaml(file_path: Path) -> list[dict]: with open(file_path, "r") as file: data = yaml.safe_load(file) return data diff --git a/dream_team_gpt/utils/print_with_wrap.py b/dream_team_gpt/utils/print_with_wrap.py index 7adfc51..6caf3f7 100644 --- a/dream_team_gpt/utils/print_with_wrap.py +++ b/dream_team_gpt/utils/print_with_wrap.py @@ -1,7 +1,7 @@ import textwrap -def print_with_wrap(text: str, wrap_length: int = 180): +def print_with_wrap(text: str, wrap_length: int = 180) -> None: lines = text.split("\n") for line in lines: wrapped_text = textwrap.wrap(line, wrap_length) diff --git a/dream_team_gpt/utils/token_counter.py b/dream_team_gpt/utils/token_counter.py index 71265f3..cf84260 100644 --- a/dream_team_gpt/utils/token_counter.py +++ b/dream_team_gpt/utils/token_counter.py @@ -1,7 +1,7 @@ import tiktoken -def num_tokens_from_messages(messages, model="gpt-3.5-turbo-0613"): +def num_tokens_from_messages(messages, model="gpt-3.5-turbo-0613") -> int: """Return the number of tokens used by a list of messages.""" try: encoding = tiktoken.encoding_for_model(model) diff --git a/pyproject.toml b/pyproject.toml index f3366c4..f417de3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,13 +45,13 @@ include_trailing_comma = true use_parentheses = true [tool.mypy] -disallow_untyped_defs = true +check_untyped_defs = true disallow_any_unimported = true +disallow_untyped_defs = true no_implicit_optional = true -check_untyped_defs = true +show_error_codes = true warn_return_any = true warn_unused_ignores = true -show_error_codes = true python_version = 3.11 [tool.pytest.ini_options]