You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/CONTRIBUTING.md
+74-80
Original file line number
Diff line number
Diff line change
@@ -14,8 +14,8 @@ Please do not try to push directly to this repo unless you are a maintainer.
14
14
Please follow the checked-in pull request template when opening pull requests. Note related issues and tag relevant
15
15
maintainers.
16
16
17
-
Pull requests cannot land without passing the formatting, linting and testing checks first. See
18
-
[Common Tasks](#-common-tasks) for how to run these checks locally.
17
+
Pull requests cannot land without passing the formatting, linting and testing checks first. See[Testing](#testing) and
18
+
[Formatting and Linting](#formatting-and-linting) for how to run these checks locally.
19
19
20
20
It's essential that we maintain great documentation and testing. If you:
21
21
- Fix a bug
@@ -59,43 +59,85 @@ we do not want these to get in the way of getting good code into the codebase.
59
59
60
60
## 🚀 Quick Start
61
61
62
-
> **Note:** You can run this repository locally (which is described below) or in a [development container](https://containers.dev/) (which is described in the [.devcontainer folder](https://github.com/hwchase17/langchain/tree/master/.devcontainer)).
62
+
This quick start describes running the repository locally.
63
+
For a [development container](https://containers.dev/), see the [.devcontainer folder](https://github.com/hwchase17/langchain/tree/master/.devcontainer).
63
64
64
-
This project uses [Poetry](https://python-poetry.org/) v1.5.1 as a dependency manager. Check out Poetry's [documentation on how to install it](https://python-poetry.org/docs/#installation) on your system before proceeding.
65
+
### Dependency Management: Poetry and other env/dependency managers
65
66
66
-
❗Note: If you use `Conda` or `Pyenv` as your environment/package manager, avoid dependency conflicts by doing the following first:
67
-
1.*Before installing Poetry*, create and activate a new Conda env (e.g. `conda create -n langchain python=3.9`)
68
-
2. Install Poetry v1.5.1 (see above)
69
-
3. Tell Poetry to use the virtualenv python environment (`poetry config virtualenvs.prefer-active-python true`)
70
-
4. Continue with the following steps.
67
+
This project uses [Poetry](https://python-poetry.org/) v1.5.1+ as a dependency manager.
68
+
69
+
❗Note: *Before installing Poetry*, if you use `Conda`, create and activate a new Conda env (e.g. `conda create -n langchain python=3.9`)
70
+
71
+
Install Poetry: **[documentation on how to install it](https://python-poetry.org/docs/#installation)**.
72
+
73
+
❗Note: If you use `Conda` or `Pyenv` as your environment/package manager, after installing Poetry,
74
+
tell Poetry to use the virtualenv python environment (`poetry config virtualenvs.prefer-active-python true`)
75
+
76
+
### Core vs. Experimental
71
77
72
78
There are two separate projects in this repository:
73
79
-`langchain`: core langchain code, abstractions, and use cases
74
-
-`langchain.experimental`: more experimental code
80
+
-`langchain.experimental`: see the [Experimental README](../libs/experimental/README.md) for more information.
81
+
82
+
Each of these has their own development environment. Docs are run from the top-level makefile, but development
83
+
is split across separate test & release flows.
75
84
76
-
Each of these has their OWN development environment.
77
-
In order to run any of the commands below, please move into their respective directories.
78
-
For example, to contribute to `langchain` run `cd libs/langchain` before getting started with the below.
85
+
For this quickstart, start with langchain core:
79
86
80
-
To install requirements:
87
+
```bash
88
+
cd libs/langchain
89
+
```
90
+
91
+
### Local Development Dependencies
92
+
93
+
Install langchain development requirements (for running langchain, running examples, linting, formatting, tests, and coverage):
81
94
82
95
```bash
83
96
poetry install --with test
84
97
```
85
98
86
-
This will install all requirements for running the package, examples, linting, formatting, tests, and coverage.
99
+
Then verify dependency installation:
87
100
88
-
❗Note: If during installation you receive a `WheelFileValidationError` for `debugpy`, please make sure you are running Poetry v1.5.1. This bug was present in older versions of Poetry (e.g. 1.4.1) and has been resolved in newer releases. If you are still seeing this bug on v1.5.1, you may also try disabling "modern installation" (`poetry config installer.modern-installation false`) and re-installing requirements. See [this `debugpy` issue](https://github.com/microsoft/debugpy/issues/1246) for more details.
101
+
```bash
102
+
make test
103
+
```
89
104
90
-
Now assuming `make` and `pytest` are installed, you should be able to run the common tasks in the following section. To double check, run `make test` under `libs/langchain`, all tests should pass. If they don't, you may need to pip install additional dependencies, such as `numexpr` and `openapi_schema_pydantic`.
105
+
If the tests don't pass, you may need to pip install additional dependencies, such as `numexpr` and `openapi_schema_pydantic`.
91
106
92
-
## ✅ Common Tasks
107
+
If during installation you receive a `WheelFileValidationError` for `debugpy`, please make sure you are running
108
+
Poetry v1.5.1+. This bug was present in older versions of Poetry (e.g. 1.4.1) and has been resolved in newer releases.
109
+
If you are still seeing this bug on v1.5.1, you may also try disabling "modern installation"
110
+
(`poetry config installer.modern-installation false`) and re-installing requirements.
111
+
See [this `debugpy` issue](https://github.com/microsoft/debugpy/issues/1246) for more details.
93
112
94
-
Type `make` for a list of common tasks.
113
+
### Testing
95
114
96
-
### Code Formatting
115
+
_some test dependencies are optional; see section about optional dependencies_.
97
116
98
-
Formatting for this project is done via a combination of [Black](https://black.readthedocs.io/en/stable/) and [isort](https://pycqa.github.io/isort/).
117
+
Unit tests cover modular logic that does not require calls to outside APIs.
118
+
If you add new logic, please add a unit test.
119
+
120
+
To run unit tests:
121
+
122
+
```bash
123
+
make test
124
+
```
125
+
126
+
To run unit tests in Docker:
127
+
128
+
```bash
129
+
make docker_tests
130
+
```
131
+
132
+
There are also [integration tests and code-coverage](../libs/langchain/tests/README.md) available.
133
+
134
+
### Formatting and Linting
135
+
136
+
Run these locally before submitting a PR; the CI system will check also.
137
+
138
+
#### Code Formatting
139
+
140
+
Formatting for this project is done via a combination of [Black](https://black.readthedocs.io/en/stable/) and [ruff](https://docs.astral.sh/ruff/rules/).
99
141
100
142
To run formatting for this project:
101
143
@@ -111,9 +153,9 @@ make format_diff
111
153
112
154
This is especially useful when you have made changes to a subset of the project and want to ensure your changes are properly formatted without affecting the rest of the codebase.
113
155
114
-
### Linting
156
+
####Linting
115
157
116
-
Linting for this project is done via a combination of [Black](https://black.readthedocs.io/en/stable/), [isort](https://pycqa.github.io/isort/), [flake8](https://flake8.pycqa.org/en/latest/), and [mypy](http://mypy-lang.org/).
158
+
Linting for this project is done via a combination of [Black](https://black.readthedocs.io/en/stable/), [ruff](https://docs.astral.sh/ruff/rules/), and [mypy](http://mypy-lang.org/).
117
159
118
160
To run linting for this project:
119
161
@@ -131,7 +173,7 @@ This can be very helpful when you've made changes to only certain parts of the p
131
173
132
174
We recognize linting can be annoying - if you do not want to do it, please contact a project maintainer, and they can help you with it. We do not want this to be a blocker for good code getting contributed.
133
175
134
-
### Spellcheck
176
+
####Spellcheck
135
177
136
178
Spellchecking for this project is done via [codespell](https://github.com/codespell-project/codespell).
137
179
Note that `codespell` finds common typos, so it could have false-positive (correctly spelled but rarely used) and false-negatives (not finding misspelled) words.
@@ -157,17 +199,7 @@ If codespell is incorrectly flagging a word, you can skip spellcheck for that wo
0 commit comments