Skip to content

Commit

Permalink
Merge pull request #805 from guidance-ai/setup
Browse files Browse the repository at this point in the history
Add guard for running build from setup.py, redirecting users to pip
  • Loading branch information
Harsha-Nori authored May 7, 2024
2 parents 87f9cf6 + b6d44b3 commit b2522fd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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 . --no-deps (to build a wheel)"
)

import os
import re
import codecs
Expand Down

0 comments on commit b2522fd

Please sign in to comment.