[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "langchain-classic"
description = "Building applications with LLMs through composability"
license = { text = "MIT" }
readme = "README.md"
classifiers = [
    "Development Status :: 5 - Production/Stable",
    "Intended Audience :: Developers",
    "License :: OSI Approved :: MIT License",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Topic :: Scientific/Engineering :: Artificial Intelligence",
    "Topic :: Software Development :: Libraries :: Python Modules",
]

version = "1.0.1"
requires-python = ">=3.10.0,<4.0.0"
dependencies = [
    "langchain-core>=1.2.5,<2.0.0",
    "langchain-text-splitters>=1.1.0,<2.0.0",
    "langsmith>=0.1.17,<1.0.0",
    "pydantic>=2.7.4,<3.0.0",
    "SQLAlchemy>=1.4.0,<3.0.0",
    "requests>=2.0.0,<3.0.0",
    "PyYAML>=5.3.0,<7.0.0",
    "async-timeout>=4.0.0,<5.0.0; python_version < \"3.11\"",
]

[project.optional-dependencies]
#community = ["langchain-community"]
anthropic = ["langchain-anthropic"]
openai = ["langchain-openai"]
#azure-ai = ["langchain-azure-ai"]
#cohere = ["langchain-cohere"]
google-vertexai = ["langchain-google-vertexai"]
google-genai = ["langchain-google-genai"]
fireworks = ["langchain-fireworks"]
ollama = ["langchain-ollama"]
together = ["langchain-together"]
mistralai = ["langchain-mistralai"]
huggingface = ["langchain-huggingface"]
groq = ["langchain-groq"]
aws = ["langchain-aws"]
deepseek = ["langchain-deepseek"]
xai = ["langchain-xai"]
perplexity = ["langchain-perplexity"]

[project.urls]
Homepage = "https://docs.langchain.com/"
Documentation = "https://reference.langchain.com/python/langchain_classic/"
Repository = "https://github.com/langchain-ai/langchain"
Issues = "https://github.com/langchain-ai/langchain/issues"
Changelog = "https://github.com/langchain-ai/langchain/releases?q=tag%3A%22langchain-classic%3D%3D1%22"
Twitter = "https://x.com/LangChain"
Slack = "https://www.langchain.com/join-community"
Reddit = "https://www.reddit.com/r/LangChain/"

[dependency-groups]
test = [
    "pytest>=8.0.0,<10.0.0",
    "pytest-cov>=4.0.0,<8.0.0",
    "pytest-dotenv>=0.5.2,<1.0.0",
    "pytest-watcher>=0.2.6,<1.0.0",
    "pytest-asyncio>=0.23.2,<2.0.0",
    "pytest-mock>=3.10.0,<4.0.0",
    "pytest-socket>=0.6.0,<1.0.0",
    "pytest-xdist<4.0.0,>=3.6.1",
    "numpy>=1.26.4; python_version<'3.13'",
    "numpy>=2.1.0; python_version>='3.13'",
    "cffi<1.17.1; python_version < \"3.10\"",
    "cffi; python_version >= \"3.10\"",
    "freezegun>=1.2.2,<2.0.0",
    "responses>=0.22.0,<1.0.0",
    "lark>=1.1.5,<2.0.0",
    "pandas>=2.0.0,<3.0.0",
    "syrupy>=4.0.2,<6.0.0",
    "requests-mock>=1.11.0,<2.0.0",
    "toml>=0.10.2,<1.0.0",
    "packaging>=24.2.0,<27.0.0",
    "langchain-tests",
    "langchain-core",
    "langchain-text-splitters",
    "langchain-openai",
]
test_integration = [
    "vcrpy>=8.0.0,<9.0.0",
    "wrapt>=1.15.0,<3.0.0",
    "python-dotenv>=1.0.0,<2.0.0",
    "cassio>=0.1.0,<1.0.0; python_version < '3.14'",
    "langchainhub>=0.1.16,<1.0.0",
    "langchain-core",
    "langchain-text-splitters",
]
lint = [
    "ruff>=0.15.0,<0.16.0",
    "cffi<1.17.1; python_version < \"3.10\"",
    "cffi; python_version >= \"3.10\"",
]
typing = [
    "mypy>=1.19.1,<1.20.0",
    "mypy-protobuf>=3.0.0,<6.0.0",
    "types-pyyaml>=6.0.12.2,<7.0.0.0",
    "types-requests>=2.28.11.5,<3.0.0.0",
    "types-toml>=0.10.8.1,<1.0.0.0",
    "types-redis>=4.3.21.6,<5.0.0.0",
    "types-pytz>=2023.3.0.0,<2026.0.0.0",
    "types-chardet>=5.0.4.6,<6.0.0.0",
    "numpy>=1.26.4; python_version < '3.13'",
    "numpy>=2.1.0; python_version >= '3.13'",
    "langchain-core",
    "langchain-text-splitters",
    "fastapi<1.0.0,>=0.116.1",
]
dev = [
    "jupyter>=1.0.0,<2.0.0",
    "playwright>=1.28.0,<2.0.0",
    "setuptools>=67.6.1,<83.0.0",
    "langchain-core",
    "langchain-text-splitters",
]


[tool.uv.sources]
langchain-core = { path = "../core", editable = true }
langchain-tests = { path = "../standard-tests", editable = true }
langchain-text-splitters = { path = "../text-splitters", editable = true }
langchain-openai = { path = "../partners/openai", editable = true }

[tool.uv]
constraint-dependencies = ["urllib3>=2.6.3"]

[tool.ruff]
exclude = ["tests/integration_tests/examples/non-utf8-encoding.py"]

[tool.mypy]
plugins = ["pydantic.mypy"]
strict = true
ignore_missing_imports = true
enable_error_code = "deprecated"
warn_unreachable = true

# TODO: activate for 'strict' checking
disallow_any_generics = false
warn_return_any = false

[tool.ruff.format]
docstring-code-format = true

[tool.ruff.lint]
select = [ "ALL",]
ignore = [
    "C90",     # McCabe complexity
    "COM812",  # Messes with the formatter
    "FIX002",  # Line contains TODO
    "PERF203", # Rarely useful
    "PLR09",   # Too many something (arg, statements, etc)
    "RUF012",  # Doesn't play well with Pydantic
    "TC001",   # Doesn't play well with Pydantic
    "TC002",   # Doesn't play well with Pydantic
    "TC003",   # Doesn't play well with Pydantic
    "TD002",   # Missing author in TODO
    "TD003",   # Missing issue link in TODO
    "RUF002",  # Em-dash in docstring

    # TODO rules
    "ANN401",  # No type Any
    "D100",    # pydocstyle: missing docstring in public module
    "PLC0415", # pylint: import-outside-top-level
    "TRY301",  # tryceratops: raise-within-try
]
unfixable = [
    "B028",    # People should intentionally tune the stacklevel
]

flake8-annotations.allow-star-arg-any = true
flake8-annotations.mypy-init-return = true
flake8-type-checking.runtime-evaluated-base-classes = ["pydantic.BaseModel","langchain_core.load.serializable.Serializable","langchain_core.runnables.base.RunnableSerializable"]
pep8-naming.classmethod-decorators = [ "classmethod", "langchain_core.utils.pre_init", "pydantic.field_validator", "pydantic.v1.root_validator",]
pyupgrade.keep-runtime-typing = true

[tool.ruff.lint.pydocstyle]
convention = "google"
ignore-var-parameters = true  # ignore missing documentation for *args and **kwargs parameters

[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"

[tool.ruff.lint.extend-per-file-ignores]
"tests/**/*.py" = [
    "D1",      # Docstrings not mandatory in tests
    "S101",    # Tests need assertions
    "S311",    # Standard pseudo-random generators are not suitable for cryptographic purposes
    "SLF001",  # Private member access in tests
    "PLR2004", # Magic value comparisons
]
"tests/integration_tests/examples/*.py" = [
    "INP001",   # Not a package
    "EXE001",   # Only examples
]
"scripts/*.py" = [
    "INP001",   # Not a package
]
"langchain_classic/chains/constitutional_ai/principles.py" = [
    "E501", # Line too long
]
"**/retrievers/*time_weighted_retriever.py" = [
    "DTZ001", # Use of non timezone-aware datetime
    "DTZ005", # Use of non timezone-aware datetime
    "DTZ006", # Use of non timezone-aware datetime
]
"**/__init__.py" = [
    "D104",    # Missing docstring in public package
]

[tool.coverage.run]
omit = ["tests/*"]

[tool.pytest.ini_options]
addopts = "--strict-markers --strict-config --durations=5 --snapshot-warn-unused -vv"
markers = [
    "requires: mark tests as requiring a specific library",
    "scheduled: mark tests to run in scheduled testing",
    "compile: mark placeholder test used to compile integration tests without running them",
]
asyncio_mode = "auto"
filterwarnings = [
    "ignore::langchain_core._api.beta_decorator.LangChainBetaWarning",
    "ignore::langchain_core._api.deprecation.LangChainDeprecationWarning:tests",
    "ignore::langchain_core._api.deprecation.LangChainPendingDeprecationWarning:tests",
]
