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
This commit is contained in:
UncleCode
2025-01-01 15:45:27 +08:00
parent 3f019d34cc
commit 78b6ba5cef
2 changed files with 45 additions and 0 deletions

View File

@@ -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"]}

View File

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