Skip to content

Commit 771a29c

Browse files
authored
chore: add initial toolbox-core package (#102)
* added base sdk files * add license headers * add test deps * Update sync-repo-settings.yaml * lint * rename test file * lint
1 parent ac43090 commit 771a29c

File tree

13 files changed

+302
-1
lines changed

13 files changed

+302
-1
lines changed

.github/sync-repo-settings.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ branchProtectionRules:
3535
- "langchain-python-sdk-pr-py311 (toolbox-testing-438616)"
3636
- "langchain-python-sdk-pr-py310 (toolbox-testing-438616)"
3737
- "langchain-python-sdk-pr-py39 (toolbox-testing-438616)"
38+
- "core-python-sdk-pr-py313 (toolbox-testing-438616)"
3839
requiredApprovingReviewCount: 1
3940
requiresCodeOwnerReviews: true
4041
requiresStrictStatusChecks: true
4142

4243
# Set team access
4344
permissionRules:
4445
- team: senseai-eco
45-
permission: admin
46+
permission: admin
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: core
16+
on:
17+
pull_request:
18+
paths:
19+
- 'packages/toolbox-core/**'
20+
- '!packages/toolbox-core/**/*.md'
21+
pull_request_target:
22+
types: [labeled]
23+
24+
# Declare default permissions as read only.
25+
permissions: read-all
26+
27+
jobs:
28+
lint:
29+
if: "${{ github.event.action != 'labeled' || github.event.label.name == 'tests: run' }}"
30+
name: lint
31+
runs-on: ubuntu-latest
32+
concurrency:
33+
group: ${{ github.workflow }}-${{ github.ref }}
34+
cancel-in-progress: true
35+
defaults:
36+
run:
37+
working-directory: ./packages/toolbox-core
38+
permissions:
39+
contents: 'read'
40+
issues: 'write'
41+
pull-requests: 'write'
42+
steps:
43+
- name: Remove PR Label
44+
if: "${{ github.event.action == 'labeled' && github.event.label.name == 'tests: run' }}"
45+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
46+
with:
47+
github-token: ${{ secrets.GITHUB_TOKEN }}
48+
script: |
49+
try {
50+
await github.rest.issues.removeLabel({
51+
name: 'tests: run',
52+
owner: context.repo.owner,
53+
repo: context.repo.repo,
54+
issue_number: context.payload.pull_request.number
55+
});
56+
} catch (e) {
57+
console.log('Failed to remove label. Another job may have already removed it!');
58+
}
59+
- name: Checkout code
60+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
61+
with:
62+
ref: ${{ github.event.pull_request.head.sha }}
63+
repository: ${{ github.event.pull_request.head.repo.full_name }}
64+
token: ${{ secrets.GITHUB_TOKEN }}
65+
- name: Setup Python
66+
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
67+
with:
68+
python-version: "3.13"
69+
70+
- name: Install library requirements
71+
run: pip install -r requirements.txt
72+
73+
- name: Install test requirements
74+
run: pip install .[test]
75+
76+
- name: Run linters
77+
run: |
78+
black --check .
79+
isort --check .
80+
81+
- name: Run type-check
82+
env:
83+
MYPYPATH: './src'
84+
run: mypy --install-types --non-interactive --cache-dir=.mypy_cache/ -p toolbox_core

packages/toolbox-core/CHANGELOG.md

Whitespace-only changes.

packages/toolbox-core/DEVELOPER.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Development
2+
3+
Below are the details to set up a development environment and run tests.
4+
5+
## Install
6+
1. Clone the repository:
7+
TODO: Correct repo URL
8+
```bash
9+
git clone https://github.com/googleapis/genai-toolbox-langchain-python
10+
```
11+
1. Navigate to the package directory:
12+
```bash
13+
cd genai-toolbox-langchain-python/packages/toolbox-core
14+
```
15+
1. Install the package in editable mode, so changes are reflected without
16+
reinstall:
17+
```bash
18+
pip install -e .
19+
```
20+
1. Make code changes and contribute to the SDK's development.
21+
> [!TIP]
22+
> Using `-e` option allows you to make changes to the SDK code and have
23+
> those changes reflected immediately without reinstalling the package.
24+
25+
## Test
26+
1. Navigate to the package directory if needed:
27+
```bash
28+
cd genai-toolbox-langchain-python/packages/toolbox-core
29+
```
30+
1. Install the SDK and test dependencies:
31+
```bash
32+
pip install -e .[test]
33+
```
34+
1. Run tests and/or contribute to the SDK's development.
35+
36+
```bash
37+
pytest
38+
```

packages/toolbox-core/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# GenAI toolbox core
2+
# TODO: update readme
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
steps:
16+
- id: Install library requirements
17+
name: 'python:${_VERSION}'
18+
args:
19+
- install
20+
- '-r'
21+
- 'packages/toolbox-core/requirements.txt'
22+
- '--user'
23+
entrypoint: pip
24+
- id: Install test requirements
25+
name: 'python:${_VERSION}'
26+
args:
27+
- install
28+
- 'packages/toolbox-core[test]'
29+
- '--user'
30+
entrypoint: pip
31+
- id: Run integration tests
32+
name: 'python:${_VERSION}'
33+
env:
34+
- TOOLBOX_URL=$_TOOLBOX_URL
35+
- TOOLBOX_VERSION=$_TOOLBOX_VERSION
36+
- GOOGLE_CLOUD_PROJECT=$PROJECT_ID
37+
args:
38+
- '-c'
39+
- >-
40+
python -m pytest packages/toolbox-core/tests/
41+
entrypoint: /bin/bash
42+
options:
43+
logging: CLOUD_LOGGING_ONLY
44+
substitutions:
45+
_VERSION: '3.13'
46+
_TOOLBOX_VERSION: '0.2.1'

packages/toolbox-core/pyproject.toml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
[project]
2+
name = "toolbox-core"
3+
dynamic = ["version"]
4+
readme = "README.md"
5+
description = "Python Base SDK for interacting with the Toolbox service"
6+
license = {file = "LICENSE"}
7+
requires-python = ">=3.9"
8+
authors = [
9+
{name = "Google LLC", email = "[email protected]"}
10+
]
11+
12+
# TODO: Add deps
13+
#dependencies = [
14+
#]
15+
16+
classifiers = [
17+
"Intended Audience :: Developers",
18+
"License :: OSI Approved :: Apache Software License",
19+
"Programming Language :: Python",
20+
"Programming Language :: Python :: 3",
21+
"Programming Language :: Python :: 3.9",
22+
"Programming Language :: Python :: 3.10",
23+
"Programming Language :: Python :: 3.11",
24+
"Programming Language :: Python :: 3.12",
25+
]
26+
27+
# Tells setuptools that packages are under the 'src' directory
28+
[tool.setuptools]
29+
package-dir = {"" = "src"}
30+
31+
[tool.setuptools.dynamic]
32+
version = {attr = "toolbox_core.version.__version__"}
33+
34+
[project.urls]
35+
Homepage = "https://github.com/googleapis/genai-toolbox-langchain-python/blob/main/packages/toolbox-core"
36+
Repository = "https://github.com/googleapis/genai-toolbox-langchain-python.git"
37+
"Bug Tracker" = "https://github.com/googleapis/genai-toolbox-langchain-python/issues"
38+
Changelog = "https://github.com/googleapis/genai-toolbox-langchain-python/blob/main/packages/toolbox-core/CHANGELOG.md"
39+
40+
[project.optional-dependencies]
41+
test = [
42+
"black[jupyter]==25.1.0",
43+
"isort==6.0.1",
44+
"mypy==1.15.0",
45+
"pytest==8.3.5",
46+
]
47+
[build-system]
48+
requires = ["setuptools"]
49+
build-backend = "setuptools.build_meta"
50+
51+
[tool.black]
52+
target-version = ['py39']
53+
54+
[tool.isort]
55+
profile = "black"
56+
57+
[tool.mypy]
58+
python_version = "3.9"
59+
warn_unused_configs = true
60+
disallow_incomplete_defs = true

packages/toolbox-core/requirements.txt

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from .client import DummyClass
16+
17+
__all__ = ["DummyClass"]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
class DummyClass:
17+
def __init__(self):
18+
self.val = "dummy value"

0 commit comments

Comments
 (0)