madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Use setuptools.find_packages in setup (#2363)
authorFelix Hildén <felix.hilden@gmail.com>
Sat, 10 Jul 2021 00:09:29 +0000 (03:09 +0300)
committerGitHub <noreply@github.com>
Sat, 10 Jul 2021 00:09:29 +0000 (17:09 -0700)
* Use setuptools.find_packages in setup

* Address mypy errors

setup.py
src/black_primer/__init__.py [new file with mode: 0644]
src/black_primer/cli.py
tests/test_primer.py

index 5549ae353423853023441343b82568e348d825ef..95252eab054dfc6aed2fd23d314d5c5f4516e5d0 100644 (file)
--- 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 (file)
index 0000000..e69de29
index f0997049d2159c1bddfcfaaaba4a6809ea8e618e..8360fc3c703aca763bdec462bc8667d08091eb5c 100644 (file)
@@ -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"""
index 3c1ec2f929f19bbfabf48148db4839e7bee1ab47..8dd1212313e09a081a3d9d494acf74f2b6993fc0 100644 (file)
@@ -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: