Skip to content

Commit a24a9c6

Browse files
author
Erick Friis
authored
multiple: get rid of pyproject extras (#22581)
They cause `poetry lock` to take a ton of time, and `uv pip install` can resolve the constraints from these toml files in trivial time (addressing problem with #19153) This allows us to properly upgrade lockfile dependencies moving forward, which revealed some issues that were either fixed or type-ignored (see file comments)
1 parent 4367e89 commit a24a9c6

File tree

34 files changed

+3678
-12600
lines changed

34 files changed

+3678
-12600
lines changed

.github/workflows/check_diffs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ jobs:
123123
shell: bash
124124
run: |
125125
echo "Running extended tests, installing dependencies with poetry..."
126-
poetry install -E extended_testing --with test
126+
poetry install --with test
127+
poetry run pip install uv
128+
poetry run uv pip install -r extended_testing_deps.txt
127129
128130
- name: Run extended tests
129131
run: make extended_tests

docs/docs/contributing/code.mdx

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -206,30 +206,20 @@ ignore-words-list = 'momento,collison,ned,foor,reworkd,parth,whats,aapply,mysogy
206206

207207
`langchain-core` and partner packages **do not use** optional dependencies in this way.
208208

209-
You only need to add a new dependency if a **unit test** relies on the package.
210-
If your package is only required for **integration tests**, then you can skip these
211-
steps and leave all pyproject.toml and poetry.lock files alone.
209+
You'll notice that `pyproject.toml` and `poetry.lock` are **not** touched when you add optional dependencies below.
212210

213211
If you're adding a new dependency to Langchain, assume that it will be an optional dependency, and
214212
that most users won't have it installed.
215213

216214
Users who do not have the dependency installed should be able to **import** your code without
217215
any side effects (no warnings, no errors, no exceptions).
218216

219-
To introduce the dependency to the pyproject.toml file correctly, please do the following:
220-
221-
1. Add the dependency to the main group as an optional dependency
222-
```bash
223-
poetry add --optional [package_name]
224-
```
225-
2. Open pyproject.toml and add the dependency to the `extended_testing` extra
226-
3. Relock the poetry file to update the extra.
227-
```bash
228-
poetry lock --no-update
229-
```
230-
4. Add a unit test that the very least attempts to import the new code. Ideally, the unit
217+
To introduce the dependency to a library, please do the following:
218+
219+
1. Open extended_testing_deps.txt and add the dependency
220+
2. Add a unit test that the very least attempts to import the new code. Ideally, the unit
231221
test makes use of lightweight fixtures to test the logic of the code.
232-
5. Please use the `@pytest.mark.requires(package_name)` decorator for any tests that require the dependency.
222+
3. Please use the `@pytest.mark.requires(package_name)` decorator for any unit tests that require the dependency.
233223

234224
## Adding a Jupyter Notebook
235225

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
aiosqlite>=0.19.0,<0.20
2+
aleph-alpha-client>=2.15.0,<3
3+
anthropic>=0.3.11,<0.4
4+
arxiv>=1.4,<2
5+
assemblyai>=0.17.0,<0.18
6+
atlassian-python-api>=3.36.0,<4
7+
azure-ai-documentintelligence>=1.0.0b1,<2
8+
azure-identity>=1.15.0,<2
9+
azure-search-documents==11.4.0
10+
beautifulsoup4>=4,<5
11+
bibtexparser>=1.4.0,<2
12+
cassio>=0.1.6,<0.2
13+
chardet>=5.1.0,<6
14+
cloudpathlib>=0.18,<0.19
15+
cloudpickle>=2.0.0
16+
cohere>=4,<6
17+
databricks-vectorsearch>=0.21,<0.22
18+
datasets>=2.15.0,<3
19+
dgml-utils>=0.3.0,<0.4
20+
elasticsearch>=8.12.0,<9
21+
esprima>=4.0.1,<5
22+
faiss-cpu>=1,<2
23+
feedparser>=6.0.10,<7
24+
fireworks-ai>=0.9.0,<0.10
25+
friendli-client>=1.2.4,<2
26+
geopandas>=0.13.1,<0.14
27+
gitpython>=3.1.32,<4
28+
google-cloud-documentai>=2.20.1,<3
29+
gql>=3.4.1,<4
30+
gradientai>=1.4.0,<2
31+
hdbcli>=2.19.21,<3
32+
hologres-vector==0.0.6
33+
html2text>=2020.1.16
34+
httpx>=0.24.1,<0.25
35+
httpx-sse>=0.4.0,<0.5
36+
javelin-sdk>=0.1.8,<0.2
37+
jinja2>=3,<4
38+
jq>=1.4.1,<2
39+
jsonschema>1
40+
lxml>=4.9.3,<6.0
41+
markdownify>=0.11.6,<0.12
42+
motor>=3.3.1,<4
43+
msal>=1.25.0,<2
44+
mwparserfromhell>=0.6.4,<0.7
45+
mwxml>=0.3.3,<0.4
46+
newspaper3k>=0.2.8,<0.3
47+
numexpr>=2.8.6,<3
48+
nvidia-riva-client>=2.14.0,<3
49+
oci>=2.119.1,<3
50+
openai<2
51+
openapi-pydantic>=0.3.2,<0.4
52+
oracle-ads>=2.9.1,<3
53+
oracledb>=2.2.0,<3
54+
pandas>=2.0.1,<3
55+
pdfminer-six>=20221105
56+
pgvector>=0.1.6,<0.2
57+
praw>=7.7.1,<8
58+
premai>=0.3.25,<0.4
59+
psychicapi>=0.8.0,<0.9
60+
py-trello>=0.19.0,<0.20
61+
pyjwt>=2.8.0,<3
62+
pymupdf>=1.22.3,<2
63+
pypdf>=3.4.0,<4
64+
pypdfium2>=4.10.0,<5
65+
pyspark>=3.4.0,<4
66+
rank-bm25>=0.2.2,<0.3
67+
rapidfuzz>=3.1.1,<4
68+
rapidocr-onnxruntime>=1.3.2,<2
69+
rdflib==7.0.0
70+
requests-toolbelt>=1.0.0,<2
71+
rspace_client>=2.5.0,<3
72+
scikit-learn>=1.2.2,<2
73+
simsimd>=4.3.1,<5
74+
sqlite-vss>=0.1.2,<0.2
75+
streamlit>=1.18.0,<2
76+
sympy>=1.12,<2
77+
telethon>=1.28.5,<2
78+
tidb-vector>=0.0.3,<1.0.0
79+
timescale-vector==0.0.1
80+
tqdm>=4.48.0
81+
tree-sitter>=0.20.2,<0.21
82+
tree-sitter-languages>=1.8.0,<2
83+
upstash-redis>=0.15.0,<0.16
84+
vdms==0.0.20
85+
xata>=1.0.0a7,<2
86+
xmltodict>=0.13.0,<0.14

libs/community/langchain_community/callbacks/tracers/wandb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def _convert_run_to_wb_span(self, run: Run) -> "Span":
7575
:return: The converted Span.
7676
"""
7777
attributes = {**run.extra} if run.extra else {}
78-
attributes["execution_order"] = run.execution_order
78+
attributes["execution_order"] = run.execution_order # type: ignore
7979

8080
return self.trace_tree.Span(
8181
span_id=str(run.id) if run.id is not None else None,

libs/community/langchain_community/tools/nuclia/tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def _pull_queue(self) -> None:
220220
data = MessageToJson(
221221
pb,
222222
preserving_proto_field_name=True,
223-
including_default_value_fields=True,
223+
including_default_value_fields=True, # type: ignore
224224
)
225225
self._results[matching_id]["data"] = data
226226

libs/community/langchain_community/vectorstores/docarray/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _check_docarray_import() -> None:
2828
except ImportError:
2929
raise ImportError(
3030
"Could not import docarray python package. "
31-
'Please install it with `pip install "langchain[docarray]"`.'
31+
"Please install it with `pip install docarray`."
3232
)
3333

3434

libs/community/langchain_community/vectorstores/docarray/hnsw.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class DocArrayHnswSearch(DocArrayIndex):
1414
"""`HnswLib` storage using `DocArray` package.
1515
1616
To use it, you should have the ``docarray`` package with version >=0.32.0 installed.
17-
You can install it with `pip install "docarray[hnswlib]"`.
17+
You can install it with `pip install docarray`.
1818
"""
1919

2020
@classmethod

libs/community/langchain_community/vectorstores/docarray/in_memory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class DocArrayInMemorySearch(DocArrayIndex):
1515
"""In-memory `DocArray` storage for exact search.
1616
1717
To use it, you should have the ``docarray`` package with version >=0.32.0 installed.
18-
You can install it with `pip install "langchain[docarray]"`.
18+
You can install it with `pip install docarray`.
1919
"""
2020

2121
@classmethod

0 commit comments

Comments
 (0)