Push async version last changes for merge to main branch
This commit is contained in:
31
setup.py
31
setup.py
@@ -2,6 +2,7 @@ from setuptools import setup, find_packages
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
# Create the .crawl4ai folder in the user's home directory if it doesn't exist
|
||||
# If the folder already exists, remove the cache folder
|
||||
@@ -17,15 +18,34 @@ cache_folder.mkdir(exist_ok=True)
|
||||
# Read the requirements from requirements.txt
|
||||
with open("requirements.txt") as f:
|
||||
requirements = f.read().splitlines()
|
||||
|
||||
# Read version from __init__.py
|
||||
with open("crawl4ai/__init__.py") as f:
|
||||
for line in f:
|
||||
if line.startswith("__version__"):
|
||||
version = line.split("=")[1].strip().strip('"')
|
||||
break
|
||||
|
||||
# Define the requirements for different environments
|
||||
default_requirements = [req for req in requirements if not req.startswith(("torch", "transformers", "onnxruntime", "nltk", "spacy", "tokenizers", "scikit-learn"))]
|
||||
default_requirements = [req for req in requirements if not req.startswith(("torch", "transformers", "onnxruntime", "nltk", "spacy", "tokenizers", "scikit-learn", "selenium"))]
|
||||
torch_requirements = [req for req in requirements if req.startswith(("torch", "nltk", "spacy", "scikit-learn", "numpy"))]
|
||||
transformer_requirements = [req for req in requirements if req.startswith(("transformers", "tokenizers", "onnxruntime"))]
|
||||
sync_requirements = ["selenium"]
|
||||
cosine_similarity_requirements = ["torch", "transformers", "nltk", "spacy"]
|
||||
|
||||
def post_install():
|
||||
print("Running post-installation setup...")
|
||||
try:
|
||||
subprocess.check_call(["playwright", "install"])
|
||||
print("Playwright installation completed successfully.")
|
||||
except subprocess.CalledProcessError:
|
||||
print("Error during Playwright installation. Please run 'playwright install' manually.")
|
||||
except FileNotFoundError:
|
||||
print("Playwright not found. Please ensure it's installed and run 'playwright install' manually.")
|
||||
|
||||
setup(
|
||||
name="Crawl4AI",
|
||||
version="0.2.77",
|
||||
version=version,
|
||||
description="🔥🕷️ Crawl4AI: Open-source LLM Friendly Web Crawler & scraper",
|
||||
long_description=open("README.md", encoding="utf-8").read(),
|
||||
long_description_content_type="text/markdown",
|
||||
@@ -38,7 +58,9 @@ setup(
|
||||
extras_require={
|
||||
"torch": torch_requirements,
|
||||
"transformer": transformer_requirements,
|
||||
"all": requirements,
|
||||
"sync": sync_requirements,
|
||||
"cosine": cosine_similarity_requirements,
|
||||
"all": requirements + sync_requirements + cosine_similarity_requirements,
|
||||
},
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
@@ -56,4 +78,7 @@ setup(
|
||||
"Programming Language :: Python :: 3.10",
|
||||
],
|
||||
python_requires=">=3.7",
|
||||
cmdclass={
|
||||
'install': post_install,
|
||||
},
|
||||
)
|
||||
Reference in New Issue
Block a user