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: revert store extended test deps outside of poetry #19153

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/check_diffs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ jobs:
shell: bash
run: |
echo "Running extended tests, installing dependencies with poetry..."
poetry install --with test
poetry run pip install -r extended_requirements.txt
poetry install -E extended_testing --with test

- name: Run extended tests
run: make extended_tests
Expand Down
22 changes: 16 additions & 6 deletions docs/docs/contributing/code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -206,20 +206,30 @@ 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'll notice that `pyproject.toml` and `poetry.lock` are **not** touched when you add optional dependencies below.
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.

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 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
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
test makes use of lightweight fixtures to test the logic of the code.
3. Please use the `@pytest.mark.requires(package_name)` decorator for any unit tests that require the dependency.
5. Please use the `@pytest.mark.requires(package_name)` decorator for any tests that require the dependency.

## Adding a Jupyter Notebook

Expand Down
79 changes: 0 additions & 79 deletions libs/community/extended_requirements.txt

This file was deleted.

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 docarray`."
'Please install it with `pip install "langchain[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 docarray`.
You can install it with `pip install "langchain[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 docarray`.
You can install it with `pip install "langchain[docarray]"`.
"""

@classmethod
Expand Down