[build-system]
requires = ["setuptools>=77.0.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "abstractvision"
dynamic = ["version"]
description = "Model-agnostic generative vision abstractions (image/video) for the Abstract ecosystem"
readme = "README.md"
license = "MIT"
license-files = ["LICENSE"]
authors = [{name = "Laurent-Philippe Albou", email = "contact@abstractcore.ai"}]
requires-python = ">=3.9"
classifiers = [
  "Development Status :: 3 - Alpha",
  "Intended Audience :: Developers",
  "Operating System :: OS Independent",
  "Programming Language :: Python :: 3",
  "Programming Language :: Python :: 3.9",
  "Programming Language :: Python :: 3.10",
  "Programming Language :: Python :: 3.11",
  "Programming Language :: Python :: 3.12",
  "Programming Language :: Python :: 3.13",
  "Topic :: Multimedia",
  "Topic :: Scientific/Engineering :: Artificial Intelligence",
]
# Base install is intentionally lightweight. Local inference runtimes are
# explicit extras so OpenAI-compatible/AbstractCore plugin hosts do not pull
# Torch, Diffusers, CUDA-adjacent wheels, or local model stacks by default.
dependencies = []

[project.urls]
Homepage = "https://github.com/lpalbou/abstractvision"
Repository = "https://github.com/lpalbou/abstractvision"

[project.scripts]
abstractvision = "abstractvision.cli:main"

[project.entry-points."abstractcore.capabilities_plugins"]
abstractvision = "abstractvision.integrations.abstractcore_plugin:register"

[project.optional-dependencies]
# Official OpenAI image endpoint intent. The backend is stdlib-only today and
# does not require the OpenAI SDK.
openai = []

# Generic OpenAI-shaped HTTP endpoint intent (local or remote /v1 servers).
# The backend is stdlib-only today; keep this extra for readable install commands.
openai-compatible = []

# Local image generation via Hugging Face Diffusers/Torch.
diffusers = [
  "diffusers>=0.36.0",
  "torch>=2.0,<3.0.0",
  "torchvision>=0.15.0",
  "transformers>=4.0,<6.0.0",
  "accelerate>=0.0",
  "safetensors>=0.0",
  "huggingface_hub>=0.24.0",
  # Needed by T5 tokenizers used in SD3/FLUX and some other diffusion pipelines.
  "sentencepiece>=0.1.99",
  # Some HF tokenizers/pipelines require protobuf at runtime.
  "protobuf>=3.20.0",
  # Used by some modern diffusion architectures.
  "einops>=0.7.0",
  # LoRA adapter support in Diffusers.
  "peft>=0.10.0",
  # GGUF transformer loading in Diffusers.
  "gguf>=0.10.0",
  "Pillow>=9.0",
]

# Local generation via stable-diffusion.cpp python bindings (pip-installable).
sdcpp = [
  "stable-diffusion-cpp-python>=0.4.2,<0.4.6",
  "huggingface_hub>=0.24.0",
  "Pillow>=9.0",
]

# Native Apple image generation via MLX-Gen. Kept optional because it pulls
# Apple-specific local runtime dependencies.
mlx-gen = [
  "mlx-gen>=0.18.18,<0.19.0; (platform_system == 'Darwin' or platform_system == 'Linux') and python_version >= '3.10'",
]

# Compatibility extra for callers that still install the historical MFLUX extra.
# It intentionally installs MLX-Gen, not the retired standalone mflux package.
mflux = [
  "mlx-gen>=0.18.18,<0.19.0; (platform_system == 'Darwin' or platform_system == 'Linux') and python_version >= '3.10'",
]

# Native Apple Python install profile. Docker cannot expose Apple's Metal stack,
# but direct macOS installs can use PyTorch/MPS, stable-diffusion.cpp/Metal, and MLX-Gen/MLX.
apple = [
  "diffusers>=0.36.0",
  "torch>=2.0,<3.0.0",
  "torchvision>=0.15.0",
  "transformers>=4.0,<6.0.0",
  "accelerate>=0.0",
  "safetensors>=0.0",
  "huggingface_hub>=0.24.0",
  "sentencepiece>=0.1.99",
  "protobuf>=3.20.0",
  "einops>=0.7.0",
  "peft>=0.10.0",
  "gguf>=0.10.0",
  "stable-diffusion-cpp-python>=0.4.2,<0.4.6",
  "mlx-gen>=0.18.18,<0.19.0; (platform_system == 'Darwin' or platform_system == 'Linux') and python_version >= '3.10'",
  "Pillow>=9.0",
]

gpu = [
  "diffusers>=0.36.0",
  "torch>=2.0,<3.0.0",
  "torchvision>=0.15.0",
  "transformers>=4.0,<6.0.0",
  "accelerate>=0.0",
  "safetensors>=0.0",
  "huggingface_hub>=0.24.0",
  "sentencepiece>=0.1.99",
  "protobuf>=3.20.0",
  "einops>=0.7.0",
  "peft>=0.10.0",
  "gguf>=0.10.0",
  "mlx-gen>=0.18.18,<0.19.0; (platform_system == 'Darwin' or platform_system == 'Linux') and python_version >= '3.10'",
  "Pillow>=9.0",
]

# Compatibility extra for callers that still request the historical Diffusers extra.
huggingface = [
  "diffusers>=0.36.0",
  "torch>=2.0,<3.0.0",
  "torchvision>=0.15.0",
  "transformers>=4.0,<6.0.0",
  "accelerate>=0.0",
  "safetensors>=0.0",
  "huggingface_hub>=0.24.0",
  "sentencepiece>=0.1.99",
  "protobuf>=3.20.0",
  "einops>=0.7.0",
  "peft>=0.10.0",
  "gguf>=0.10.0",
  "Pillow>=9.0",
]

# Convenience: installs both local backends (Diffusers + stable-diffusion.cpp python bindings).
local = [
  "diffusers>=0.36.0",
  "torch>=2.0,<3.0.0",
  "torchvision>=0.15.0",
  "transformers>=4.0,<6.0.0",
  "accelerate>=0.0",
  "safetensors>=0.0",
  "huggingface_hub>=0.24.0",
  "sentencepiece>=0.1.99",
  "protobuf>=3.20.0",
  "einops>=0.7.0",
  "peft>=0.10.0",
  "gguf>=0.10.0",
  "stable-diffusion-cpp-python>=0.4.2,<0.4.6",
  "Pillow>=9.0",
]

# Convenience: installs every runtime backend, but not contributor tooling.
all = [
  "diffusers>=0.36.0",
  "torch>=2.0,<3.0.0",
  "torchvision>=0.15.0",
  "transformers>=4.0,<6.0.0",
  "accelerate>=0.0",
  "safetensors>=0.0",
  "huggingface_hub>=0.24.0",
  "sentencepiece>=0.1.99",
  "protobuf>=3.20.0",
  "einops>=0.7.0",
  "peft>=0.10.0",
  "gguf>=0.10.0",
  "stable-diffusion-cpp-python>=0.4.2,<0.4.6",
  "mlx-gen>=0.18.18,<0.19.0; (platform_system == 'Darwin' or platform_system == 'Linux') and python_version >= '3.10'",
  "Pillow>=9.0",
]

# Full native Apple profile: every runtime backend relevant to macOS/Apple
# Silicon, excluding NVIDIA/CUDA-specific stacks.
all-apple = [
  "diffusers>=0.36.0",
  "torch>=2.0,<3.0.0",
  "torchvision>=0.15.0",
  "transformers>=4.0,<6.0.0",
  "accelerate>=0.0",
  "safetensors>=0.0",
  "huggingface_hub>=0.24.0",
  "sentencepiece>=0.1.99",
  "protobuf>=3.20.0",
  "einops>=0.7.0",
  "peft>=0.10.0",
  "gguf>=0.10.0",
  "stable-diffusion-cpp-python>=0.4.2,<0.4.6",
  "mlx-gen>=0.18.18,<0.19.0; (platform_system == 'Darwin' or platform_system == 'Linux') and python_version >= '3.10'",
  "Pillow>=9.0",
]

all-gpu = [
  "diffusers>=0.36.0",
  "torch>=2.0,<3.0.0",
  "torchvision>=0.15.0",
  "transformers>=4.0,<6.0.0",
  "accelerate>=0.0",
  "safetensors>=0.0",
  "huggingface_hub>=0.24.0",
  "sentencepiece>=0.1.99",
  "protobuf>=3.20.0",
  "einops>=0.7.0",
  "peft>=0.10.0",
  "gguf>=0.10.0",
  "stable-diffusion-cpp-python>=0.4.2,<0.4.6",
  "mlx-gen>=0.18.18,<0.19.0; (platform_system == 'Darwin' or platform_system == 'Linux') and python_version >= '3.10'",
  "Pillow>=9.0",
]

# NOTE: PyPI rejects VCS/direct URL dependencies in package metadata.
# If you need Diffusers "main" for unreleased pipelines, install it explicitly *after*:
#   pip install "abstractvision[diffusers-dev]"
#   pip install "diffusers @ git+https://github.com/huggingface/diffusers@main"
diffusers-dev = [
  "diffusers>=0.36.0",
  "torch>=2.0,<3.0.0",
  "torchvision>=0.15.0",
  "transformers>=5.0",
  "accelerate>=0.0",
  "safetensors>=0.0",
  "huggingface_hub>=0.24.0",
  "sentencepiece>=0.1.99",
  "protobuf>=3.20.0",
  "einops>=0.7.0",
  "peft>=0.10.0",
  "gguf>=0.10.0",
  "Pillow>=9.0",
]

# Compatibility extra for callers that still request the historical dev extra.
huggingface-dev = [
  "diffusers>=0.36.0",
  "torch>=2.0,<3.0.0",
  "torchvision>=0.15.0",
  "transformers>=5.0",
  "accelerate>=0.0",
  "safetensors>=0.0",
  "huggingface_hub>=0.24.0",
  "sentencepiece>=0.1.99",
  "protobuf>=3.20.0",
  "einops>=0.7.0",
  "peft>=0.10.0",
  "gguf>=0.10.0",
  "Pillow>=9.0",
]

# Compatibility extra only. AbstractVision is loaded by AbstractCore as a plugin,
# so it deliberately does not install AbstractCore as a dependency.
abstractcore = []

# Local model download helpers. Kept optional so the base package remains
# dependency-free for OpenAI-compatible proxy hosts.
models = [
  "huggingface_hub>=0.24.0",
]

# Test dependencies used by local contributors. CI installs the package with
# `--no-deps` and then adds only these light test-time dependencies.
test = [
  "pytest>=7.0.0",
  "Pillow>=9.0",
  "torch>=2.0,<3.0.0",
]

# Documentation dependencies.
docs = [
  "mkdocs>=1.5.0",
  "mkdocs-material>=9.0.0",
]

# Complete local development environment.
dev = [
  "pytest>=7.0.0",
  "Pillow>=9.0",
  "torch>=2.0,<3.0.0",
  "diffusers>=0.36.0",
  "torchvision>=0.15.0",
  "transformers>=4.0,<6.0.0",
  "accelerate>=0.0",
  "safetensors>=0.0",
  "sentencepiece>=0.1.99",
  "protobuf>=3.20.0",
  "einops>=0.7.0",
  "peft>=0.10.0",
  "mkdocs>=1.5.0",
  "mkdocs-material>=9.0.0",
  "build>=1.0.0",
  "twine>=4.0.0",
  "ruff>=0.5.7",
  "black>=23.0.0",
  "pre-commit>=3.0.0",
]

[tool.setuptools]
packages = [
  "abstractvision",
  "abstractvision.assets",
  "abstractvision.backends",
  "abstractvision.integrations",
  "abstractvision.playground",
]

[tool.setuptools.package-dir]
"" = "src"

[tool.setuptools.dynamic]
version = {attr = "abstractvision.__version__"}

[tool.setuptools.package-data]
abstractvision = ["assets/*.json", "assets/*.metal", "playground/*.html"]

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

[tool.isort]
profile = "black"
multi_line_output = 3
line_length = 100
known_first_party = ["abstractvision"]

[tool.ruff]
target-version = "py39"
line-length = 100

[tool.ruff.lint]
select = [
  "E",
  "W",
  "F",
  "I",
  "B",
  "C4",
  "UP",
]
ignore = [
  "E501",
  "B008",
  "B904",
]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
"tests/**/*" = ["B011"]

[tool.pytest.ini_options]
pythonpath = ["src"]
minversion = "7.0"
addopts = "-ra --tb=short --strict-markers --strict-config --disable-warnings -p no:cacheprovider"
testpaths = ["tests"]
python_files = ["test_*.py"]
python_functions = ["test_*"]
python_classes = ["Test*"]
