Skip to content

Commit f9d6b9f

Browse files
authored
Merge branch 'strands-agents:main' into main
2 parents 1638f21 + 8ffe24b commit f9d6b9f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3472
-1646
lines changed

.github/workflows/pr-and-push.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Pull Request and Push Action
2+
3+
on:
4+
pull_request: # Safer than pull_request_target for untrusted code
5+
branches: [ main ]
6+
types: [opened, synchronize, reopened, ready_for_review, review_requested, review_request_removed]
7+
push:
8+
branches: [ main ] # Also run on direct pushes to main
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
call-test-lint:
15+
uses: ./.github/workflows/test-lint.yml
16+
permissions:
17+
contents: read
18+
with:
19+
ref: ${{ github.event.pull_request.head.sha }}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Publish Python Package
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
call-test-lint:
10+
uses: ./.github/workflows/test-lint.yml
11+
with:
12+
ref: ${{ github.event.release.target_commitish }}
13+
14+
build:
15+
name: Build distribution 📦
16+
permissions:
17+
contents: read
18+
needs:
19+
- call-test-lint
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
persist-credentials: false
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: '3.10'
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install hatch twine
36+
37+
- name: Validate version
38+
run: |
39+
version=$(hatch version)
40+
if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
41+
echo "Valid version format"
42+
exit 0
43+
else
44+
echo "Invalid version format"
45+
exit 1
46+
fi
47+
48+
- name: Build
49+
run: |
50+
hatch build
51+
52+
- name: Store the distribution packages
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: python-package-distributions
56+
path: dist/
57+
58+
deploy:
59+
name: Upload release to PyPI
60+
needs:
61+
- build
62+
runs-on: ubuntu-latest
63+
64+
# environment is used by PyPI Trusted Publisher and is strongly encouraged
65+
# https://docs.pypi.org/trusted-publishers/adding-a-publisher/
66+
environment:
67+
name: pypi
68+
url: https://pypi.org/p/strands-agents
69+
permissions:
70+
# IMPORTANT: this permission is mandatory for Trusted Publishing
71+
id-token: write
72+
73+
steps:
74+
- name: Download all the dists
75+
uses: actions/download-artifact@v4
76+
with:
77+
name: python-package-distributions
78+
path: dist/
79+
- name: Publish distribution 📦 to PyPI
80+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test-lint-pr.yml

Lines changed: 0 additions & 139 deletions
This file was deleted.

.github/workflows/test-lint.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Test and Lint
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
ref:
7+
required: true
8+
type: string
9+
10+
jobs:
11+
unit-test:
12+
name: Unit Tests - Python ${{ matrix.python-version }} - ${{ matrix.os-name }}
13+
permissions:
14+
contents: read
15+
strategy:
16+
matrix:
17+
include:
18+
# Linux
19+
- os: ubuntu-latest
20+
os-name: 'linux'
21+
python-version: "3.10"
22+
- os: ubuntu-latest
23+
os-name: 'linux'
24+
python-version: "3.11"
25+
- os: ubuntu-latest
26+
os-name: 'linux'
27+
python-version: "3.12"
28+
- os: ubuntu-latest
29+
os-name: 'linux'
30+
python-version: "3.13"
31+
# Windows
32+
- os: windows-latest
33+
os-name: 'windows'
34+
python-version: "3.10"
35+
- os: windows-latest
36+
os-name: 'windows'
37+
python-version: "3.11"
38+
- os: windows-latest
39+
os-name: 'windows'
40+
python-version: "3.12"
41+
- os: windows-latest
42+
os-name: 'windows'
43+
python-version: "3.13"
44+
# MacOS - latest only; not enough runners for macOS
45+
- os: macos-latest
46+
os-name: 'macOS'
47+
python-version: "3.13"
48+
fail-fast: true
49+
runs-on: ${{ matrix.os }}
50+
env:
51+
LOG_LEVEL: DEBUG
52+
steps:
53+
- name: Checkout code
54+
uses: actions/checkout@v4
55+
with:
56+
ref: ${{ inputs.ref }} # Explicitly define which commit to check out
57+
persist-credentials: false # Don't persist credentials for subsequent actions
58+
- name: Set up Python
59+
uses: actions/setup-python@v5
60+
with:
61+
python-version: ${{ matrix.python-version }}
62+
- name: Install dependencies
63+
run: |
64+
pip install --no-cache-dir hatch
65+
- name: Run Unit tests
66+
id: tests
67+
run: hatch test tests --cover
68+
continue-on-error: false
69+
lint:
70+
name: Lint
71+
runs-on: ubuntu-latest
72+
permissions:
73+
contents: read
74+
steps:
75+
- name: Checkout code
76+
uses: actions/checkout@v4
77+
with:
78+
ref: ${{ inputs.ref }}
79+
persist-credentials: false
80+
81+
- name: Set up Python
82+
uses: actions/setup-python@v5
83+
with:
84+
python-version: '3.10'
85+
cache: 'pip'
86+
87+
- name: Install dependencies
88+
run: |
89+
pip install --no-cache-dir hatch
90+
91+
- name: Run lint
92+
id: lint
93+
run: hatch run test-lint
94+
continue-on-error: false

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ __pycache__*
77
.pytest_cache
88
.ruff_cache
99
*.bak
10+
.vscode
11+
dist

CONTRIBUTING.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,22 @@ This project uses [hatchling](https://hatch.pypa.io/latest/build/#hatchling) as
3131

3232
### Setting Up Your Development Environment
3333

34-
1. Install development dependencies:
34+
1. Entering virtual environment using `hatch` (recommended), then launch your IDE in the new shell.
3535
```bash
36-
pip install -e ".[dev]" && pip install -e ".[litellm]
36+
hatch shell dev
3737
```
3838

39+
Alternatively, install development dependencies in a manually created virtual environment:
40+
```bash
41+
pip install -e ".[dev]" && pip install -e ".[litellm]"
42+
```
43+
44+
3945
2. Set up pre-commit hooks:
4046
```bash
4147
pre-commit install -t pre-commit -t commit-msg
4248
```
43-
This will automatically run formatters and convention commit checks on your code before each commit.
49+
This will automatically run formatters and conventional commit checks on your code before each commit.
4450

4551
3. Run code formatters manually:
4652
```bash
@@ -94,6 +100,8 @@ hatch fmt --linter
94100

95101
If you're using an IDE like VS Code or PyCharm, consider configuring it to use these tools automatically.
96102

103+
For additional details on styling, please see our dedicated [Style Guide](./STYLE_GUIDE.md).
104+
97105

98106
## Contributing via Pull Requests
99107
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
@@ -115,7 +123,7 @@ To send us a pull request, please:
115123

116124

117125
## Finding contributions to work on
118-
Looking at the existing issues is a great way to find something to contribute on.
126+
Looking at the existing issues is a great way to find something to contribute to.
119127

120128
You can check:
121129
- Our known bugs list in [Bug Reports](../../issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) for issues that need fixing

0 commit comments

Comments
 (0)