From bc2798299248edadf85a990f3dfea95a3fa4f368 Mon Sep 17 00:00:00 2001 From: UncleCode Date: Fri, 17 May 2024 22:11:00 +0800 Subject: [PATCH] Update setup.py Handle Spacy installation --- setup.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/setup.py b/setup.py index bfacedf6..5b230cad 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,7 @@ from setuptools import setup, find_packages +import os +import subprocess +from setuptools.command.install import install # Read the requirements from requirements.txt with open("requirements.txt") as f: @@ -10,6 +13,12 @@ requirements_without_transformers = [req for req in requirements if not req.star requirements_without_nltk = [req for req in requirements if not req.startswith("nltk")] requirements_without_torch_transformers_nlkt = [req for req in requirements if not req.startswith("torch") and not req.startswith("transformers") and not req.startswith("nltk")] +class CustomInstallCommand(install): + """Customized setuptools install command to install spacy without dependencies.""" + def run(self): + install.run(self) + subprocess.check_call([os.sys.executable, '-m', 'pip', 'install', 'spacy', '--no-deps']) + setup( name="Crawl4AI", version="0.2.0", @@ -27,6 +36,9 @@ setup( "colab": requirements_without_torch, # Exclude torch for Colab "crawl": requirements_without_torch_transformers_nlkt }, + cmdclass={ + 'install': CustomInstallCommand, + }, entry_points={ 'console_scripts': [ 'crawl4ai-download-models=crawl4ai.model_loader:main',