Skip to content

Commit

Permalink
Backport TruLens to Python 3.8.1 (#1644)
Browse files Browse the repository at this point in the history
* backport some packages to 3.8

* add to testing matrix

* fix optional test condition

* drop everything to 3.8 and resolve versioning issues

* use importlib-resources for 3.8 compatibility

* unpin langchain versions

* clean

* add future annotations

* more test fixes

* fix required test annotations

* one more

* fix install issues

* handle missing functools.cache in 3.8

* don't skip optional tests on 3.8

* support llama-index/tiktoken dep in 3.13

* disable 3.13 tests

* fix test: nemoguardrails supported in 3.12

* add restricted langchain versions
  • Loading branch information
sfc-gh-chu authored Nov 13, 2024
1 parent da054cd commit 959ba5e
Show file tree
Hide file tree
Showing 43 changed files with 10,733 additions and 8,183 deletions.
4 changes: 4 additions & 0 deletions .azure_pipelines/ci-eval-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ jobs:
matrix:
default: # name is important
python-version: 3.12
py308-static:
python-version: 3.8
py309-static:
python-version: 3.9
py310-static:
python-version: 3.10
py311-static:
python-version: 3.11
# py313-static:
# python-version: 3.13

steps:
- template: templates/env-setup.yaml
Expand Down
5 changes: 0 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,10 @@ env-tests-required:
poetry install --only required
make env-tests

# Note: in the below, there are a few pinned langchain versions to make sure they don't have updated
# to broken versions which are a few versions after the pinned ones.
env-tests-optional: env env-tests
poetry run pip install \
langchain==0.2.11 \
langchain-core==0.2.24 \
llama-index-embeddings-huggingface \
llama-index-embeddings-openai \
langchain-openai \
unstructured \
chromadb

Expand Down
2,961 changes: 1,719 additions & 1,242 deletions poetry.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ classifiers = [
]

[tool.poetry.dependencies]
python = "^3.9,!=3.9.7"
python = "^3.8.1,!=3.9.7"
trulens-core = { version = "^1.0.0", extras = [
"otel",
"tqdm",
Expand All @@ -42,7 +42,7 @@ trulens_eval = { version = "^1.0.0" }
trulens-benchmark = { path = "src/benchmark", develop = true }

[tool.poetry.group.dev.dependencies]
pre-commit = "^3.7"
pre-commit = "^3.5"
ruff = ">=0.5"
mypy = "^1.11"
build = "^1.2"
Expand All @@ -68,9 +68,9 @@ mkdocs-literate-nav = ">=0.6"
mkdocs-section-index = ">=0.3"

[tool.poetry.group.apps.dependencies]
trulens-apps-langchain = { path = "src/apps/langchain", develop = true, python = "<3.13" }
trulens-apps-langchain = { path = "src/apps/langchain", develop = true }
trulens-apps-llamaindex = { path = "src/apps/llamaindex", develop = true }
trulens-apps-nemo = { path = "src/apps/nemo", develop = true, python = "<3.12" }
trulens-apps-nemo = { path = "src/apps/nemo", develop = true, python = "<3.13" }

[tool.poetry.group.providers.dependencies]
trulens-providers-bedrock = { path = "src/providers/bedrock", develop = true }
Expand All @@ -86,9 +86,9 @@ trulens-connectors-snowflake = { path = "src/connectors/snowflake", develop = tr
[tool.poetry.group.required.dependencies]
trulens-core = { path = "src/core", develop = true }
trulens-feedback = { path = "src/feedback", develop = true }
trulens-dashboard = { path = "src/dashboard", develop = true, python = "!=3.9.7" }
trulens-dashboard = { path = "src/dashboard", develop = true }
# Remove after deprecation period.
trulens_eval = { path = "src/trulens_eval", develop = true, python = "!=3.9.7" }
trulens_eval = { path = "src/trulens_eval", develop = true }

[tool.ruff]
line-length = 80
Expand Down
897 changes: 503 additions & 394 deletions src/apps/langchain/poetry.lock

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions src/apps/langchain/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ classifiers = [
]

[tool.poetry.dependencies]
python = "^3.9,<3.13"
python = "^3.8.1"
trulens-core = { version = "^1.0.0" }
langchain = ">=0.2.10,<0.2.12" # ,!=0.2.12"
langchain-core = "=0.2.24" # ,<0.2.27"
# buggy after 0.2.24 until 0.3.0 but that is not compatible with nemoguardrails
pydantic = "^2"
langchain = ">=0.2.10,<0.2.12 || ^0.3.0"
langchain-core = ">=0.2.0,<=0.2.24 || ^0.3.0"
pydantic = "^2.4.2"

[tool.poetry.group.dev.dependencies]
trulens-core = { path = "../../core" }
1,575 changes: 876 additions & 699 deletions src/apps/llamaindex/poetry.lock

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions src/apps/llamaindex/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ classifiers = [
]

[tool.poetry.dependencies]
python = "^3.9"
python = "^3.8.1"
trulens-core = { version = "^1.0.0" }
trulens-apps-langchain = { version = "^1.0.0", python = "<3.13" }
pydantic = "^2"
trulens-apps-langchain = { version = "^1.0.0" }
pydantic = "^2.4.2"
llama-index = ">=0.11"
tiktoken = [
{ version = ">=0.3.3", python = "<3.13" },
{ version = ">=0.8.0", python = ">=3.13" },
]

[tool.poetry.group.dev.dependencies]
trulens-core = { path = "../../core" }
trulens-apps-langchain = { path = "../langchain", python = "<3.13" }
trulens-apps-langchain = { path = "../langchain" }
1,272 changes: 699 additions & 573 deletions src/apps/nemo/poetry.lock

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions src/apps/nemo/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ classifiers = [
]

[tool.poetry.dependencies]
python = ">=3.9,<3.12"
python = "^3.8.1,<3.13"
trulens-core = { version = "^1.0.0" }
trulens-apps-langchain = { version = "^1.0.0", python = "<3.13" }
pydantic = "^2"
trulens-apps-langchain = { version = "^1.0.0" }
pydantic = "^2.4.2"
nemoguardrails = ">=0.9"
onnxruntime = [
{ version = ">=1.14.0,<1.20.0", python = "<3.10" },
{ version = ">=1.14.0", python = ">=3.10" },
]

[tool.poetry.group.dev.dependencies]
trulens-core = { path = "../../core" }
trulens-apps-langchain = { path = "../langchain", python = "<3.13" }
trulens-apps-langchain = { path = "../langchain" }
382 changes: 236 additions & 146 deletions src/benchmark/poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/benchmark/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ classifiers = [
]

[tool.poetry.dependencies]
python = "^3.9"
python = "^3.8.1"
trulens-core = { version = "^1.0.0" }

[tool.poetry.group.dev.dependencies]
Expand Down
Loading

0 comments on commit 959ba5e

Please sign in to comment.