Skip to content

Commit

Permalink
ollama: add pydocstyle linting for ollama (#27686)
Browse files Browse the repository at this point in the history
Description: add lint docstrings for ollama module
Issue: the issue #23188
@baskaryan

test: ruff check passed.
<img width="311" alt="e94c68ffa93dd518297a95a93de5217"
src="https://github.com/user-attachments/assets/e96bf721-e0e3-44de-a50e-206603de398e">

Co-authored-by: Erick Friis <[email protected]>
  • Loading branch information
JiaranI and efriis authored Oct 31, 2024
1 parent a8a33b2 commit 3952ee3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
6 changes: 6 additions & 0 deletions libs/partners/ollama/langchain_ollama/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
"""This is the langchain_ollama package.
It provides infrastructure for interacting with the Ollama service.
"""


from importlib import metadata

from langchain_ollama.chat_models import ChatOllama
Expand Down
2 changes: 1 addition & 1 deletion libs/partners/ollama/langchain_ollama/chat_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _lc_tool_call_to_openai_tool_call(tool_call: ToolCall) -> dict:


class ChatOllama(BaseChatModel):
"""Ollama chat model integration.
r"""Ollama chat model integration.
.. dropdown:: Setup
:open:
Expand Down
1 change: 1 addition & 0 deletions libs/partners/ollama/langchain_ollama/embeddings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Ollama embeddings models."""
from typing import (
List,
Optional,
Expand Down
15 changes: 14 additions & 1 deletion libs/partners/ollama/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,20 @@ ollama = ">=0.3.0,<1"
langchain-core = "^0.3.0"

[tool.ruff.lint]
select = ["E", "F", "I", "T201"]
select = [
"E", # pycodestyle
"F", # pyflakes
"I", # isort
"T201", # print
"D", # pydocstyle

]

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.lint.per-file-ignores]
"tests/**" = ["D"] # ignore docstring checks for tests

[tool.coverage.run]
omit = ["tests/*"]
Expand Down
1 change: 1 addition & 0 deletions libs/partners/ollama/scripts/check_imports.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""load multiple Python files specified as command line arguments."""
import sys
import traceback
from importlib.machinery import SourceFileLoader
Expand Down

0 comments on commit 3952ee3

Please sign in to comment.