Skip to content

Commit 4011257

Browse files
pranauwwmdrxy
andauthored
docs: add Windows-specific setup instructions (#32399)
**Description:** This PR improves the contribution setup guide by adding comprehensive Windows-specific instructions. The changes address a common pain point for Windows contributors who don't have `make` installed by default, making the LangChain contribution process more accessible across different operating systems. The main improvements include: - Added a dedicated "Windows Users" section with multiple installation options for `make` (Chocolatey, Scoop, WSL) - Provided direct `uv` commands as alternatives to all `make` commands throughout the setup guide - Included Windows-specific instructions for testing, formatting, linting, and spellchecking - Enhanced the documentation to be more inclusive for Windows developers This change makes it easier for Windows users to contribute to LangChain without requiring additional tool installation, while maintaining the existing workflow for users who already have `make` available. **Issue:** This addresses the common barrier Windows users face when trying to contribute to LangChain due to missing `make` commands. **Dependencies:** None required - this is purely a documentation improvement. --------- Co-authored-by: Mason Daugherty <[email protected]>
1 parent 9de0892 commit 4011257

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

docs/docs/contributing/how_to/code/setup.mdx

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ This project utilizes [uv](https://docs.astral.sh/uv/) v0.5+ as a dependency man
99

1010
Install `uv`: **[documentation on how to install it](https://docs.astral.sh/uv/getting-started/installation/)**.
1111

12+
### Windows Users
13+
14+
If you're on Windows and don't have `make` installed, you can install it via:
15+
- **Option 1**: Install via [Chocolatey](https://chocolatey.org/): `choco install make`
16+
- **Option 2**: Install via [Scoop](https://scoop.sh/): `scoop install make`
17+
- **Option 3**: Use [Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/)
18+
- **Option 4**: Use the direct `uv` commands shown in the sections below
19+
1220
## Different packages
1321

1422
This repository contains multiple packages:
@@ -48,7 +56,11 @@ uv sync
4856
Then verify dependency installation:
4957

5058
```bash
59+
# If you have `make` installed:
5160
make test
61+
62+
# If you don't have `make` (Windows alternative):
63+
uv run --group test pytest -n auto --disable-socket --allow-unix-socket tests/unit_tests
5264
```
5365

5466
## Testing
@@ -61,7 +73,11 @@ If you add new logic, please add a unit test.
6173
To run unit tests:
6274

6375
```bash
76+
# If you have `make` installed:
6477
make test
78+
79+
# If you don't have make (Windows alternative):
80+
uv run --group test pytest -n auto --disable-socket --allow-unix-socket tests/unit_tests
6581
```
6682

6783
There are also [integration tests and code-coverage](../testing.mdx) available.
@@ -72,7 +88,12 @@ If you are only developing `langchain_core`, you can simply install the dependen
7288

7389
```bash
7490
cd libs/core
91+
92+
# If you have `make` installed:
7593
make test
94+
95+
# If you don't have `make` (Windows alternative):
96+
uv run --group test pytest -n auto --disable-socket --allow-unix-socket tests/unit_tests
7697
```
7798

7899
## Formatting and linting
@@ -86,20 +107,37 @@ Formatting for this project is done via [ruff](https://docs.astral.sh/ruff/rules
86107
To run formatting for docs, cookbook and templates:
87108

88109
```bash
110+
# If you have `make` installed:
89111
make format
112+
113+
# If you don't have make (Windows alternative):
114+
uv run --all-groups ruff format .
115+
uv run --all-groups ruff check --fix .
90116
```
91117

92118
To run formatting for a library, run the same command from the relevant library directory:
93119

94120
```bash
95121
cd libs/{LIBRARY}
122+
123+
# If you have `make` installed:
96124
make format
125+
126+
# If you don't have make (Windows alternative):
127+
uv run --all-groups ruff format .
128+
uv run --all-groups ruff check --fix .
97129
```
98130

99131
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:
100132

101133
```bash
134+
# If you have `make` installed:
102135
make format_diff
136+
137+
# If you don't have `make` (Windows alternative):
138+
# First, get the list of modified files:
139+
git diff --relative=libs/langchain --name-only --diff-filter=d master | grep -E '\.py$$|\.ipynb$$' | xargs uv run --all-groups ruff format
140+
git diff --relative=libs/langchain --name-only --diff-filter=d master | grep -E '\.py$$|\.ipynb$$' | xargs uv run --all-groups ruff check --fix
103141
```
104142

105143
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.
@@ -111,20 +149,40 @@ Linting for this project is done via a combination of [ruff](https://docs.astral
111149
To run linting for docs, cookbook and templates:
112150

113151
```bash
152+
# If you have `make` installed:
114153
make lint
154+
155+
# If you don't have `make` (Windows alternative):
156+
uv run --all-groups ruff check .
157+
uv run --all-groups ruff format . --diff
158+
uv run --all-groups mypy . --cache-dir .mypy_cache
115159
```
116160

117161
To run linting for a library, run the same command from the relevant library directory:
118162

119163
```bash
120164
cd libs/{LIBRARY}
165+
166+
# If you have `make` installed:
121167
make lint
168+
169+
# If you don't have `make` (Windows alternative):
170+
uv run --all-groups ruff check .
171+
uv run --all-groups ruff format . --diff
172+
uv run --all-groups mypy . --cache-dir .mypy_cache
122173
```
123174

124175
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:
125176

126177
```bash
178+
# If you have `make` installed:
127179
make lint_diff
180+
181+
# If you don't have `make` (Windows alternative):
182+
# First, get the list of modified files:
183+
git diff --relative=libs/langchain --name-only --diff-filter=d master | grep -E '\.py$$|\.ipynb$$' | xargs uv run --all-groups ruff check
184+
git diff --relative=libs/langchain --name-only --diff-filter=d master | grep -E '\.py$$|\.ipynb$$' | xargs uv run --all-groups ruff format --diff
185+
git diff --relative=libs/langchain --name-only --diff-filter=d master | grep -E '\.py$$|\.ipynb$$' | xargs uv run --all-groups mypy --cache-dir .mypy_cache
128186
```
129187

130188
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.
@@ -139,13 +197,21 @@ Note that `codespell` finds common typos, so it could have false-positive (corre
139197
To check spelling for this project:
140198

141199
```bash
200+
# If you have `make` installed:
142201
make spell_check
202+
203+
# If you don't have `make` (Windows alternative):
204+
uv run --all-groups codespell --toml pyproject.toml
143205
```
144206

145207
To fix spelling in place:
146208

147209
```bash
210+
# If you have `make` installed:
148211
make spell_fix
212+
213+
# If you don't have `make` (Windows alternative):
214+
uv run --all-groups codespell --toml pyproject.toml -w
149215
```
150216

151217
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.

0 commit comments

Comments
 (0)