Skip to content

Commit 218218a

Browse files
authored
Update Docs Contributing guide (#1363)
## Overview - Update README to point to https://docs.langchain.com/oss/python/contributing/documentation for contributing guidelines - Remove dupe content from README - Edit contributing guide - Remove language from docs.json ## Type of change **Type:** Update ## Related issues/PRs - Linear issue: https://linear.app/langchain/issue/DOC-423/add-contributing-guide, https://linear.app/langchain/issue/DOC-392/clarify-how-to-guides-section-in-contributing-documentation ## Checklist <!-- Put an 'x' in all boxes that apply --> - [x] I have read the [contributing guidelines](README.md) - [x] I have tested my changes locally using `docs dev` - [x] All code examples have been tested and work correctly - [ ] I have used **root relative** paths for internal links - [ ] I have updated navigation in `src/docs.json` if needed - I have gotten approval from the relevant reviewers - (Internal team members only / optional) I have created a preview deployment using the [Create Preview Branch workflow](https://github.com/langchain-ai/docs/actions/workflows/create-preview-branch.yml) ## Additional notes <!-- Any other information that would be helpful for reviewers -->
1 parent d3dc21a commit 218218a

File tree

12 files changed

+1579
-1670
lines changed

12 files changed

+1579
-1670
lines changed

README.md

Lines changed: 19 additions & 198 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,17 @@
1313
> * [`HTTP API Reference`](https://api.smith.langchain.com/redoc)
1414
> * [`JavaScript/TypeScript SDK reference`](https://docs.smith.langchain.com/reference/js)
1515
16+
---
17+
1618
**Table of contents:**
1719

1820
- [LangChain Docs](#langchain-docs)
19-
- [Repository structure](#repository-structure)
20-
- [`docs.langchain.com`](#docslangchaincom)
21-
- [`reference.langchain.com`](#referencelangchaincom)
22-
- [Contributing](#contributing)
23-
- [Set up a local dev environment](#set-up-a-local-dev-environment)
24-
- [Workflow](#workflow)
25-
- [Co-locate Python and JavaScript/TypeScript OSS content](#co-locate-python-and-javascripttypescript-oss-content)
26-
- [Localized content](#localized-content)
27-
- [Create a preview build](#create-a-preview-build)
28-
- [Quality checks](#quality-checks)
29-
- [Publish to prod](#publish-to-prod)
21+
- [Contribute](#contribute)
3022
- [Reference](#reference)
23+
- [Repository structure](#repository-structure)
24+
- [`docs.langchain.com`](#docslangchaincom)
25+
- [`reference.langchain.com`](#referencelangchaincom)
3126
- [File formats](#file-formats)
32-
- [Documentation syntax](#documentation-syntax)
3327
- [Available commands](#available-commands)
3428
- [Troubleshooting](#troubleshooting)
3529
- [`docs dev` not working / running](#docs-dev-not-working--running)
@@ -39,7 +33,16 @@
3933

4034
---
4135

42-
## Repository structure
36+
## Contribute
37+
38+
To contribute to LangChain documentation, follow the steps outlined in the [contributing guide](/oss/contributing/documentation). The contributing guide also explains our documentation types and their writing and quality standards.
39+
40+
> [!IMPORTANT]
41+
> For contributing to reference docs, see the `README.md` file in the `/reference/python` and `/reference/javascript` directories.
42+
43+
## Reference
44+
45+
### Repository structure
4346

4447
```text
4548
# --- docs.langchain.com ----------------------------------------------
@@ -63,7 +66,7 @@ reference/ # Reference docs build pipelines
6366
vercel.json # Vercel configuration/redirects
6467
```
6568

66-
### `docs.langchain.com`
69+
#### `docs.langchain.com`
6770

6871
The Mintlify docs pipeline is structured with `.mdx` source files in `/src` and build artifacts in `/build`. Mintlify deploys from the `/build` folder, which is generated by preprocessing logic.
6972

@@ -72,200 +75,21 @@ The Mintlify docs pipeline is structured with `.mdx` source files in `/src` and
7275
7376
The `/src/docs.json` file is used to configure the Mintlify site navigation and settings. Refer to the [Mintlify documentation](https://www.mintlify.com/docs/organize/navigation) for detailed syntax and component usage.
7477

75-
Documentation changes follow a PR [workflow](#workflow) where all tests must pass before merging.
78+
Documentation changes follow a PR workflow where all tests must pass before merging. See the [contributing guidelines](/oss/contributing/documentation) for more details.
7679

77-
### `reference.langchain.com`
80+
#### `reference.langchain.com`
7881

7982
Each language has its own build pipeline in `/reference/<language>`. Reference docs are built with a combination of automated docstring extraction and manually written content. Refer to the `README.md` in each folder for details on how to build and contribute.
8083

8184
Built files are stored in `/reference/dist/{LANGUAGE}`, which is then deployed to Vercel. The build process is triggered automatically on pushes to `main` and can also be triggered manually via the Vercel dashboard.
8285

83-
---
84-
85-
## Contributing
86-
87-
Before making any changes, we encourage you to read the LangChain [contributing guide](https://docs.langchain.com/oss/python/contributing/documentation) to understand our documentation types and their writing and quality standards.
88-
89-
> [!IMPORTANT]
90-
> The following steps refer to the [`docs.langchain.com`](https://docs.langchain.com) Mintlify documentation site. For contributing to reference docs, see the `README.md` file in the `/reference/python` and `/reference/javascript` directories.
91-
92-
### Set up a local dev environment
93-
94-
1. Clone this repo. Follow the steps outlined in [IDE_SETUP.md](./IDE_SETUP.md).
95-
2. Install `uv` from <https://docs.astral.sh/uv/> (if not already installed)
96-
3. Install `npm` from <https://nodejs.org/en/download/> (if not already installed)
97-
4. Create and activate a virtual environment:
98-
99-
```bash
100-
cd docs
101-
uv venv
102-
source .venv/bin/activate
103-
```
104-
105-
5. Install dependencies:
106-
107-
```bash
108-
uv sync --all-groups
109-
```
110-
111-
```bash
112-
npm i -g mint
113-
```
114-
115-
After install, you'll have access to the `docs` command:
116-
117-
```bash
118-
docs --help
119-
```
120-
121-
Common commands:
122-
123-
* `docs dev` - Start development mode with file watching and hot reload
124-
* `docs build` - Build documentation
125-
126-
See [Available commands](#available-commands) for more details.
127-
128-
### Workflow
129-
130-
> [!IMPORTANT]
131-
> * **Only edit files in `src/`** - The `build/` directory is automatically generated
132-
> * **Use Mintlify syntax** - See [Mintlify documentation](https://mintlify.com/docs) for formatting guidelines
133-
134-
1. Ensure your [dev environment is set up](#set-up-local-dev-environment) and that you have followed the steps in [IDE_SETUP.md](./IDE_SETUP.md) to configure your IDE/editor to automatically apply the correct settings.
135-
136-
2. Start development mode:
137-
138-
```bash
139-
docs dev
140-
```
141-
142-
This starts a development server with hot reload at <http://localhost:3000>.
143-
144-
3. Edit files in `src/`:
145-
* Make changes to markdown files, notebooks, or other documentation
146-
* The build system automatically detects changes and rebuilds affected files
147-
* If OSS content varies between Python and JavaScript/TypeScript, add content for [both in the same file](#co-locate-python-and-javascripttypescript-oss-content). Otherwise, content will be identical for both languages.
148-
* If [adding localized content](#localized-content), add content in the specific language directory (e.g.,`src/ko/` for Korean).
149-
150-
4. Use `docs dev` to [preview changes](#create-a-preview-build) locally with hot reload. Changes automatically appear in your browser at <http://localhost:3000>.
151-
152-
5. Iterate:
153-
* Continue editing and see changes reflected immediately.
154-
* The development server rebuilds only changed files for faster feedback.
155-
156-
6. Run the [quality checks](#quality-checks) to ensure your changes are valid.
157-
158-
7. [Publish to production](#publish-to-prod) (internal team members only).
159-
160-
### Co-locate Python and JavaScript/TypeScript OSS content
161-
162-
In the `/oss` directory, we have a custom syntax for co-locating Python and JavaScript/TypeScript content in the same file. Use the `:::python` and `:::js` code language fences to tag the content that is specific to that language and will generate two outputs (one for each language). These are closed with the `:::` fence.
163-
164-
For example, if you have a file in `/oss/concepts/foo.mdx`, you can use the following syntax to co-locate Python and JavaScript/TypeScript content:
165-
166-
```mdx
167-
:::python
168-
This is Python-specific content.
169-
:::
170-
171-
:::js
172-
This is JavaScript/TypeScript-specific content.
173-
:::
174-
```
175-
176-
This will generate two outputs (one for each language) at `/oss/python/concepts/foo.mdx` and `/oss/javascript/concepts/foo.mdx`. Each outputted page will need to be added to the `/src/docs.json` file to be included in the navigation.
177-
178-
### Localized content
179-
180-
> [!IMPORTANT]
181-
> Currently, the LangChain documentation is only available in English, but we are working to add support for other languages, thanks to our LangChain Ambassadors!
182-
183-
To add localized content (content in a specific language), place it in the corresponding language directory. Each language has its own directory named after its language code. For more information, refer to the [Mintlify documentation](https://www.mintlify.com/docs/organize/navigation#languages) for more details on localized content.
184-
185-
```text
186-
src/
187-
langsmith/ # English - LangSmith docs
188-
oss/ # English - LangChain, LangGraph, Deep Agents, and integrations docs
189-
...
190-
cn/ # Chinese (Simplified) - No content yet
191-
es/ # Spanish - No content yet
192-
ko/ # Korean - No content yet
193-
zh-Hant/ # Chinese (Traditional) - No content yet
194-
```
195-
196-
### Create a preview build
197-
198-
When you create or update a PR, a [preview branch/ID](https://github.com/langchain-ai/docs/actions/workflows/create-preview-branch.yml) is automatically generated for you. A comment will be left on the PR with the ID, which you can then use to generate a preview. You can also run this workflow manually if needed. Previews are useful for sharing work-in-progress changes with others.
199-
200-
1. Copy the preview branch's ID from the comment.
201-
2. In the [Mintlify dashboard](https://dashboard.mintlify.com/langchain-5e9cc07a/langchain-5e9cc07a?section=previews), click **Create preview deployment**.
202-
3. Enter the preview branch's ID.
203-
4. Click **Create deployment**.
204-
A **Manual update** will display in the **Previews** table.
205-
5. Select the preview and click **Visit** to view the preview build.
206-
207-
To redeploy the preview build, click **Redeploy** on the Mintlify dashboard.
208-
209-
210-
### Quality checks
211-
212-
Before submitting changes, ensure your code passes formatting and linting checks:
213-
214-
```bash
215-
# Check broken links
216-
make mint-broken-links
217-
218-
# Format code automatically
219-
make format
220-
221-
# Check for linting issues
222-
make lint
223-
224-
# Fix markdown issues
225-
make lint_md_fix
226-
227-
# Run tests to ensure your changes don't break existing functionality
228-
make test
229-
```
230-
231-
> [!IMPORTANT]
232-
> All pull requests are automatically checked by CI/CD.
233-
>
234-
> The same linting and formatting standards will be enforced, and PRs cannot be merged if these checks fail.
235-
236-
### Publish to prod
237-
238-
> [!IMPORTANT]
239-
> Only internal team members can publish to production.
240-
241-
Once your branch has been merged into `main`, you need to push the changes to `prod` for them to render on the live docs site. Use the [Publish documentation GH action](https://github.com/langchain-ai/docs/actions/workflows/publish.yml):
242-
243-
1. Go to [Publish documentation](https://github.com/langchain-ai/docs/actions/workflows/publish.yml).
244-
2. Click the **Run workflow** button.
245-
3. Select the **main** branch to deploy.
246-
4. Click **Run workflow**.
247-
248-
## Reference
249-
25086
### File formats
25187

25288
* **Markdown files** (`.md`, `.mdx`) - Standard documentation content
25389
* **Snippets** (`src/snippets/`) - Reusable MDX content that can be imported into multiple pages. **Important:** Snippets undergo special link preprocessing. When writing links in snippets, be careful about path segments.
25490
* **Jupyter notebooks** (`.ipynb`) - Converted to markdown during build, though **these are not recommended for new content!** Your PR will likely be rejected if you attempt to add a Jupyter notebook unless asked to by a maintainer.
25591
* **Assets** - Images and other files are copied to the build directory
25692

257-
### Documentation syntax
258-
259-
Our primary docs the [Mintlify](https://mintlify.com/docs) platform for docs generation. Key features include:
260-
261-
* **Frontmatter** - YAML metadata at the top of files
262-
* **Components** - Special Mintlify components for enhanced formatting
263-
* **Code blocks** - Syntax highlighting and copy functionality
264-
* **Navigation** - Automatic sidebar generation from file structure
265-
* **Code language fences** (only used in `/oss`) - Custom code language fences for Python and Javascript (`:::python` and `:::js`). Both are closed with the `:::` fence. These are used to tag content that is specific to that language and will generate two outputs (one for each language).
266-
267-
Refer to the [Mintlify documentation](https://mintlify.com/docs) for detailed syntax and component usage.
268-
26993
### Available commands
27094

27195
**Make commands:**
@@ -314,9 +138,6 @@ These can be used directly using the `Makefile` or via the `docs` CLI tool:
314138
* **`docs build`** - Build documentation files
315139
* `--watch` - Watch for file changes after building
316140

317-
318-
---
319-
320141
## Troubleshooting
321142

322143
### `docs dev` not working / running

reference/python/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,3 +546,49 @@ title: Chat models (Classic)
546546
```
547547

548548
---
549+
550+
## In-code documentation
551+
552+
### Language and style
553+
554+
> [!NOTE]
555+
> Use [Google-style docstrings](https://google.github.io/styleguide/pyguide.html) with complete type hints for all public functions.
556+
557+
Follow these standards for all documentation:
558+
559+
- **Voice**: Use second person ("you") for instructions
560+
- **Tense**: Use active voice and present tense
561+
- **Clarity**: Write clear, direct language for technical audiences
562+
- **Consistency**: Use consistent terminology throughout
563+
- **Conciseness**: Keep sentences concise while providing necessary context
564+
565+
### Code examples
566+
567+
> [!WARNING]
568+
> Always test code examples before publishing. Never include real API keys or secrets.
569+
570+
Requirements for code examples:
571+
572+
- **Completeness**: Include complete, runnable examples that users can copy and execute without errors
573+
- **Realism**: Use realistic data instead of placeholder values like "foo" or "example"
574+
- **Error handling**: Show proper error handling and edge case management
575+
- **Documentation**: Add explanatory comments for complex logic
576+
577+
Example of a well-documented function:
578+
579+
```python
580+
def filter_unknown_users(users: list[str], known_users: set[str]) -> list[str]:
581+
"""Filter out users that are not in the known users set.
582+
583+
Args:
584+
users: List of user identifiers to filter.
585+
known_users: Set of known/valid user identifiers.
586+
587+
Returns:
588+
List of users that are not in the known_users set.
589+
590+
Raises:
591+
ValueError: If users list contains invalid identifiers.
592+
"""
593+
return [user for user in users if user not in known_users]
594+
```

0 commit comments

Comments
 (0)