Skip to content

Commit

Permalink
update naming (#26)
Browse files Browse the repository at this point in the history
* update naming

* fix lint/fmt
  • Loading branch information
bjchambers authored Jan 17, 2025
1 parent d387bbe commit 8808ac0
Show file tree
Hide file tree
Showing 53 changed files with 67 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup-python-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ runs:
cache-suffix: ${{ matrix.python-version }}

- name: Install Python dependencies
run: uv sync --frozen --package langchain-graph-rag
run: uv sync --frozen --package langchain-graph-retriever
shell: bash
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ jobs:

- name: Run `make test`
run:
uv run --package langchain-graph-rag python -m pytest -vs
./packages/langchain-graph-rag/tests/unit_tests/
./packages/langchain-graph-rag/tests/integration_tests/
uv run --package langchain-graph-retriever python -m pytest -vs
./packages/langchain-graph-retriever/tests/unit_tests/
./packages/langchain-graph-retriever/tests/integration_tests/
--stores=mem_norm --stores=mem --stores=cassandra --stores=chroma --stores=opensearch
--junitxml=junit/test-results-${{ matrix.python-version }}.xml

Expand Down
50 changes: 25 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ lock:

.PHONY: deptry-gr deptry-lgr deptry
deptry-gr:
@echo "🚀 Checking for obsolete dependencies: Running deptry on graph-rag"
cd packages/graph-rag && uvx $(DEPTRY) src tests
@echo "🚀 Checking for obsolete dependencies: Running deptry on graph-retriever"
cd packages/graph-retriever && uvx $(DEPTRY) src tests

deptry-lgr:
@echo "🚀 Checking for obsolete dependencies: Running deptry on langchain-graph-rag"
cd packages/langchain-graph-rag && uvx $(DEPTRY) src tests
@echo "🚀 Checking for obsolete dependencies: Running deptry on langchain-graph-retriever"
cd packages/langchain-graph-retriever && uvx $(DEPTRY) src tests

deptry: deptry-gr deptry-lgr

Expand All @@ -49,42 +49,42 @@ docker-up:
docker-down:
docker compose down --rmi local

.PHONY: sync-langchain-graph-rag
sync-langchain-graph-rag:
@uv sync --package langchain-graph-rag
.PHONY: sync-langchain-graph-retriever
sync-langchain-graph-retriever:
@uv sync --package langchain-graph-retriever

.PHONY: sync-graph-rag
sync-graph-rag:
@uv sync --package graph-rag
.PHONY: sync-graph-retriever
sync-graph-retriever:
@uv sync --package graph-retriever

.PHONY: integration
integration:
@echo "🚀 Testing code: Running pytest ./packages/langchain-graph-rag/tests/integration_tests (in memory only)"
@uv run --project langchain-graph-rag pytest -vs ./packages/langchain-graph-rag/tests/integration_tests/
@echo "🚀 Testing code: Running pytest ./packages/langchain-graph-retriever/tests/integration_tests (in memory only)"
@uv run --package langchain-graph-retriever pytest -vs ./packages/langchain-graph-retriever/tests/integration_tests/

.PHONY: unit
unit:
@echo "🚀 Testing code: Running pytest ./packages/langchain-graph-rag/tests/unit_tests/"
@uv run --project langchain-graph-rag pytest -vs ./packages/langchain-graph-rag/tests/unit_tests/
@echo "🚀 Testing code: Running pytest ./packages/langchain-graph-retriever/tests/unit_tests/"
@uv run --package langchain-graph-retriever pytest -vs ./packages/langchain-graph-retriever/tests/unit_tests/

.PHONY: test
test: sync-langchain-graph-rag
test: sync-langchain-graph-retriever
@echo "🚀 Testing code: Running pytest"
@uv run --project langchain-graph-rag python -m pytest -vs ./packages/langchain-graph-rag/tests/ --stores=all
@cd packages/langchain-graph-retriever && uv run pytest -vs ./tests/unit_tests ./tests/integration_tests --stores=all

.PHONY: mypy
mypy:
@echo "🚀 Static type checking: Running mypy"
@uv run --project langchain-graph-rag mypy ./packages/langchain-graph-rag
@uv run --package langchain-graph-retriever mypy ./packages/langchain-graph-retriever

lint: fmt fix mypy

.PHONY: build-langchain-graph-rag
build-langchain-graph-rag: sync-langchain-graph-rag
@echo "🚀 Building langchain-graph-rag package"
@uv build --package langchain-graph-rag
.PHONY: build-langchain-graph-retriever
build-langchain-graph-retriever: sync-langchain-graph-retriever
@echo "🚀 Building langchain-graph-retriever package"
@uv build --package langchain-graph-retriever

.PHONY: build-graph-rag
build-graph-rag: sync-graph-rag
@echo "🚀 Building graph-rag package"
@uv build --package graph-rag
.PHONY: build-graph-retriever
build-graph-retriever: sync-graph-retriever
@echo "🚀 Building graph-retriever package"
@uv build --package graph-retriever
1 change: 0 additions & 1 deletion packages/graph-rag/README.md

This file was deleted.

1 change: 1 addition & 0 deletions packages/graph-retriever/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# graph-retriever
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "graph-rag"
name = "graph-retriever"
version = "0.0.0"
description = "Add your description here"
readme = "README.md"
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion packages/langchain-graph-rag/README.md

This file was deleted.

1 change: 1 addition & 0 deletions packages/langchain-graph-retriever/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# langchain-graph-retriever
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "langchain-graph-rag"
name = "langchain-graph-retriever"
version = "0.0.1"
description = "Add your description here"
readme = "README.md"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Iterable

import numpy as np
from langchain_graph_rag.utils.math import cosine_similarity
from langchain_graph_retriever.utils.math import cosine_similarity
from numpy.typing import NDArray
from pydantic import Field

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import os

import pytest
from langchain_core.documents import Document
Expand All @@ -9,7 +10,11 @@
@pytest.fixture(scope="session")
def animal_docs() -> list[Document]:
documents = []
with open("data/animals.jsonl", "r") as file:

path = os.path.abspath(
os.path.join(os.path.dirname(__file__), "../../../../../data/animals.jsonl")
)
with open(path, "r") as file:
for line in file:
data = json.loads(line.strip())
documents.append(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
from langchain_core.documents import Document
from langchain_graph_rag.retrievers.store_adapters import StoreAdapter
from langchain_graph_retriever.retrievers.store_adapters import StoreAdapter
from tests.embeddings.simple_embeddings import EarthEmbeddings
from tests.integration_tests.stores import StoreFactory

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from langchain_core.documents import Document
from langchain_graph_rag.retrievers.graph_traversal_retriever import (
from langchain_graph_retriever.retrievers.graph_traversal_retriever import (
GraphTraversalRetriever,
)
from langchain_graph_rag.retrievers.strategy.eager import (
from langchain_graph_retriever.retrievers.strategy.eager import (
Eager,
)
from tests.integration_tests.assertions import assert_document_format, sorted_doc_ids
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from langchain_core.documents import Document
from langchain_core.vectorstores import InMemoryVectorStore
from langchain_graph_rag.retrievers.graph_traversal_retriever import (
from langchain_graph_retriever.retrievers.graph_traversal_retriever import (
GraphTraversalRetriever,
)
from langchain_graph_rag.retrievers.store_adapters.in_memory import (
from langchain_graph_retriever.retrievers.store_adapters.in_memory import (
InMemoryStoreAdapter,
)
from langchain_graph_rag.retrievers.strategy.mmr import (
from langchain_graph_retriever.retrievers.strategy.mmr import (
Mmr,
)
from tests.embeddings.simple_embeddings import Angular2DEmbeddings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_core.vectorstores import VectorStore
from langchain_graph_rag.document_transformers.metadata_denormalizer import (
from langchain_graph_retriever.document_transformers.metadata_denormalizer import (
MetadataDenormalizer,
)
from langchain_graph_rag.retrievers.store_adapters import StoreAdapter
from langchain_graph_retriever.retrievers.store_adapters import StoreAdapter

ALL_STORES = ["mem_norm", "mem", "astra", "cassandra", "chroma", "opensearch"]
TESTCONTAINER_STORES = ["cassandra", "opensearch"]
Expand Down Expand Up @@ -85,7 +85,7 @@ def _cassandra_store_factory(request: pytest.FixtureRequest):

from cassandra.cluster import Cluster # type: ignore
from langchain_community.vectorstores.cassandra import Cassandra
from langchain_graph_rag.retrievers.store_adapters.cassandra import (
from langchain_graph_retriever.retrievers.store_adapters.cassandra import (
CassandraStoreAdapter,
)

Expand Down Expand Up @@ -148,7 +148,7 @@ def teardown_cassandra(cassandra: Cassandra):

def _opensearch_store_factory(request: pytest.FixtureRequest):
from langchain_community.vectorstores import OpenSearchVectorSearch
from langchain_graph_rag.retrievers.store_adapters.open_search import (
from langchain_graph_retriever.retrievers.store_adapters.open_search import (
OpenSearchStoreAdapter,
)

Expand Down Expand Up @@ -201,7 +201,7 @@ def _astra_store_factory(_request: pytest.FixtureRequest) -> StoreFactory:
from astrapy.authentication import StaticTokenProvider
from dotenv import load_dotenv
from langchain_astradb import AstraDBVectorStore
from langchain_graph_rag.retrievers.store_adapters.astra import (
from langchain_graph_retriever.retrievers.store_adapters.astra import (
AstraStoreAdapter,
)

Expand Down Expand Up @@ -248,7 +248,7 @@ def _in_memory_store_factory(
_request: pytest.FixtureRequest, support_normalized_metadata: bool
) -> StoreFactory:
from langchain_core.vectorstores import InMemoryVectorStore
from langchain_graph_rag.retrievers.store_adapters.in_memory import (
from langchain_graph_retriever.retrievers.store_adapters.in_memory import (
InMemoryStoreAdapter,
)

Expand All @@ -269,7 +269,7 @@ def create_in_memory(

def _chroma_store_factory(_request: pytest.FixtureRequest) -> StoreFactory:
from langchain_chroma.vectorstores import Chroma
from langchain_graph_rag.retrievers.store_adapters.chroma import (
from langchain_graph_retriever.retrievers.store_adapters.chroma import (
ChromaStoreAdapter,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
from langchain_graph_rag.retrievers.edge import Edge
from langchain_graph_rag.retrievers.edge_helper import EdgeHelper
from langchain_graph_retriever.retrievers.edge import Edge
from langchain_graph_retriever.retrievers.edge_helper import EdgeHelper


def test_edge_helper_initialization():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from langchain_graph_rag.retrievers.strategy.mmr import Mmr
from langchain_graph_retriever.retrievers.strategy.mmr import Mmr


def test_mmr_parameters() -> None:
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "graph-rag-workspace"
name = "graph-retriever-workspace"
version = "0.1.0"
description = "uv workspace for Graph RAG projects"
readme = "README.md"
Expand Down Expand Up @@ -41,6 +41,6 @@ skip_empty = true
[tool.coverage.run]
branch = true
source = [
"packages/graph-rag/src/graph_rag",
"packages/langchain-graph-rag/src/langchain_graph_rag",
"packages/graph-retriever/src/graph_retriever",
"packages/langchain-graph-retriever/src/langchain_graph_retriever",
]
16 changes: 8 additions & 8 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8808ac0

Please sign in to comment.