From dd6c674e3a33ac6d20faea751764aeafecdf34c2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Felix=20Hild=C3=A9n?= Date: Sat, 10 Jul 2021 03:09:29 +0300 Subject: [PATCH] Use setuptools.find_packages in setup (#2363) * Use setuptools.find_packages in setup * Address mypy errors --- setup.py | 4 ++-- src/black_primer/__init__.py | 0 src/black_primer/cli.py | 6 +++--- tests/test_primer.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 src/black_primer/__init__.py diff --git a/setup.py b/setup.py index 5549ae3..95252ea 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ # Copyright (C) 2020 Łukasz Langa -from setuptools import setup +from setuptools import setup, find_packages import sys import os @@ -62,7 +62,7 @@ setup( license="MIT", py_modules=["_black_version"], ext_modules=ext_modules, - packages=["blackd", "black", "blib2to3", "blib2to3.pgen2", "black_primer"], + packages=find_packages(where="src"), package_dir={"": "src"}, package_data={ "blib2to3": ["*.txt"], diff --git a/src/black_primer/__init__.py b/src/black_primer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/black_primer/cli.py b/src/black_primer/cli.py index f099704..8360fc3 100644 --- a/src/black_primer/cli.py +++ b/src/black_primer/cli.py @@ -7,7 +7,7 @@ from datetime import datetime from pathlib import Path from shutil import rmtree, which from tempfile import gettempdir -from typing import Any, Union +from typing import Any, Union, Optional import click @@ -29,8 +29,8 @@ LOG = logging.getLogger(__name__) def _handle_debug( - ctx: click.core.Context, - param: Union[click.core.Option, click.core.Parameter], + ctx: Optional[click.core.Context], + param: Optional[Union[click.core.Option, click.core.Parameter]], debug: Union[bool, int, str], ) -> Union[bool, int, str]: """Turn on debugging if asked otherwise INFO default""" diff --git a/tests/test_primer.py b/tests/test_primer.py index 3c1ec2f..8dd1212 100644 --- a/tests/test_primer.py +++ b/tests/test_primer.py @@ -189,7 +189,7 @@ class PrimerLibTests(unittest.TestCase): with patch("black_primer.lib.git_checkout_or_rebase", return_false): with TemporaryDirectory() as td: return_val = loop.run_until_complete( - lib.process_queue(str(config_path), td, 2) + lib.process_queue(str(config_path), Path(td), 2) ) self.assertEqual(0, return_val) @@ -210,7 +210,7 @@ class PrimerCLITests(unittest.TestCase): "no_diff": False, } with patch("black_primer.cli.lib.process_queue", return_zero): - return_val = loop.run_until_complete(cli.async_main(**args)) + return_val = loop.run_until_complete(cli.async_main(**args)) # type: ignore self.assertEqual(0, return_val) def test_handle_debug(self) -> None: -- 2.39.5