From 1c7e2e4ae17ff1a5eb392632d502c083ac1cf9ff Mon Sep 17 00:00:00 2001 From: Harsha Nori Date: Mon, 6 May 2024 23:59:47 -0700 Subject: [PATCH 1/3] Add guard for setup.py build invocations due to PyBind11/setuptools_rust dependencies --- setup.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/setup.py b/setup.py index 645778f28..3e7fac5e2 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,17 @@ +import sys + +# Check if 'setup.py' is run directly with 'build' +# TODO: Consider generalizing this check further? +if __name__ == "__main__": + if len(sys.argv) >= 2 and sys.argv[1] == 'build': + raise SystemExit( + "Error: Direct invocation of 'setup.py build' is not recommended." + "Please use 'pip' to build and install this package, like so:\n" + " pip install . (for the current directory)\n" + " pip install -e . (for an editable install)\n" + " pip wheel . (to build a wheel)" + ) + import os import re import codecs From a2a3d3e7d4f4e73cd531dcf38b99b5b3711a6208 Mon Sep 17 00:00:00 2001 From: Harsha Nori Date: Tue, 7 May 2024 00:00:22 -0700 Subject: [PATCH 2/3] black setup.py --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 3e7fac5e2..77432e6fe 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ # Check if 'setup.py' is run directly with 'build' # TODO: Consider generalizing this check further? if __name__ == "__main__": - if len(sys.argv) >= 2 and sys.argv[1] == 'build': + if len(sys.argv) >= 2 and sys.argv[1] == "build": raise SystemExit( "Error: Direct invocation of 'setup.py build' is not recommended." "Please use 'pip' to build and install this package, like so:\n" @@ -11,7 +11,7 @@ " pip install -e . (for an editable install)\n" " pip wheel . (to build a wheel)" ) - + import os import re import codecs From b6d44b3d69161ac5eb53528b8d4a558fb0abfe2c Mon Sep 17 00:00:00 2001 From: Harsha Nori Date: Tue, 7 May 2024 00:11:21 -0700 Subject: [PATCH 3/3] Prevent wheel creation command from creating wheels of all dependencies --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 77432e6fe..7e3edf224 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ "Please use 'pip' to build and install this package, like so:\n" " pip install . (for the current directory)\n" " pip install -e . (for an editable install)\n" - " pip wheel . (to build a wheel)" + " pip wheel . --no-deps (to build a wheel)" ) import os