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
**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]>
Copy file name to clipboardExpand all lines: docs/docs/contributing/how_to/code/setup.mdx
+66Lines changed: 66 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,14 @@ This project utilizes [uv](https://docs.astral.sh/uv/) v0.5+ as a dependency man
9
9
10
10
Install `uv`: **[documentation on how to install it](https://docs.astral.sh/uv/getting-started/installation/)**.
11
11
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
+
12
20
## Different packages
13
21
14
22
This repository contains multiple packages:
@@ -48,7 +56,11 @@ uv sync
48
56
Then verify dependency installation:
49
57
50
58
```bash
59
+
# If you have `make` installed:
51
60
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
52
64
```
53
65
54
66
## Testing
@@ -61,7 +73,11 @@ If you add new logic, please add a unit test.
61
73
To run unit tests:
62
74
63
75
```bash
76
+
# If you have `make` installed:
64
77
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
65
81
```
66
82
67
83
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
72
88
73
89
```bash
74
90
cd libs/core
91
+
92
+
# If you have `make` installed:
75
93
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
76
97
```
77
98
78
99
## Formatting and linting
@@ -86,20 +107,37 @@ Formatting for this project is done via [ruff](https://docs.astral.sh/ruff/rules
86
107
To run formatting for docs, cookbook and templates:
87
108
88
109
```bash
110
+
# If you have `make` installed:
89
111
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 .
90
116
```
91
117
92
118
To run formatting for a library, run the same command from the relevant library directory:
93
119
94
120
```bash
95
121
cd libs/{LIBRARY}
122
+
123
+
# If you have `make` installed:
96
124
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 .
97
129
```
98
130
99
131
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:
100
132
101
133
```bash
134
+
# If you have `make` installed:
102
135
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
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
111
149
To run linting for docs, cookbook and templates:
112
150
113
151
```bash
152
+
# If you have `make` installed:
114
153
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
115
159
```
116
160
117
161
To run linting for a library, run the same command from the relevant library directory:
118
162
119
163
```bash
120
164
cd libs/{LIBRARY}
165
+
166
+
# If you have `make` installed:
121
167
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
122
173
```
123
174
124
175
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:
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
139
197
To check spelling for this project:
140
198
141
199
```bash
200
+
# If you have `make` installed:
142
201
make spell_check
202
+
203
+
# If you don't have `make` (Windows alternative):
204
+
uv run --all-groups codespell --toml pyproject.toml
143
205
```
144
206
145
207
To fix spelling in place:
146
208
147
209
```bash
210
+
# If you have `make` installed:
148
211
make spell_fix
212
+
213
+
# If you don't have `make` (Windows alternative):
214
+
uv run --all-groups codespell --toml pyproject.toml -w
149
215
```
150
216
151
217
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