Skip to content

Commit 348cd9d

Browse files
committed
Init Agents365 SDK for Python
0 parents  commit 348cd9d

File tree

121 files changed

+13693
-0
lines changed

Some content is hidden

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

121 files changed

+13693
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/samples/ @pontemonti @rahuldevikar761 @JimDaly

.github/workflows/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# GitHub Actions Workflows
2+
3+
This directory contains GitHub Actions workflows for the Kairo repository.
4+
5+
## CI Workflow (ci.yml)
6+
7+
The main CI workflow builds, tests, and prepares all three SDK packages for publishing:
8+
9+
### Jobs
10+
11+
#### Python SDK (`python-sdk`)
12+
- **Matrix**: Python 3.11 and 3.12
13+
- **Steps**:
14+
- Install dependencies and build tools
15+
- Optional linting with ruff
16+
- Build Python package using `python -m build`
17+
- Run tests with pytest
18+
- *Publishing to PyPI (commented out for now)*
19+
20+
#### JavaScript/Node.js SDK (`javascript-sdk`)
21+
- **Matrix**: Node.js 18 and 20
22+
- **Steps**:
23+
- Install npm dependencies
24+
- Run ESLint for code quality
25+
- Build TypeScript to JavaScript
26+
- Run Jest tests
27+
- *Publishing to NPM (commented out for now)*
28+
29+
#### .NET SDK (`dotnet-sdk`)
30+
- **Matrix**: .NET 8.0.x
31+
- **Steps**:
32+
- Restore NuGet dependencies
33+
- Build solution in Release configuration
34+
- Run unit tests
35+
- Pack NuGet packages
36+
- Upload packages as artifacts
37+
- *Publishing to NuGet (commented out for now)*
38+
39+
### Triggers
40+
41+
- **Push**: Triggers on pushes to `main` or `master` branches
42+
- **Pull Request**: Triggers on pull requests targeting `main` or `master` branches
43+
44+
### Publishing
45+
46+
All publishing steps are currently commented out as requested. To enable publishing:
47+
48+
1. **Python**: Uncomment the PyPI publishing step and add `PYPI_API_TOKEN` secret
49+
2. **JavaScript**: Uncomment the NPM publishing step and add `NPM_TOKEN` secret
50+
3. **.NET**: Uncomment the NuGet publishing step and add `NUGET_API_KEY` secret
51+
52+
### Caching
53+
54+
The workflow uses dependency caching to speed up builds:
55+
- Python: pip cache
56+
- JavaScript: npm cache
57+
- .NET: NuGet packages are cached automatically by the dotnet CLI

.github/workflows/ci.yml

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
name: CI - Build, Test, and Publish SDKs
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
version-number:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Set current date in UTC as env variable
14+
run: |
15+
export CURRENT_DATE="$(date -u +'%Y.%m.%d')"
16+
echo "Current date is ${CURRENT_DATE}"
17+
echo "CURRENT_DATE=${CURRENT_DATE}" >> $GITHUB_ENV
18+
19+
- id: build_version
20+
name: Generate Build Version
21+
run: |
22+
export BUILD_VERSION="$CURRENT_DATE.${{ github.run_number }}"
23+
echo "Build version is ${BUILD_VERSION}"
24+
echo "BUILD_VERSION=${BUILD_VERSION}" >> $GITHUB_OUTPUT
25+
26+
- id: package_version
27+
name: Generate Package Version
28+
run: |
29+
export PACKAGE_VERSION="$CURRENT_DATE-preview.${{ github.run_number }}"
30+
echo "Package version is ${PACKAGE_VERSION}"
31+
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_OUTPUT
32+
export PYTHON_PACKAGE_VERSION="$CURRENT_DATE+preview.${{ github.run_number }}"
33+
echo "Python package version is ${PYTHON_PACKAGE_VERSION}"
34+
echo "PYTHON_PACKAGE_VERSION=${PYTHON_PACKAGE_VERSION}" >> $GITHUB_OUTPUT
35+
36+
outputs:
37+
BUILD_VERSION: ${{ steps.build_version.outputs.BUILD_VERSION }}
38+
PACKAGE_VERSION: ${{ steps.package_version.outputs.PACKAGE_VERSION }}
39+
PYTHON_PACKAGE_VERSION: ${{ steps.package_version.outputs.PYTHON_PACKAGE_VERSION }}
40+
41+
changed-sdks:
42+
name: Determine Changed SDKs
43+
runs-on: ubuntu-latest
44+
outputs:
45+
python-sdk: ${{ steps.check_python_sdk.outputs.changed }}
46+
steps:
47+
- name: Checkout repository
48+
uses: actions/checkout@v4
49+
with:
50+
fetch-depth: 0
51+
52+
- id: git_refs
53+
name: Set Git refs for diff
54+
run: |
55+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
56+
echo "base=${{ github.event.pull_request.base.sha }}" >> "$GITHUB_OUTPUT"
57+
echo "head=${{ github.event.pull_request.head.sha }}" >> "$GITHUB_OUTPUT"
58+
else
59+
echo "base=${{ github.event.before }}" >> "$GITHUB_OUTPUT"
60+
echo "head=${{ github.sha }}" >> "$GITHUB_OUTPUT"
61+
fi
62+
63+
- id: check_python_sdk
64+
name: Check Python SDK changes
65+
run: |
66+
if git diff --name-only "${{ steps.git_refs.outputs.base }}" "${{ steps.git_refs.outputs.head }}" -- 'python/**' | grep -q .; then
67+
echo "Python SDK changes detected"
68+
echo "changed=true" >> $GITHUB_OUTPUT
69+
else
70+
echo "No Python SDK changes detected"
71+
echo "changed=false" >> $GITHUB_OUTPUT
72+
fi
73+
74+
- id: check_nodejs_sdk
75+
name: Check Node.js SDK changes
76+
run: |
77+
if git diff --name-only "${{ steps.git_refs.outputs.base }}" "${{ steps.git_refs.outputs.head }}" -- 'nodejs/**' | grep -q .; then
78+
echo "Node.js SDK changes detected"
79+
echo "changed=true" >> $GITHUB_OUTPUT
80+
else
81+
echo "No Node.js SDK changes detected"
82+
echo "changed=false" >> $GITHUB_OUTPUT
83+
fi
84+
85+
python-sdk:
86+
name: Python SDK
87+
needs: [version-number, changed-sdks]
88+
runs-on: ubuntu-latest
89+
defaults:
90+
run:
91+
working-directory: ./python
92+
93+
strategy:
94+
matrix:
95+
python-version: ['3.11', '3.12']
96+
97+
steps:
98+
- name: Checkout repository
99+
uses: actions/checkout@v4
100+
101+
- name: Install the latest version of uv and set the python version
102+
uses: astral-sh/setup-uv@v6
103+
with:
104+
version: '0.6.x'
105+
python-version: ${{ matrix.python-version }}
106+
working-directory: ./python
107+
enable-cache: true
108+
cache-dependency-glob: "./pyproject.toml"
109+
110+
- name: Install the project
111+
run: uv lock && uv sync --locked --all-extras --dev
112+
113+
- name: Check linting
114+
run: |
115+
uv run --frozen ruff check .
116+
continue-on-error: true
117+
118+
- name: Check formatting
119+
run: |
120+
uv run --frozen ruff format --check .
121+
122+
- name: Build package
123+
run: |
124+
A365_SDK_VERSION=${{ needs.version-number.outputs.PYTHON_PACKAGE_VERSION }} uv build --all-packages --wheel
125+
126+
- name: Run tests
127+
run: |
128+
uv run --frozen python -m pytest tests/ -v --tb=short
129+
130+
# Copy package and samples to drop folder
131+
- name: Copy package and samples to drop folder
132+
run: |
133+
mkdir -p ~/drop/python-${{ matrix.python-version }}/dist && cp -v dist/*.whl $_
134+
mkdir -p ~/drop/python-${{ matrix.python-version }}/samples && cp -rv samples/sample_openai_agent $_
135+
136+
# Zip files since upload-artifact does not seem like to like folders
137+
- name: Create zip
138+
run: cd ~/drop/python-${{ matrix.python-version }} && zip -r ~/drop/python-${{ matrix.python-version }}.zip .
139+
140+
- name: Upload package and samples as artifacts
141+
uses: actions/upload-artifact@v4
142+
with:
143+
name: python-${{ matrix.python-version }}
144+
path: ~/drop/python-${{ matrix.python-version }}.zip
145+
146+
- name: Publish
147+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.changed-sdks.outputs.python-sdk == 'true'
148+
run: |
149+
uv run twine upload --config-file .pypirc -r Agent365 dist/*
150+
continue-on-error: true
151+
env:
152+
TWINE_USERNAME: __token__
153+
TWINE_PASSWORD: ${{ secrets.AZURE_DEVOPS_TOKEN }}

.gitignore

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
## A streamlined .gitignore for modern .NET projects
2+
## including temporary files, build results, and
3+
## files generated by popular .NET tools. If you are
4+
## developing with Visual Studio, the VS .gitignore
5+
## https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
6+
## has more thorough IDE-specific entries.
7+
##
8+
## Get latest from https://github.com/github/gitignore/blob/main/Dotnet.gitignore
9+
10+
# Build results
11+
[Dd]ebug/
12+
[Dd]ebugPublic/
13+
[Rr]elease/
14+
[Rr]eleases/
15+
x64/
16+
x86/
17+
[Ww][Ii][Nn]32/
18+
[Aa][Rr][Mm]/
19+
[Aa][Rr][Mm]64/
20+
bld/
21+
[Bb]in/
22+
[Oo]bj/
23+
[Ll]og/
24+
[Ll]ogs/
25+
26+
# Locally built Nuget package cache file
27+
.lastbuild
28+
29+
# .NET Core
30+
project.lock.json
31+
project.fragment.lock.json
32+
artifacts/
33+
34+
# ASP.NET Scaffolding
35+
ScaffoldingReadMe.txt
36+
37+
# NuGet Packages
38+
*.nupkg
39+
# NuGet Symbol Packages
40+
*.snupkg
41+
42+
# Others
43+
~$*
44+
*~
45+
CodeCoverage/
46+
47+
# MSBuild Binary and Structured Log
48+
*.
49+
*.log
50+
51+
# MSTest test Results
52+
[Tt]est[Rr]esult*/
53+
[Bb]uild[Ll]og.*
54+
55+
# Visual Studio
56+
.vs/
57+
58+
# NUnit
59+
*.VisualState.xml
60+
TestResult.xml
61+
nunit-*.xml
62+
63+
# Python build artifacts
64+
*.egg-info/
65+
__pycache__/
66+
*.py[cod]
67+
*$py.class
68+
*.pyc
69+
*.pyo
70+
*.pyd
71+
dist/
72+
build/
73+
.eggs/
74+
.pytest_cache/
75+
_version.py
76+
77+
# Virtual environments
78+
.venv/
79+
venv/
80+
env/
81+
.env
82+
.env/
83+
*.env
84+
85+
# JavaScript/Node.js build artifacts
86+
node_modules/
87+
npm-debug.log*
88+
yarn-debug.log*
89+
yarn-error.log*
90+
package-lock.json.bak
91+
.cache/
92+
.next/
93+
out/
94+
coverage/
95+
96+
# We should have at some point .vscode, but for not ignore since we don't have standard
97+
.vscode
98+
.claude/
99+
**/.claude/
100+
.idea/
101+
102+
# OS-specific files
103+
.DS_Store
104+
Thumbs.db

0 commit comments

Comments
 (0)