From cc18a8f987f9f7b604074b170bc188a02900469c Mon Sep 17 00:00:00 2001 From: parkervg Date: Wed, 7 Feb 2024 11:56:42 -0500 Subject: [PATCH] Adding setup.py --- .gitignore | 1 + blend | 1 - blendsql/{blend-cli.py => blend_cli.py} | 7 ++- blendsql/db/sqlite_db_connector.py | 1 + requirements.txt | 32 ----------- setup.py | 70 +++++++++++++++++++++++++ 6 files changed, 75 insertions(+), 37 deletions(-) delete mode 100755 blend rename blendsql/{blend-cli.py => blend_cli.py} (93%) delete mode 100644 requirements.txt create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 15ee0cb8..216a49b1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +proxies.py outputs/ research/db/ *.crt diff --git a/blend b/blend deleted file mode 100755 index d564973b..00000000 --- a/blend +++ /dev/null @@ -1 +0,0 @@ -python -m blendsql.blend-cli $1 --secrets_path=$2 \ No newline at end of file diff --git a/blendsql/blend-cli.py b/blendsql/blend_cli.py similarity index 93% rename from blendsql/blend-cli.py rename to blendsql/blend_cli.py index 6a8472db..0add8787 100644 --- a/blendsql/blend-cli.py +++ b/blendsql/blend_cli.py @@ -26,10 +26,10 @@ def cls(): os.system("cls" if os.name == "nt" else "clear") -if __name__ == "__main__": +def main(): parser = argparse.ArgumentParser() parser.add_argument("db_path", nargs="?") - parser.add_argument("--secrets_path", default="./secrets.json") + parser.add_argument("secrets_path", nargs="?", default="./secrets.json") args = parser.parse_args() init_secrets(args.secrets_path) @@ -56,7 +56,7 @@ def cls(): ingredients={LLMQA, LLMMap, LLMJoin, DT}, overwrite_args={"endpoint": "gpt-4", "long_answer": False}, infer_map_constraints=True, - verbose=True + verbose=True, ) print() print( @@ -70,4 +70,3 @@ def cls(): print() except Exception as error: print(error) - pass diff --git a/blendsql/db/sqlite_db_connector.py b/blendsql/db/sqlite_db_connector.py index d3ad5f38..01b0217d 100644 --- a/blendsql/db/sqlite_db_connector.py +++ b/blendsql/db/sqlite_db_connector.py @@ -167,4 +167,5 @@ def _create_clause(con, tablename) -> str: logging.debug( f"Expected create_clause size to be 1, got {create_clause.size}\n{create_clause}" ) + return "" return create_clause.values[0][0] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index de287272..00000000 --- a/requirements.txt +++ /dev/null @@ -1,32 +0,0 @@ -pre-commit -attrs -tqdm -dateparser -colorama -sql-metadata -openai==0.28.0 -tiktoken -guidance==0.0.64 -pyparsing==3.1.1 -fiscalyear -pandas -sqlglot -tabulate -pytest -typeguard -rapidfuzz -records -SQLAlchemy -recognizers-text -recognizers-text-suite -emoji==1.7.0 -azure-identity -transformers -nbformat -datasets==2.16.1 -nltk -sentence-transformers -wikiextractor - -rouge_score -git+https://github.com/google-research/bleurt.git \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..1425072b --- /dev/null +++ b/setup.py @@ -0,0 +1,70 @@ +import os +import re +import codecs +from setuptools import setup, find_packages + +here = os.path.abspath(os.path.dirname(__file__)) + + +def read(*parts): + with codecs.open(os.path.join(here, *parts), "r") as fp: + return fp.read() + + +def find_version(*file_paths): + version_file = read(*file_paths) + version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M) + if version_match: + return version_match.group(1) + raise RuntimeError("Unable to find version string.") + + +setup( + entry_points={ + "console_scripts": ["blendsql=blendsql.blend_cli:main"], + }, + name="blendsql", + version=find_version("blendsql", "__init__.py"), + url="https://github.com/parkervg/blendsql", + author="Parker Glenn", + author_email="parkervg5@gmail.com", + description="A scalable SQL dialect for problem decomposition and heterogenous question-answering with LLMs.", + license="Apache License 2.0", + packages=find_packages(exclude=["examples", "research", "img"]), + install_requires=[ + "openai==0.28.0", + "guidance==0.0.64", + "pyparsing==3.1.1", + "pandas>=2.0.0", + "bottleneck>=1.3.6", + "sqlglot", + "pre-commit", + "attrs", + "tqdm", + "dateparser", + "colorama", + "fiscalyear", + "tabulate", + "typeguard", + "azure-identity", + "nbformat", + ], + extras_require={ + "research": [ + "datasets==2.16.1", + "nltk", + "wikiextractor", + "rouge_score", + "rapidfuzz", + "records", + "SQLAlchemy", + "recognizers-text", + "recognizers-text-suite", + "emoji==1.7.0", + "transformers", + ], + "test": [ + "pytest", + ], + }, +)