1
1
# Development
2
2
3
- Below are the details to set up a development environment and run tests.
3
+ Below are the details to set up a development environment and run tests for the
4
+ ` toolbox-langchain ` package.
5
+
6
+ ## Versioning
7
+
8
+ This library adheres to [ Semantic Versioning] ( http://semver.org/ ) . Releases are
9
+ automated using [ Release Please] ( https://github.com/googleapis/release-please ) ,
10
+ which analyzes commit messages to determine version bumps.
11
+
12
+ ## Processes
13
+
14
+ ### Conventional Commit Messages
15
+
16
+ This repository utilizes [ Conventional
17
+ Commits] ( https://www.conventionalcommits.org/ ) for structuring commit messages.
18
+ This standard is crucial for the automated release process managed by [ Release
19
+ Please] ( https://github.com/googleapis/release-please?tab=readme-ov-file#how-should-i-write-my-commits ) ,
20
+ which parses your Git history to create GitHub and PyPI releases.
4
21
5
22
## Install
6
23
1 . Clone the repository:
@@ -18,20 +35,134 @@ Below are the details to set up a development environment and run tests.
18
35
` ` `
19
36
1. Make code changes and contribute to the SDK' s development.
20
37
> [!TIP]
21
- > Using `-e` option allows you to make changes to the SDK code and have
22
- > those changes reflected immediately without reinstalling the package.
38
+ > Using `-e` option allows you to make changes to the SDK code and have those
39
+ > changes reflected immediately without reinstalling the package.
40
+
41
+ ## Testing
42
+
43
+ ### Local Tests
44
+
45
+ To run tests locally, ensure you have the necessary dependencies and a running
46
+ Toolbox service.
23
47
24
- ## Test
25
48
1. Navigate to the package directory if needed:
26
49
```bash
27
50
cd mcp-toolbox-sdk-python/packages/toolbox-langchain
28
51
```
29
- 1. Install the SDK and test dependencies:
52
+ 1. Install the SDK and its test dependencies:
30
53
```bash
31
54
pip install -e .[test]
32
55
```
56
+ 1. Ensure your [Toolbox
57
+ service](https://github.com/googleapis/genai-toolbox?tab=readme-ov-file#getting-started)
58
+ is running and accessible (e.g., at `http://localhost:5000`).
33
59
1. Run tests and/or contribute to the SDK' s development.
34
60
35
61
` ` ` bash
36
62
pytest
37
63
` ` `
64
+
65
+ > [! TIP]
66
+ > You can run specific test files or modules:
67
+ > ` ` ` bash
68
+ > pytest tests/test_client.py
69
+ > ` ` `
70
+
71
+ # ### Authentication in Local Tests
72
+ Integration tests involving authentication rely on environment variables for
73
+ ` TOOLBOX_URL` , ` TOOLBOX_VERSION` , and ` GOOGLE_CLOUD_PROJECT` . For local runs,
74
+ you might need to mock or set up dummy authentication tokens. These tests
75
+ leverage authentication methods from ` toolbox-core` . Refer to
76
+ ` packages/toolbox-core/tests/conftest.py` for how authentication tokens
77
+ (` auth_token1` , ` auth_token2` ) are generated and used in the test environment,
78
+ and ` packages/toolbox-core/src/toolbox_core/auth_methods.py` for helper
79
+ functions for obtaining Google ID tokens.
80
+
81
+ # ## Code Coverage
82
+
83
+ Tests are configured with ` pytest-cov` to measure code coverage. Ensure your
84
+ changes maintain or improve coverage.
85
+
86
+ # ## Linting and Type Checking
87
+
88
+ The repository enforces code style and type adherence using ` black` , ` isort` ,
89
+ and ` mypy` . To run these checks locally:
90
+
91
+ 1. Install test dependencies as described in " Local Tests" section
92
+ [above](# local-tests).
93
+ 1. Run the linters and type checker from the ` packages/toolbox-langchain`
94
+ directory:
95
+ ` ` ` bash
96
+ black --check .
97
+ isort --check .
98
+ MYPYPATH=' ./src' mypy --install-types --non-interactive --cache-dir=.mypy_cache/ -p toolbox_langchain
99
+ ` ` `
100
+
101
+ # ## CI and GitHub Actions
102
+
103
+ This repository uses GitHub Actions for CI. Linting, type-checking, Cloud Build
104
+ triggers, and integration tests are run automatically on pull requests.
105
+
106
+ * ** Linting and Type Checking:** Configured in ` lint-toolbox-langchain.yaml` .
107
+ * ** Integration Tests:** Executed via Cloud Build, defined in
108
+ ` integration.cloudbuild.yaml` . These tests interact with a live Toolbox
109
+ service instance.
110
+
111
+ ** Triggering Tests on GitHub:** For external contributions, tests can be
112
+ triggered manually by commenting ` /gcbrun` on a pull request. The ` tests: run`
113
+ label can also be used to signal the CI system to run tests.
114
+
115
+ # # Contribution Process
116
+
117
+ We welcome contributions to this project! Please review the following guidelines
118
+ before submitting.
119
+
120
+ # ## Contributor License Agreement (CLA)
121
+
122
+ Contributions to this project must be accompanied by a [Contributor License
123
+ Agreement](https://cla.developers.google.com/about) (CLA). This grants Google
124
+ permission to use and redistribute your contributions.
125
+
126
+ # ## Code Reviews
127
+
128
+ All submissions, including those by project members, require review. We use
129
+ [GitHub pull requests](https://help.github.com/articles/about-pull-requests/)
130
+ for this purpose.
131
+
132
+ * Ensure your pull request clearly describes the changes you are making.
133
+ * Ideally, your pull request should include code, tests, and updated
134
+ documentation (if applicable) in a single submission.
135
+ * Code style and linting checks will run automatically. Please ensure they pass
136
+ before requesting a review.
137
+ * A reviewer from the ` @googleapis/senseai-eco` team will typically review your
138
+ PR within 2-5 days and may request changes or approve it.
139
+
140
+ # # Releases & Pipelines
141
+
142
+ This project uses ` release-please` for automated releases.
143
+
144
+ * ** Release Automation:** [Release
145
+ Please](https://github.com/googleapis/mcp-toolbox-sdk-python/blob/main/.github/release-please.yml)
146
+ is configured to manage releases based on [Conventional
147
+ Commits](# conventional-commit-messages). It creates release pull requests and
148
+ tags.
149
+ * ** Published Packages:** The release pipeline produces Python packages,
150
+ including:
151
+ * [` toolbox-core` ](https://pypi.org/project/toolbox-core/)
152
+ * [` toolbox-langchain` ](https://pypi.org/project/toolbox-langchain/)
153
+ * [` toolbox-llamaindex` ](https://pypi.org/project/toolbox-llamaindex/)
154
+ * ** Release Trigger:** Releases are typically triggered automatically based on
155
+ merges to the ` main` branch, as configured in ` release-trigger.yml` .
156
+
157
+ # # Support
158
+
159
+ If you encounter issues or have questions, please check the existing [GitHub
160
+ Issues](https://github.com/googleapis/genai-toolbox/issues) for the main Toolbox
161
+ project. If your issue is specific to one of the SDKs, please look for existing
162
+ issues [here](https://github.com/googleapis/mcp-toolbox-sdk-python/issues) or
163
+ open a new issue in this repository.
164
+
165
+ # ## Reporting Security Issues
166
+
167
+ For security-related concerns, please report them via
168
+ [g.co/vulnz](https://g.co/vulnz).
0 commit comments