Просмотр исходного кода

build(wheel): Omit dev requirements from binary distributions (#21390)

All the extra requirements are listed in the wheel which prevented us from uploading the 20.10.0 wheel to PyPI as we list `openapi-core` through our forked GitHub repo. This PR omits `dev` requirements from the binary wheels that are built to allow using git or URL based dependencies as dev dependencies.
Burak Yigit Kaya 4 лет назад
Родитель
Сommit
c23cbde83a
1 измененных файлов с 15 добавлено и 11 удалено
  1. 15 11
      setup.py

+ 15 - 11
setup.py

@@ -32,15 +32,6 @@ VERSION = "20.11.0.dev0"
 IS_LIGHT_BUILD = os.environ.get("SENTRY_LIGHT_BUILD") == "1"
 
 
-def get_requirements(env):
-    with open(u"requirements-{}.txt".format(env)) as fp:
-        return [x.strip() for x in fp.read().split("\n") if not x.startswith("#")]
-
-
-install_requires = get_requirements("base")
-dev_requires = get_requirements("dev")
-
-
 class SentrySDistCommand(SDistCommand):
     # If we are not a light build we want to also execute build_assets as
     # part of our source build pipeline.
@@ -84,6 +75,19 @@ cmdclass = {
 }
 
 
+def get_requirements(env):
+    with open(u"requirements-{}.txt".format(env)) as fp:
+        return [x.strip() for x in fp.read().split("\n") if not x.startswith("#")]
+
+
+# Only include dev requirements in non-binary distributions as we don't want these
+# to be listed in the wheels. Main reason for this is being able to use git/URL dependencies
+# for development, which will be rejected by PyPI when trying to upload the wheel.
+extras_require = {"rabbitmq": ["amqp==2.6.1"]}
+if not sys.argv[1:][0].startswith("bdist"):
+    extras_require["dev"] = get_requirements("dev")
+
+
 setup(
     name="sentry",
     version=VERSION,
@@ -96,8 +100,8 @@ setup(
     package_dir={"": "src"},
     packages=find_packages("src"),
     zip_safe=False,
-    install_requires=install_requires,
-    extras_require={"dev": dev_requires, "rabbitmq": ["amqp==2.6.1"]},
+    install_requires=get_requirements("base"),
+    extras_require=extras_require,
     cmdclass=cmdclass,
     license="BSL-1.1",
     include_package_data=True,