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
Builds out a developer documentation section in the docs
- Links it from contributing.md
- Adds an initial guide on how to contribute an integration
---------
Co-authored-by: Bagatur <[email protected]>
Copy file name to clipboardExpand all lines: .github/CONTRIBUTING.md
+9-344Lines changed: 9 additions & 344 deletions
Original file line number
Diff line number
Diff line change
@@ -3,31 +3,17 @@
3
3
Hi there! Thank you for even being interested in contributing to LangChain.
4
4
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether they involve new features, improved infrastructure, better documentation, or bug fixes.
5
5
6
-
## 🗺️ Guidelines
7
-
8
-
### 👩💻 Contributing Code
6
+
To learn about how to contribute, please follow the [guides here](https://python.langchain.com/docs/contributing/)
9
7
10
-
To contribute to this project, please follow the ["fork and pull request"](https://docs.github.com/en/get-started/quickstart/contributing-to-projects) workflow.
11
-
Please do not try to push directly to this repo unless you are a maintainer.
12
-
13
-
Please follow the checked-in pull request template when opening pull requests. Note related issues and tag relevant
14
-
maintainers.
8
+
## 🗺️ Guidelines
15
9
16
-
Pull requests cannot land without passing the formatting, linting, and testing checks first. See [Testing](#testing) and
17
-
[Formatting and Linting](#formatting-and-linting) for how to run these checks locally.
10
+
### 👩💻 Ways to contribute
18
11
19
-
It's essential that we maintain great documentation and testing. If you:
20
-
- Fix a bug
21
-
- Add a relevant unit or integration test when possible. These live in `tests/unit_tests` and `tests/integration_tests`.
22
-
- Make an improvement
23
-
- Update any affected example notebooks and documentation. These live in `docs`.
24
-
- Update unit and integration tests when relevant.
25
-
- Add a feature
26
-
- Add a demo notebook in `docs/docs/`.
27
-
- Add unit and integration tests.
12
+
There are many ways to contribute to LangChain. Here are some common ways people contribute:
28
13
29
-
We are a small, progress-oriented team. If there's something you'd like to add or change, opening a pull request is the
30
-
best way to get our attention.
14
+
-[**Documentation**](https://python.langchain.com/docs/contributing/documentation): Help improve our docs, including this one!
15
+
-[**Code**](https://python.langchain.com/docs/contributing/code): Help us write code, fix bugs, or improve our infrastructure.
16
+
-[**Integrations**](https://python.langchain.com/docs/contributing/integration): Help us integrate with your favorite vendors and tools.
31
17
32
18
### 🚩GitHub Issues
33
19
@@ -54,327 +40,6 @@ In a similar vein, we do enforce certain linting, formatting, and documentation
54
40
If you are finding these difficult (or even just annoying) to work with, feel free to contact a maintainer for help -
55
41
we do not want these to get in the way of getting good code into the codebase.
56
42
57
-
## 🚀 Quick Start
58
-
59
-
This quick start guide explains how to run the repository locally.
60
-
For a [development container](https://containers.dev/), see the [.devcontainer folder](https://github.com/langchain-ai/langchain/tree/master/.devcontainer).
61
-
62
-
### Dependency Management: Poetry and other env/dependency managers
63
-
64
-
This project utilizes [Poetry](https://python-poetry.org/) v1.6.1+ as a dependency manager.
65
-
66
-
❗Note: *Before installing Poetry*, if you use `Conda`, create and activate a new Conda env (e.g. `conda create -n langchain python=3.9`)
67
-
68
-
Install Poetry: **[documentation on how to install it](https://python-poetry.org/docs/#installation)**.
69
-
70
-
❗Note: If you use `Conda` or `Pyenv` as your environment/package manager, after installing Poetry,
71
-
tell Poetry to use the virtualenv python environment (`poetry config virtualenvs.prefer-active-python true`)
72
-
73
-
### Different packages
74
-
75
-
This repository contains multiple packages:
76
-
-`langchain-core`: Base interfaces for key abstractions as well as logic for combining them in chains (LangChain Expression Language).
77
-
-`langchain-community`: Third-party integrations of various components.
78
-
-`langchain`: Chains, agents, and retrieval logic that makes up the cognitive architecture of your applications.
79
-
-`langchain-experimental`: Components and chains that are experimental, either in the sense that the techniques are novel and still being tested, or they require giving the LLM more access than would be possible in most production systems.
80
-
81
-
Each of these has its own development environment. Docs are run from the top-level makefile, but development
82
-
is split across separate test & release flows.
83
-
84
-
For this quickstart, start with langchain:
85
-
86
-
```bash
87
-
cd libs/langchain
88
-
```
89
-
90
-
### Local Development Dependencies
91
-
92
-
Install langchain development requirements (for running langchain, running examples, linting, formatting, tests, and coverage):
93
-
94
-
```bash
95
-
poetry install --with test
96
-
```
97
-
98
-
Then verify dependency installation:
99
-
100
-
```bash
101
-
make test
102
-
```
103
-
104
-
If the tests don't pass, you may need to pip install additional dependencies, such as `numexpr` and `openapi_schema_pydantic`.
105
-
106
-
If during installation you receive a `WheelFileValidationError` for `debugpy`, please make sure you are running
107
-
Poetry v1.6.1+. This bug was present in older versions of Poetry (e.g. 1.4.1) and has been resolved in newer releases.
108
-
If you are still seeing this bug on v1.6.1, you may also try disabling "modern installation"
109
-
(`poetry config installer.modern-installation false`) and re-installing requirements.
110
-
See [this `debugpy` issue](https://github.com/microsoft/debugpy/issues/1246) for more details.
111
-
112
-
### Testing
113
-
114
-
_some test dependencies are optional; see section about optional dependencies_.
115
-
116
-
Unit tests cover modular logic that does not require calls to outside APIs.
117
-
If you add new logic, please add a unit test.
118
-
119
-
To run unit tests:
120
-
121
-
```bash
122
-
make test
123
-
```
124
-
125
-
To run unit tests in Docker:
126
-
127
-
```bash
128
-
make docker_tests
129
-
```
130
-
131
-
There are also [integration tests and code-coverage](https://github.com/langchain-ai/langchain/tree/master/libs/langchain/tests/README.md) available.
132
-
133
-
### Only develop langchain_core or langchain_experimental
134
-
135
-
If you are only developing `langchain_core` or `langchain_experimental`, you can simply install the dependencies for the respective projects and run tests:
136
-
137
-
```bash
138
-
cd libs/core
139
-
poetry install --with test
140
-
make test
141
-
```
142
-
143
-
Or:
144
-
145
-
```bash
146
-
cd libs/experimental
147
-
poetry install --with test
148
-
make test
149
-
```
150
-
151
-
### Formatting and Linting
152
-
153
-
Run these locally before submitting a PR; the CI system will check also.
154
-
155
-
#### Code Formatting
156
-
157
-
Formatting for this project is done via [ruff](https://docs.astral.sh/ruff/rules/).
158
-
159
-
To run formatting for docs, cookbook and templates:
160
-
161
-
```bash
162
-
make format
163
-
```
164
-
165
-
To run formatting for a library, run the same command from the relevant library directory:
166
-
167
-
```bash
168
-
cd libs/{LIBRARY}
169
-
make format
170
-
```
171
-
172
-
Additionally, you can run the formatter only on the files that have been modified in your current branch as compared to the master branch using the format_diff command:
173
-
174
-
```bash
175
-
make format_diff
176
-
```
177
-
178
-
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.
179
-
180
-
#### Linting
181
-
182
-
Linting for this project is done via a combination of [ruff](https://docs.astral.sh/ruff/rules/) and [mypy](http://mypy-lang.org/).
183
-
184
-
To run linting for docs, cookbook and templates:
185
-
186
-
```bash
187
-
make lint
188
-
```
189
-
190
-
To run linting for a library, run the same command from the relevant library directory:
191
-
192
-
```bash
193
-
cd libs/{LIBRARY}
194
-
make lint
195
-
```
196
-
197
-
In addition, you can run the linter only on the files that have been modified in your current branch as compared to the master branch using the lint_diff command:
198
-
199
-
```bash
200
-
make lint_diff
201
-
```
202
-
203
-
This can be very helpful when you've made changes to only certain parts of the project and want to ensure your changes meet the linting standards without having to check the entire codebase.
204
-
205
-
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.
206
-
207
-
#### Spellcheck
208
-
209
-
Spellchecking for this project is done via [codespell](https://github.com/codespell-project/codespell).
210
-
Note that `codespell` finds common typos, so it could have false-positive (correctly spelled but rarely used) and false-negatives (not finding misspelled) words.
211
-
212
-
To check spelling for this project:
213
-
214
-
```bash
215
-
make spell_check
216
-
```
217
-
218
-
To fix spelling in place:
219
-
220
-
```bash
221
-
make spell_fix
222
-
```
223
-
224
-
If codespell is incorrectly flagging a word, you can skip spellcheck for that word by adding it to the codespell config in the `pyproject.toml` file.
Langchain relies heavily on optional dependencies to keep the Langchain package lightweight.
236
-
237
-
You only need to add a new dependency if a **unit test** relies on the package.
238
-
If your package is only required for **integration tests**, then you can skip these
239
-
steps and leave all pyproject.toml and poetry.lock files alone.
240
-
241
-
If you're adding a new dependency to Langchain, assume that it will be an optional dependency, and
242
-
that most users won't have it installed.
243
-
244
-
Users who do not have the dependency installed should be able to **import** your code without
245
-
any side effects (no warnings, no errors, no exceptions).
246
-
247
-
To introduce the dependency to the pyproject.toml file correctly, please do the following:
248
-
249
-
1. Add the dependency to the main group as an optional dependency
250
-
```bash
251
-
poetry add --optional [package_name]
252
-
```
253
-
2. Open pyproject.toml and add the dependency to the `extended_testing` extra
254
-
3. Relock the poetry file to update the extra.
255
-
```bash
256
-
poetry lock --no-update
257
-
```
258
-
4. Add a unit test that the very least attempts to import the new code. Ideally, the unit
259
-
test makes use of lightweight fixtures to test the logic of the code.
260
-
5. Please use the `@pytest.mark.requires(package_name)` decorator for any tests that require the dependency.
261
-
262
-
## Adding a Jupyter Notebook
263
-
264
-
If you are adding a Jupyter Notebook example, you'll want to install the optional `dev` dependencies.
265
-
266
-
To install dev dependencies:
267
-
268
-
```bash
269
-
poetry install --with dev
270
-
```
271
-
272
-
Launch a notebook:
273
-
274
-
```bash
275
-
poetry run jupyter notebook
276
-
```
277
-
278
-
When you run `poetry install`, the `langchain` package is installed as editable in the virtualenv, so your new logic can be imported into the notebook.
279
-
280
-
## Documentation
281
-
282
-
While the code is split between `langchain` and `langchain.experimental`, the documentation is one holistic thing.
283
-
This covers how to get started contributing to documentation.
284
-
285
-
From the top-level of this repo, install documentation dependencies:
286
-
287
-
```bash
288
-
poetry install
289
-
```
290
-
291
-
### Contribute Documentation
292
-
293
-
The docs directory contains Documentation and API Reference.
294
-
295
-
Documentation is built using [Docusaurus 2](https://docusaurus.io/).
296
-
297
-
API Reference are largely autogenerated by [sphinx](https://www.sphinx-doc.org/en/master/) from the code.
298
-
For that reason, we ask that you add good documentation to all classes and methods.
299
-
300
-
Similar to linting, we recognize documentation 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.
301
-
302
-
### Build Documentation Locally
303
-
304
-
In the following commands, the prefix `api_` indicates that those are operations for the API Reference.
305
-
306
-
Before building the documentation, it is always a good idea to clean the build directory:
307
-
308
-
```bash
309
-
make docs_clean
310
-
make api_docs_clean
311
-
```
312
-
313
-
Next, you can build the documentation as outlined below:
314
-
315
-
```bash
316
-
make docs_build
317
-
make api_docs_build
318
-
```
319
-
320
-
Finally, run the link checker to ensure all links are valid:
321
-
322
-
```bash
323
-
make docs_linkcheck
324
-
make api_docs_linkcheck
325
-
```
326
-
327
-
### Verify Documentation changes
328
-
329
-
After pushing documentation changes to the repository, you can preview and verify that the changes are
330
-
what you wanted by clicking the `View deployment` or `Visit Preview` buttons on the pull request `Conversation` page.
331
-
This will take you to a preview of the documentation changes.
332
-
This preview is created by [Vercel](https://vercel.com/docs/getting-started-with-vercel).
333
-
334
-
## 📕 Releases & Versioning
335
-
336
-
As of now, LangChain has an ad hoc release process: releases are cut with high frequency by
337
-
a maintainer and published to [PyPI](https://pypi.org/).
338
-
The different packages are versioned slightly differently.
339
-
340
-
### `langchain-core`
341
-
342
-
`langchain-core` is currently on version `0.1.x`.
343
-
344
-
As `langchain-core` contains the base abstractions and runtime for the whole LangChain ecosystem, we will communicate any breaking changes with advance notice and version bumps. The exception for this is anything in `langchain_core.beta`. The reason for `langchain_core.beta` is that given the rate of change of the field, being able to move quickly is still a priority, and this module is our attempt to do so.
345
-
346
-
Minor version increases will occur for:
347
-
348
-
- Breaking changes for any public interfaces NOT in `langchain_core.beta`
349
-
350
-
Patch version increases will occur for:
351
-
352
-
- Bug fixes
353
-
- New features
354
-
- Any changes to private interfaces
355
-
- Any changes to `langchain_core.beta`
356
-
357
-
### `langchain`
358
-
359
-
`langchain` is currently on version `0.0.x`
360
-
361
-
All changes will be accompanied by a patch version increase. Any changes to public interfaces are nearly always done in a backwards compatible way and will be communicated ahead of time when they are not backwards compatible.
362
-
363
-
We are targeting January 2024 for a release of `langchain` v0.1, at which point `langchain` will adopt the same versioning policy as `langchain-core`.
364
-
365
-
### `langchain-community`
366
-
367
-
`langchain-community` is currently on version `0.0.x`
368
-
369
-
All changes will be accompanied by a patch version increase.
370
-
371
-
### `langchain-experimental`
372
-
373
-
`langchain-experimental` is currently on version `0.0.x`
374
-
375
-
All changes will be accompanied by a patch version increase.
376
-
377
-
## 🌟 Recognition
43
+
### Contributor Documentation
378
44
379
-
If your contribution has made its way into a release, we will want to give you credit on Twitter (only if you want though)!
380
-
If you have a Twitter account you would like us to mention, please let us know in the PR or through another means.
45
+
To learn about how to contribute, please follow the [guides here](https://python.langchain.com/docs/contributing/)
Copy file name to clipboardExpand all lines: .github/ISSUE_TEMPLATE/feature-request.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -27,4 +27,4 @@ body:
27
27
attributes:
28
28
label: Your contribution
29
29
description: |
30
-
Is there any way that you could help, e.g. by submitting a PR? Make sure to read the CONTRIBUTING.MD [readme](https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md)
30
+
Is there any way that you could help, e.g. by submitting a PR? Make sure to read the [Contributing Guide](https://python.langchain.com/docs/contributing/)
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -105,7 +105,7 @@ Please see [here](https://python.langchain.com) for full documentation, which in
105
105
106
106
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.
107
107
108
-
For detailed information on how to contribute, see [here](.github/CONTRIBUTING.md).
108
+
For detailed information on how to contribute, see [here](https://python.langchain.com/docs/contributing/).
0 commit comments