From 4a0d8a71ed4d133c120acdd077817122eeeaa825 Mon Sep 17 00:00:00 2001 From: dhirup Date: Fri, 25 Jul 2025 16:50:57 -0700 Subject: [PATCH] Updates after review and added Makefile targets for publishing --- libs/partners/coherence/Makefile | 20 +++++++++++++++++-- .../langchain_coherence/coherence_store.py | 9 ++++----- libs/partners/coherence/pyproject.toml | 5 ++++- libs/partners/coherence/uv.lock | 2 +- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/libs/partners/coherence/Makefile b/libs/partners/coherence/Makefile index e85ffd5d432..b7dae9e5e64 100644 --- a/libs/partners/coherence/Makefile +++ b/libs/partners/coherence/Makefile @@ -8,10 +8,13 @@ RUFF := .venv/bin/ruff PYTEST := .venv/bin/pytest MYPY := .venv/bin/mypy +PACKAGE_NAME=langchain-coherence +DIST_DIR=dist + install: @echo "๐Ÿ”ง Installing all dependencies..." uv venv - uv pip install -e .[lint,typing,test,docs] + uv pip install -e .[lint,typing,test,docs,publish] update-dev: @echo "๐Ÿ”„ Updating development dependencies..." @@ -51,7 +54,17 @@ test: clean: @echo "๐Ÿงน Cleaning build/test artifacts..." - rm -rf .pytest_cache .mypy_cache .ruff_cache .venv .uv __pycache__ *.egg-info dist build + rm -rf .pytest_cache .mypy_cache .ruff_cache __pycache__ *.egg-info dist build + +build: + @echo "๐Ÿงฑ Building distribution using local virtualenv" + $(PYTHON) -m build --no-isolation + +upload-pypi: + @echo "๐Ÿš€ Uploading to PyPI" + $(PYTHON) -m twine upload dist/* + +publish: build upload-pypi help: @echo "๐Ÿ›  Available Make targets:" @@ -63,6 +76,9 @@ help: @echo " lint - Run linter and mypy" @echo " fix - Autoformat and fix issues" @echo " test - Run all tests" + @echo " build - Building distribution using local virtualenv" + @echo " upload-pypi - Uploading to PyPI" + @echo " publish - calls build, upload-pypi" @echo " clean - Remove temp and build files" diff --git a/libs/partners/coherence/langchain_coherence/coherence_store.py b/libs/partners/coherence/langchain_coherence/coherence_store.py index 35dcc23e1dd..125eba6dff6 100644 --- a/libs/partners/coherence/langchain_coherence/coherence_store.py +++ b/libs/partners/coherence/langchain_coherence/coherence_store.py @@ -378,7 +378,7 @@ class CoherenceVectorStore(VectorStore): async def asimilarity_search( self, query: str, k: int = 4, **kwargs: Any ) -> list[Document]: - """Async method return docs most similar to query. + """Async method return list of docs most similar to query. Args: query: Input text. @@ -423,7 +423,7 @@ class CoherenceVectorStore(VectorStore): async def asimilarity_search_by_vector( self, embedding: list[float], k: int = 4, **kwargs: Any ) -> list[Document]: - """Async method return docs most similar to passed embedding vector. + """Async method return list of docs most similar to passed embedding vector. Args: embedding: Input vector. @@ -466,7 +466,7 @@ class CoherenceVectorStore(VectorStore): async def asimilarity_search_with_score( self, query: str, k: int = 4, **kwargs: Any ) -> list[tuple[Document, float]]: - """Async method return list tuple(Document, score) most similar to query. + """Async method return list of tuple(Document, score) most similar to query. Args: query: Input text. @@ -529,7 +529,7 @@ class CoherenceVectorStore(VectorStore): metadatas: Optional[list[dict[str, Any]]] = None, **kwargs: Any, ) -> CoherenceVectorStore: - """Asynchronously initialize CoherenceVectorStore from texts and embeddings. + """Asynchronously initialize the CoherenceVectorStore from texts and embeddings. Args: texts: List of input text strings. @@ -539,7 +539,6 @@ class CoherenceVectorStore(VectorStore): - cache: Required Coherence NamedCache[str, Document] instance. - ids: Optional list of document IDs. - Returns: CoherenceVectorStore: An initialized and populated vector store. diff --git a/libs/partners/coherence/pyproject.toml b/libs/partners/coherence/pyproject.toml index f4f9e890b91..efcf48461ae 100644 --- a/libs/partners/coherence/pyproject.toml +++ b/libs/partners/coherence/pyproject.toml @@ -32,7 +32,10 @@ docs = [ "jupytext>=1.16", "nbdoc>=0.0.29", ] - +publish = [ + "build", + "twine" +] [tool.mypy] strict = "True" disallow_untyped_defs = "True" diff --git a/libs/partners/coherence/uv.lock b/libs/partners/coherence/uv.lock index 9cc480aa5e9..1a5aa10749e 100644 --- a/libs/partners/coherence/uv.lock +++ b/libs/partners/coherence/uv.lock @@ -1336,7 +1336,7 @@ wheels = [ [[package]] name = "langchain-coherence" -version = "0.0.1.dev0" +version = "0.0.1" source = { virtual = "." } dependencies = [ { name = "coherence-client" },