Skip to content

Commit 6531e44

Browse files
authored
chore: update agent files, move files (#781)
1 parent 4af20ba commit 6531e44

File tree

6 files changed

+524
-257
lines changed

6 files changed

+524
-257
lines changed
File renamed without changes.

.github/CONTRIBUTING.md

Lines changed: 187 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,189 @@
1-
# Contributing to LangChain
1+
# Contribute Code
22

3-
Hi there! Thank you for even being interested in contributing to LangChain.
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.
3+
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.
54

6-
To learn how to contribute to LangChain, please follow the [contribution guide here](https://docs.langchain.com/oss/python/contributing).
5+
For detailed information on how to contribute, see the [Contributing Guide](https://docs.langchain.com/oss/python/contributing/overview).
6+
7+
---
8+
9+
To contribute to this project, please follow the ["fork and pull request"](https://docs.github.com/en/get-started/quickstart/contributing-to-projects) workflow. Please do not try to push directly to this repo.
10+
11+
Note related issues and tag relevant maintainers in pull requests.
12+
13+
Pull requests cannot land without passing the formatting, linting, and testing checks first. See [Testing](#testing) and
14+
[Formatting and Linting](#formatting-and-linting) for how to run these checks locally.
15+
16+
It's essential that we maintain great documentation and testing. Add or update relevant unit or integration test when possible.
17+
These live in `tests/unit_tests` and `tests/integration_tests`. Example notebooks and documentation lives in `/docs` inside the
18+
[LangChain repo](https://github.com/langchain-ai/langchain/tree/master/docs).
19+
20+
We are a small, progress-oriented team. If there's something you'd like to add or change, opening a pull request is the
21+
best way to get our attention.
22+
23+
## 🚀 Quick Start
24+
25+
This quick start guide explains how to setup the repository locally for development.
26+
27+
### Dependency Management: uv and other env/dependency managers
28+
29+
This project utilizes [uv](https://docs.astral.sh/uv/) as a dependency manager.
30+
31+
❗Note: *Before installing uv*, if you use `Conda`, create and activate a new Conda env (e.g. `conda create -n langchain python=3.10`)
32+
33+
Install uv: **[documentation on how to install it](https://docs.astral.sh/uv/getting-started/installation/)**.
34+
35+
The instructions here assume that you run all commands from the `libs/aws` directory.
36+
37+
```bash
38+
cd libs/aws
39+
```
40+
41+
### Install for development
42+
43+
```bash
44+
uv sync --group lint --group typing --group test --group test_integration --group dev
45+
```
46+
47+
Then verify the installation.
48+
49+
```bash
50+
make test
51+
```
52+
53+
If during installation you encounter any issues with dependency installation, please make sure you are using the latest version of uv.
54+
If you continue to see installation issues, please file an issue with the details of your environment.
55+
56+
### Testing
57+
58+
Unit tests cover modular logic that does not require calls to outside APIs.
59+
If you add new logic, please add a unit test.
60+
61+
To run unit tests:
62+
63+
```bash
64+
make test
65+
```
66+
67+
Integration tests cover the end-to-end service calls as much as possible.
68+
However, in certain cases this might not be practical, so you can mock the
69+
service response for these tests. There are examples of this in the repo,
70+
that can help you write your own tests. If you have suggestions to improve
71+
this, please get in touch with us.
72+
73+
To run the integration tests:
74+
75+
```bash
76+
make integration_test
77+
```
78+
79+
### Code Coverage
80+
81+
This project uses [coverage.py](https://github.com/nedbat/coveragepy) to track code coverage during testing. Coverage reports help identify untested code paths and ensure comprehensive test coverage.
82+
83+
#### Running Tests with Coverage
84+
85+
To run unit tests with coverage:
86+
87+
```bash
88+
make coverage_tests
89+
```
90+
91+
To run all integration tests with coverage:
92+
93+
```bash
94+
make coverage_integration_tests
95+
```
96+
97+
To run a specific integration test with coverage:
98+
99+
```bash
100+
make coverage_integration_test TEST_FILE=tests/integration_tests/specific_test.py
101+
```
102+
103+
#### Viewing Coverage Reports
104+
105+
After running tests with coverage, you can view the results in several ways:
106+
107+
**Terminal Report:**
108+
109+
```bash
110+
make coverage_report
111+
```
112+
113+
**HTML Report:**
114+
115+
```bash
116+
make coverage_html
117+
```
118+
119+
The HTML report will be generated in the `htmlcov/` directory. Open `htmlcov/index.html` in your browser to view detailed line-by-line coverage analysis.
120+
121+
#### Coverage Configuration
122+
123+
Coverage settings are configured in `pyproject.toml`:
124+
125+
- **Source tracking**: Only code in `langchain_aws/` is measured
126+
- **Branch coverage**: Tracks both line and branch coverage for comprehensive analysis
127+
- **Exclusions**: Test files and common patterns (like `pragma: no cover`) are excluded
128+
- **Reports**: Both terminal and HTML reports show missing lines and coverage percentages
129+
130+
#### Coverage Best Practices
131+
132+
- Aim for high coverage on new code you add
133+
- Use coverage reports to identify untested edge cases
134+
- Add tests for uncovered lines when practical
135+
- Use `# pragma: no cover` sparingly for truly untestable code (like debug statements)
136+
137+
### Formatting and Linting
138+
139+
Formatting ensures that the code in this repo has consistent style so that the
140+
code looks more presentable and readable. It corrects these errors when you run
141+
the formatting command. Linting finds and highlights the code errors and helps
142+
avoid coding practices that can lead to errors.
143+
144+
Run both of these locally before submitting a PR. The CI scripts will run these
145+
when you submit a PR, and you won't be able to merge changes without fixing
146+
issues identified by the CI.
147+
148+
#### Code Formatting
149+
150+
Formatting for this project is done via [ruff](https://docs.astral.sh/ruff/rules/).
151+
152+
To run format:
153+
154+
```bash
155+
make format
156+
```
157+
158+
Additionally, you can run the formatter only on the files that have been modified in your current branch
159+
as compared to the master branch using the `format_diff` command. This is especially useful when you have
160+
made changes to a subset of the project and want to ensure your changes are properly formatted without
161+
affecting the rest of the codebase.
162+
163+
```bash
164+
make format_diff
165+
```
166+
167+
#### Linting
168+
169+
Linting for this project is done via a combination of [ruff](https://docs.astral.sh/ruff/rules/) and [mypy](http://mypy-lang.org/).
170+
171+
To run lint:
172+
173+
```bash
174+
make lint
175+
```
176+
177+
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.
178+
179+
```bash
180+
make lint_diff
181+
```
182+
183+
In addition, you can run the linter only tests.
184+
185+
```bash
186+
make lint_tests
187+
```
188+
189+
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.

0 commit comments

Comments
 (0)