diff --git a/libs/langchain_v1/langchain/__init__.py b/libs/langchain_v1/langchain/__init__.py index aed449fe941..df0f092f838 100644 --- a/libs/langchain_v1/langchain/__init__.py +++ b/libs/langchain_v1/langchain/__init__.py @@ -1,18 +1,15 @@ -"""Main entrypoint into package.""" +"""Main entrypoint into LangChain.""" -from importlib import metadata from typing import Any -try: - __version__ = metadata.version(__package__) -except metadata.PackageNotFoundError: - # Case where package metadata is not available. - __version__ = "" -del metadata # optional, avoids polluting the results of dir(__package__) +__version__ = "1.0.0a1" def __getattr__(name: str) -> Any: # noqa: ANN401 - """Get an attribute from the package.""" + """Get an attribute from the package. + + TODO: will be removed in a future alpha version. + """ if name == "verbose": from langchain.globals import _verbose diff --git a/libs/langchain_v1/langchain/globals.py b/libs/langchain_v1/langchain/globals.py new file mode 100644 index 00000000000..ee1c0a90cde --- /dev/null +++ b/libs/langchain_v1/langchain/globals.py @@ -0,0 +1,18 @@ +"""Global values and configuration that apply to all of LangChain. + +TODO: will be removed in a future alpha version. +""" + +from typing import TYPE_CHECKING, Optional + +if TYPE_CHECKING: + from langchain_core.caches import BaseCache + + +# DO NOT USE THESE VALUES DIRECTLY! +# Use them only via `get_()` and `set_()` below, +# or else your code may behave unexpectedly with other uses of these global settings: +# https://github.com/langchain-ai/langchain/pull/11311#issuecomment-1743780004 +_verbose: bool = False +_debug: bool = False +_llm_cache: Optional["BaseCache"] = None diff --git a/libs/langchain_v1/pyproject.toml b/libs/langchain_v1/pyproject.toml index f471a309b5c..52ddc718f86 100644 --- a/libs/langchain_v1/pyproject.toml +++ b/libs/langchain_v1/pyproject.toml @@ -12,13 +12,16 @@ dependencies = [ "langgraph>=0.6.0", "pydantic>=2.7.4", ] - +dynamic = ["version"] name = "langchain" -version = "1.0.0dev1" description = "Building applications with LLMs through composability" readme = "README.md" +[tool.pdm.version] +source = "file" +path = "langchain/__init__.py" + [project.optional-dependencies] # community = ["langchain-community"] anthropic = ["langchain-anthropic"]