Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

community, langchain, infra: store extended test deps outside of poetry #18995

Merged
merged 14 commits into from
Mar 15, 2024
3 changes: 2 additions & 1 deletion .github/workflows/check_diffs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ jobs:
shell: bash
run: |
echo "Running extended tests, installing dependencies with poetry..."
poetry install -E extended_testing --with test
poetry install --with test
poetry run pip install -r extended_requirements.txt
- name: Run extended tests
run: make extended_tests
Expand Down
22 changes: 6 additions & 16 deletions docs/docs/contributing/code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -206,30 +206,20 @@ ignore-words-list = 'momento,collison,ned,foor,reworkd,parth,whats,aapply,mysogy

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

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

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

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

To introduce the dependency to the pyproject.toml file correctly, please do the following:

1. Add the dependency to the main group as an optional dependency
```bash
poetry add --optional [package_name]
```
2. Open pyproject.toml and add the dependency to the `extended_testing` extra
3. Relock the poetry file to update the extra.
```bash
poetry lock --no-update
```
4. Add a unit test that the very least attempts to import the new code. Ideally, the unit
To introduce the dependency to a library, please do the following:

1. Open extended_requirements.txt and add the dependency
2. Add a unit test that the very least attempts to import the new code. Ideally, the unit
test makes use of lightweight fixtures to test the logic of the code.
5. Please use the `@pytest.mark.requires(package_name)` decorator for any tests that require the dependency.
3. Please use the `@pytest.mark.requires(package_name)` decorator for any unit tests that require the dependency.

## Adding a Jupyter Notebook

Expand Down
79 changes: 79 additions & 0 deletions libs/community/extended_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
aleph-alpha-client
aiosqlite
assemblyai
beautifulsoup4
bibtexparser
cassio
chardet
datasets
google-cloud-documentai
esprima
jq
pdfminer-six
pgvector
pypdf
pymupdf
pypdfium2
tqdm
lxml
atlassian-python-api
mwparserfromhell
mwxml
msal
pandas
telethon
psychicapi
gql
gradientai
requests-toolbelt
html2text
numexpr
py-trello
scikit-learn
streamlit
pyspark
openai
sympy
rapidfuzz
jsonschema
rank-bm25
geopandas
jinja2
gitpython
newspaper3k
nvidia-riva-client
feedparser
xata
xmltodict
faiss-cpu
openapi-pydantic==0.3.2
markdownify
arxiv
sqlite-vss
rapidocr-onnxruntime
motor
timescale-vector
anthropic
upstash-redis
rspace_client
fireworks-ai
javelin-sdk>=0.1.8,<0.2
hologres-vector
praw
databricks-vectorsearch
cloudpickle
dgml-utils
cohere
tree-sitter
tree-sitter-languages
azure-ai-documentintelligence
oracle-ads
zhipuai
httpx
elasticsearch
hdbcli
oci
rdflib
tidb-vector
cloudpickle
friendli-client
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def _check_docarray_import() -> None:
except ImportError:
raise ImportError(
"Could not import docarray python package. "
'Please install it with `pip install "langchain[docarray]"`.'
"Please install it with `pip install docarray`."
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DocArrayHnswSearch(DocArrayIndex):
"""`HnswLib` storage using `DocArray` package.
To use it, you should have the ``docarray`` package with version >=0.32.0 installed.
You can install it with `pip install "langchain[docarray]"`.
You can install it with `pip install docarray`.
"""

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class DocArrayInMemorySearch(DocArrayIndex):
"""In-memory `DocArray` storage for exact search.
To use it, you should have the ``docarray`` package with version >=0.32.0 installed.
You can install it with `pip install "langchain[docarray]"`.
You can install it with `pip install docarray`.
"""

@classmethod
Expand Down