From ff68d16bb68960dbee188771f6f334ab69a98b23 Mon Sep 17 00:00:00 2001 From: Oleksandr <0init0@gmail.com> Date: Thu, 17 Jun 2021 18:06:04 +0300 Subject: [PATCH] fix: exclude docs and tests from package (#63) Currently, packages `tests` and `docs` are installed (because they are discovered as valid packages by `PEP420PackageFinder`), which can break user's code if they also use `test` as a location for their tests, due to package name conflict. To reproduce - install this package from pypi, see that `tests` package is present in your venv's site-packages. This change pretty much follows what other Google packages do, eg [here](https://github.com/googleapis/python-api-core/blob/master/setup.py#L66) --- setup.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 66a69a7..89ce943 100644 --- a/setup.py +++ b/setup.py @@ -27,6 +27,12 @@ with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() +packages = [ + package + for package in setuptools.PEP420PackageFinder.find() + if package.startswith("google") +] + setuptools.setup( name="google-cloud-workflows", version=version, @@ -35,7 +41,7 @@ author_email="googleapis-packages@google.com", license="Apache 2.0", url="https://github.com/googleapis/python-workflows", - packages=setuptools.PEP420PackageFinder.find(), + packages=packages, namespace_packages=("google", "google.cloud"), platforms="Posix; MacOS X; Windows", include_package_data=True,