Skip to content

Commit 9863023

Browse files
authored
docs: more standardization (#33124)
1 parent a5137b0 commit 9863023

File tree

125 files changed

+890
-870
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+890
-870
lines changed

docs/api_reference/create_api_rst.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def _load_package_modules(
214214
Traversal based on the file system makes it easy to determine which
215215
of the modules/packages are part of the package vs. 3rd party or built-in.
216216
217-
Parameters:
217+
Args:
218218
package_directory: Path to the package directory.
219219
submodule: Optional name of submodule to load.
220220

libs/cli/pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,14 @@ flake8-annotations.allow-star-arg-any = true
7070
flake8-annotations.mypy-init-return = true
7171
flake8-type-checking.runtime-evaluated-base-classes = ["pydantic.BaseModel","langchain_core.load.serializable.Serializable","langchain_core.runnables.base.RunnableSerializable"]
7272
pep8-naming.classmethod-decorators = [ "classmethod", "langchain_core.utils.pydantic.pre_init", "pydantic.field_validator", "pydantic.v1.root_validator",]
73-
pydocstyle.convention = "google"
7473
pyupgrade.keep-runtime-typing = true
7574

75+
[tool.ruff.lint.pydocstyle]
76+
convention = "google"
77+
ignore-var-parameters = true # ignore missing documentation for *args and **kwargs parameters
78+
7679
[tool.ruff.lint.per-file-ignores]
77-
"tests/**" = [ "D1", "DOC", "S", "SLF",]
80+
"tests/**" = [ "D1", "S", "SLF",]
7881
"scripts/**" = [ "INP", "S",]
7982

8083
[tool.pytest.ini_options]

libs/cli/scripts/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

libs/core/langchain_core/_api/beta_decorator.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,17 +227,17 @@ def warn_beta(
227227
) -> None:
228228
"""Display a standardized beta annotation.
229229
230-
Arguments:
231-
message : str, optional
230+
Args:
231+
message:
232232
Override the default beta message. The
233233
%(name)s, %(obj_type)s, %(addendum)s
234234
format specifiers will be replaced by the
235235
values of the respective arguments passed to this function.
236-
name : str, optional
236+
name:
237237
The name of the annotated object.
238-
obj_type : str, optional
238+
obj_type:
239239
The object type being annotated.
240-
addendum : str, optional
240+
addendum:
241241
Additional text appended directly to the final message.
242242
"""
243243
if not message:

libs/core/langchain_core/_api/deprecation.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -431,35 +431,35 @@ def warn_deprecated(
431431
) -> None:
432432
"""Display a standardized deprecation.
433433
434-
Arguments:
435-
since : str
434+
Args:
435+
since:
436436
The release at which this API became deprecated.
437-
message : str, optional
437+
message:
438438
Override the default deprecation message. The %(since)s,
439439
%(name)s, %(alternative)s, %(obj_type)s, %(addendum)s,
440440
and %(removal)s format specifiers will be replaced by the
441441
values of the respective arguments passed to this function.
442-
name : str, optional
442+
name:
443443
The name of the deprecated object.
444-
alternative : str, optional
444+
alternative:
445445
An alternative API that the user may use in place of the
446446
deprecated API. The deprecation warning will tell the user
447447
about this alternative if provided.
448-
alternative_import: str, optional
448+
alternative_import:
449449
An alternative import that the user may use instead.
450-
pending : bool, optional
450+
pending:
451451
If True, uses a PendingDeprecationWarning instead of a
452452
DeprecationWarning. Cannot be used together with removal.
453-
obj_type : str, optional
453+
obj_type:
454454
The object type being deprecated.
455-
addendum : str, optional
455+
addendum:
456456
Additional text appended directly to the final message.
457-
removal : str, optional
457+
removal:
458458
The expected removal version. With the default (an empty
459459
string), a removal version is automatically computed from
460460
since. Set to other Falsy values to not schedule a removal
461461
date. Cannot be used together with pending.
462-
package: str, optional
462+
package:
463463
The package of the deprecated object.
464464
"""
465465
if not pending:

libs/core/langchain_core/load/serializable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class Serializable(BaseModel, ABC):
111111

112112
# Remove default BaseModel init docstring.
113113
def __init__(self, *args: Any, **kwargs: Any) -> None:
114-
"""""" # noqa: D419
114+
"""""" # noqa: D419 # Intentional blank docstring
115115
super().__init__(*args, **kwargs)
116116

117117
@classmethod

libs/core/langchain_core/tools/convert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def invalid_docstring_3(bar: str, baz: int) -> str:
227227
\"\"\"
228228
return bar
229229
230-
""" # noqa: D214, D410, D411
230+
""" # noqa: D214, D410, D411 # We're intentionally showing bad formatting in examples
231231

232232
def _create_tool_factory(
233233
tool_name: str,

libs/core/langchain_core/utils/function_calling.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -667,14 +667,13 @@ def tool_example_to_messages(
667667
The ``ToolMessage`` is required because some chat models are hyper-optimized for
668668
agents rather than for an extraction use case.
669669
670-
Arguments:
671-
input: string, the user input
672-
tool_calls: list[BaseModel], a list of tool calls represented as Pydantic
673-
BaseModels
674-
tool_outputs: Optional[list[str]], a list of tool call outputs.
670+
Args:
671+
input: The user input
672+
tool_calls: Tool calls represented as Pydantic BaseModels
673+
tool_outputs: Tool call outputs.
675674
Does not need to be provided. If not provided, a placeholder value
676675
will be inserted. Defaults to None.
677-
ai_response: Optional[str], if provided, content for a final ``AIMessage``.
676+
ai_response: If provided, content for a final ``AIMessage``.
678677
679678
Returns:
680679
A list of messages

libs/core/pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ ignore = [
9999
# TODO rules
100100
"ANN401", # No Any types
101101
"BLE", # Blind exceptions
102-
"DOC", # Docstrings (preview)
103102
"ERA", # No commented-out code
104103
"PLR2004", # Comparison to magic number
105104
]
@@ -113,10 +112,12 @@ flake8-annotations.mypy-init-return = true
113112
flake8-builtins.ignorelist = ["id", "input", "type"]
114113
flake8-type-checking.runtime-evaluated-base-classes = ["pydantic.BaseModel","langchain_core.load.serializable.Serializable","langchain_core.runnables.base.RunnableSerializable"]
115114
pep8-naming.classmethod-decorators = [ "classmethod", "langchain_core.utils.pydantic.pre_init", "pydantic.field_validator", "pydantic.v1.root_validator",]
116-
pydocstyle.convention = "google"
117-
pydocstyle.ignore-var-parameters = true
118115
pyupgrade.keep-runtime-typing = true
119116

117+
[tool.ruff.lint.pydocstyle]
118+
convention = "google"
119+
ignore-var-parameters = true # ignore missing documentation for *args and **kwargs parameters
120+
120121
[tool.ruff.lint.per-file-ignores]
121122
"langchain_core/utils/mustache.py" = [ "PLW0603",]
122123
"tests/unit_tests/test_tools.py" = [ "ARG",]

libs/core/tests/unit_tests/test_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,7 @@ def foo4(bar: str, baz: int) -> str:
13441344
Args:
13451345
bar: The bar.
13461346
baz: The baz.
1347-
""" # noqa: D205,D411
1347+
""" # noqa: D205,D411 # We're intentionally testing bad formatting.
13481348
return bar
13491349

13501350
for func in {foo3, foo4}:

0 commit comments

Comments
 (0)