[build-system]
requires = ["poetry-core", "setuptools", "wheel"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "r2r"
readme = "README.md"
version = "3.3.18"

description = "SciPhi R2R"
authors = ["Owen Colegrove <owen@sciphi.ai>"]
license = "MIT"
include = [
    "r2r.toml",
    "compose.yaml",
    "compose.full.yaml",
    "compose.full_with_replicas.yaml",
    "pyproject.toml",
    "migrations/**/*"
]
packages = [
    { include = "r2r" },
    { include = "sdk", from = "." },
    { include = "shared", from = "." },
    { include = "core", from = "." },
    { include = "cli", from = "." },
]

[tool.poetry.dependencies]
# Python Versions
python = ">=3.10,<3.13"

alembic = "^1.13.3"
asyncclick = "^8.1.7.2"
click = "^8.0.0"
fastapi = "^0.114.0"
httpx = "^0.27.0"
litellm = "^1.52.8" # move back to optional after zerox integration is complete
nest-asyncio = "^1.6.0"
openai =  "^1.11.1"
posthog = "^3.5.0"
python-dotenv = "^1.0.1"
requests = "^2.31.0"
toml = "^0.10.2"
types-requests = "^2.31.0"
unstructured-client = "0.25.5"
psycopg-binary = "^3.2.3"
aiosmtplib = "^3.0.2"
types-aiofiles = "^24.1.0.20240626"
aiohttp = "^3.10.10"
typing-extensions = "^4.12.2"

# Shared dependencies (optional)
aiosqlite = { version = "^0.20.0", optional = true }
apscheduler = { version = "^3.10.4", optional = true }
asyncpg = { version = "^0.29.0", optional = true }
bcrypt = { version = "^4.1.3", optional = true }
boto3 = { version = "^1.35.17", optional = true } # for AWS bedrock support
colorlog = { version = "^6.9.0", optional = true }
deepdiff = { version = "^7.0.1", optional = true }
fire = { version = "^0.5.0", optional = true }
fsspec = { version = "^2024.6.0", optional = true }
future = { version = "^1.0.0", optional = true }
graspologic = { version = "^3.4.1", optional = true }
gunicorn = { version = "^21.2.0", optional = true }
hatchet-sdk = { version = "^0.38.0", optional = true }
networkx = { version = "^3.3", optional = true }
ollama = { version = "^0.3.1", optional = true }
passlib = { version = "^1.7.4", optional = true }
psutil = { version = "^6.0.0", optional = true }
python-multipart = { version = "^0.0.9", optional = true }
pydantic = { extras = ["email"], version = "^2.8.2", optional = true }
pyjwt = { version = "^2.8.0", optional = true }
pyyaml = { version = "^6.0.1", optional = true }
sendgrid = { version = "^6.11.0", optional = true }
sqlalchemy = { version = "^2.0.30", optional = true }
supabase = { version = "^2.7.4", optional = true }
tokenizers = { version = "0.19", optional = true }
uvicorn = { version = "^0.27.0.post1", optional = true }
vecs = { version = "^0.4.0", optional = true }

# R2R Ingestion
aiofiles = { version = "^24.1.0", optional = true }
aioshutil = { version = "^1.5", optional = true }
beautifulsoup4 = { version = "^4.12.3", optional = true }
bs4 = { version = "^0.0.2", optional = true }
epub = { version = "^0.5.2", optional = true }
extract-msg = { version = "^0.52.0", optional = true }
markdown = { version = "^3.6", optional = true }
numpy = { version = ">=1.22.4,<1.29.0", optional = true }
olefile = { version = "^0.47", optional = true }
openpyxl = { version = "^3.1.2", optional = true }
orgparse = { version = "^0.4.20231004", optional = true }
pdf2image = { version = "^1.17.0", optional = true }
pillow-heif = { version = "^0.21.0", optional = true }
pypdf = { version = "^4.2.0", optional = true }
pypdf2 = { version = "^3.0.1", optional = true }
python-pptx = { version = "^1.0.1", optional = true }
python-docx = { version = "^1.1.0", optional = true }
docutils = { version = "^0.21.2", optional = true }
striprtf = { version = "^0.0.28", optional = true }
xlrd = { version = "^2.0.1", optional = true }
pynacl = { version = "^1.5.0", optional = true }

[tool.poetry.extras]
core = [
    "aiosqlite",
    "apscheduler",
    "asyncpg",
    "bcrypt",
    "boto3",
    "colorlog",
    "deepdiff",
    "fire",
    "fsspec",
    "future",
    "graspologic",
    "gunicorn",
    "hatchet-sdk",
    "networkx",
    "ollama",
    "passlib",
    "psutil",
    "pydantic",
    "pyjwt",
    "pyyaml",
    "sendgrid",
    "sqlalchemy",
    "supabase",
    "tokenizers",
    "unstructured-client",
    "uvicorn",
    "vecs",
    "python-multipart",
    "pynacl"
]
ingestion-bundle = [
    "aiofiles",
    "aioshutil",
    "beautifulsoup4",
    "bs4",
    "numpy",
    "docutils",
    "epub",
    "extract-msg",
    "markdown",
    "numpy",
    "olefile",
    "openpyxl",
    "orgparse",
    "pdf2image",
    "pillow-heif",
    "pypdf",
    "pypdf2",
    "python-pptx",
    "python-docx",
    "striprtf",
    "xlrd",
]

[tool.poetry.group.dev.dependencies]
black = "^24.3.0"
colorama = "^0.4.6"
isort = "5.12.0"
mypy = "^1.5.1"
pre-commit = "^2.9"
pytest = "^8.2.0"
pytest-asyncio = "^0.23.6"
pytest-dependency = "^0.6.0"
pytest-mock = "^3.14.0"
pytest-cov = "^5.0.0"
pytest-html = "^4.1.1"
types-toml = "^0.10.8"
pytest-xdist = "^3.6.1"

[tool.black]
line-length = 79
target-version = ['py39']
include = '\.pyi?$'
extend-exclude = '''
/(
  # directories
  \.eggs
  | \.git
  | \.hg
  | \.mypy_cache
  | \.tox
  | \.venv
  | build
  | dist
)/
'''

[tool.isort]
line_length = 79
profile = "black"

[tool.mypy]
ignore_missing_imports = true
exclude = 'core/parsers/media/pyzerox/.*|playground/.*|deprecated/.*|dump/.*|docs/source|vecs/*|core/examples/*|sdk/examples/*|cli/examples/*|tests/*'

[[tool.mypy.overrides]]
module = "yaml"
ignore_missing_imports = true

[tool.poetry.scripts]
r2r = "cli.main:main"

[tool.pytest.ini_options]
asyncio_mode = "auto"
addopts = "--cov=r2r --cov-report=term-missing --cov-report=xml --cache-clear"
testpaths = [
    "tests",
]
filterwarnings = [
    "ignore::DeprecationWarning",
    "ignore::pytest.PytestUnraisableExceptionWarning",
]
