Update setup.py Handle Spacy installation

This commit is contained in:
UncleCode
2024-05-17 22:11:00 +08:00
committed by GitHub
parent 57e5decb55
commit bc27982992

View File

@@ -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',