From 48fc1120f2047d386eebafaf3d671fe6e84d5714 Mon Sep 17 00:00:00 2001 From: akashd11 Date: Wed, 8 May 2024 16:11:10 +0530 Subject: [PATCH] moved the requirements for python from setup.py to requirements.txt --- python/requirements.txt | 8 ++++++++ python/setup.py | 27 +++++++++++++++++---------- 2 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 python/requirements.txt diff --git a/python/requirements.txt b/python/requirements.txt new file mode 100644 index 00000000..0463b114 --- /dev/null +++ b/python/requirements.txt @@ -0,0 +1,8 @@ +numpy +pandas>=1.1.4 +psutil +pyarrow>=4.0.1 +ray>=2.1.0 +pyspark>=3.1.1,<=3.5.0 +netifaces +protobuf>3.19.5,<=3.20.3 \ No newline at end of file diff --git a/python/setup.py b/python/setup.py index b5231785..6a2b03c7 100644 --- a/python/setup.py +++ b/python/setup.py @@ -94,16 +94,23 @@ def run(self): copy2(jar_path, JARS_TARGET) copy2(SCRIPT_PATH, SCRIPT_TARGET) - install_requires = [ - "numpy", - "pandas >= 1.1.4", - "psutil", - "pyarrow >= 4.0.1", - "ray >= 2.1.0", - "pyspark >= 3.1.1, <= 3.5.0", - "netifaces", - "protobuf > 3.19.5, <= 3.20.3" - ] + _here = os.path.abspath(os.path.dirname(__file__)) + with open('requirements.txt') as f: + required = f.read().splitlines() + + python_2 = sys.version_info[0] == 2 + + def read(file_name): + with open(file_name, 'rU' if python_2 else 'r') as file_handler: + return file_handler.read() + + + def read_reqs(file_name): + req_path = os.path.join(_here, file_name) + return [req.strip() for req in read(req_path).splitlines() if req.strip()] + + + install_requires = read_reqs('requirements.txt') _packages = find_packages() _packages.append("raydp.jars")