From 78b6ba5cef561c4fba0427840dfc51c6f4790b81 Mon Sep 17 00:00:00 2001 From: UncleCode Date: Wed, 1 Jan 2025 15:45:27 +0800 Subject: [PATCH] build: modernize package configuration with pyproject.toml - Add pyproject.toml for PEP 517 build system support - Configure dependencies, scripts, and metadata in pyproject.toml - Set Python requirement to >=3.9 and add support up to 3.13 - Keep setup.py for backwards compatibility - Move package dependencies and entry points to pyproject.toml --- pyproject.toml | 43 +++++++++++++++++++++++++++++++++++++++++++ setup.py | 2 ++ 2 files changed, 45 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index a00d0025..aae932a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,6 +12,29 @@ license = {text = "MIT"} authors = [ {name = "Unclecode", email = "unclecode@kidocode.com"} ] +dependencies = [ + "aiosqlite~=0.20", + "lxml~=5.3", + "litellm>=1.53.1", + "numpy>=1.26.0,<3", + "pillow~=10.4", + "playwright>=1.49.0", + "python-dotenv~=1.0", + "requests~=2.26", + "beautifulsoup4~=4.12", + "tf-playwright-stealth>=1.1.0", + "xxhash~=3.4", + "rank-bm25~=0.2", + "aiofiles>=24.1.0", + "colorama~=0.4", + "snowballstemmer~=2.2", + "pydantic>=2.10", + "pyOpenSSL>=24.3.0", + "psutil>=6.1.1", + "nltk>=3.9.1", + "playwright", + "aiofiles" +] classifiers = [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -24,6 +47,26 @@ classifiers = [ "Programming Language :: Python :: 3.13", ] +[project.optional-dependencies] +torch = ["torch", "nltk", "scikit-learn"] +transformer = ["transformers", "tokenizers"] +cosine = ["torch", "transformers", "nltk"] +sync = ["selenium"] +all = [ + "torch", + "nltk", + "scikit-learn", + "transformers", + "tokenizers", + "selenium" +] + +[project.scripts] +crawl4ai-download-models = "crawl4ai.model_loader:main" +crawl4ai-migrate = "crawl4ai.migrations:main" +crawl4ai-setup = "crawl4ai.install:post_install" +crawl = "crawl4ai.cli:cli" + [tool.setuptools] packages = ["crawl4ai"] package-data = {"crawl4ai" = ["js_snippet/*.js"]} diff --git a/setup.py b/setup.py index d258b182..7dd1363b 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,8 @@ import os from pathlib import Path import shutil +# Note: Most configuration is now in pyproject.toml +# This setup.py is kept for backwards compatibility # Create the .crawl4ai folder in the user's home directory if it doesn't exist # If the folder already exists, remove the cache folder