Skip to content

Commit 82f9093

Browse files
committed
feat: Initial commit of the VoltAgent Python SDK, including core functionality, configuration, and comprehensive testing framework.
1 parent 4c2699c commit 82f9093

19 files changed

+5906
-1
lines changed

.github/workflows/ci.yml

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Cache pip dependencies
27+
uses: actions/cache@v3
28+
with:
29+
path: ~/.cache/pip
30+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
31+
restore-keys: |
32+
${{ runner.os }}-pip-
33+
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
pip install -e ".[test]"
38+
39+
- name: Lint with flake8
40+
run: |
41+
pip install flake8
42+
# Stop the build if there are Python syntax errors or undefined names
43+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
44+
# Exit-zero treats all errors as warnings. GitHub editor is 127 chars wide
45+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
46+
47+
- name: Type check with mypy
48+
run: |
49+
pip install mypy types-requests
50+
mypy voltagent --ignore-missing-imports || true
51+
52+
- name: Run tests with pytest
53+
env:
54+
VOLTAGENT_BASE_URL: https://api.test.voltagent.dev
55+
VOLTAGENT_PUBLIC_KEY: test-public-key
56+
VOLTAGENT_SECRET_KEY: test-secret-key
57+
run: |
58+
pytest tests/ -v --tb=short --cov=voltagent --cov-report=xml --cov-report=term-missing
59+
60+
- name: Upload coverage reports to Codecov
61+
uses: codecov/codecov-action@v3
62+
with:
63+
file: ./coverage.xml
64+
flags: unittests
65+
name: codecov-umbrella
66+
fail_ci_if_error: false
67+
68+
build:
69+
runs-on: ubuntu-latest
70+
needs: test
71+
72+
steps:
73+
- uses: actions/checkout@v4
74+
75+
- name: Set up Python
76+
uses: actions/setup-python@v4
77+
with:
78+
python-version: "3.11"
79+
80+
- name: Install build dependencies
81+
run: |
82+
python -m pip install --upgrade pip
83+
pip install build twine
84+
85+
- name: Build package
86+
run: python -m build
87+
88+
- name: Check distribution
89+
run: twine check dist/*
90+
91+
- name: Upload build artifacts
92+
uses: actions/upload-artifact@v3
93+
with:
94+
name: python-package-distributions
95+
path: dist/
96+
97+
security:
98+
runs-on: ubuntu-latest
99+
100+
steps:
101+
- uses: actions/checkout@v4
102+
103+
- name: Set up Python
104+
uses: actions/setup-python@v4
105+
with:
106+
python-version: "3.11"
107+
108+
- name: Install security tools
109+
run: |
110+
python -m pip install --upgrade pip
111+
pip install safety bandit
112+
113+
- name: Run safety check
114+
run: |
115+
pip install -e .
116+
safety check || true
117+
118+
- name: Run bandit security scan
119+
run: |
120+
bandit -r voltagent/ -f json -o bandit-report.json || true
121+
bandit -r voltagent/ || true
122+
123+
- name: Upload security reports
124+
uses: actions/upload-artifact@v3
125+
if: always()
126+
with:
127+
name: security-reports
128+
path: |
129+
bandit-report.json
130+
131+
publish:
132+
runs-on: ubuntu-latest
133+
needs: [test, build, security]
134+
if: github.event_name == 'release' && github.event.action == 'published'
135+
136+
steps:
137+
- uses: actions/checkout@v4
138+
139+
- name: Set up Python
140+
uses: actions/setup-python@v4
141+
with:
142+
python-version: "3.11"
143+
144+
- name: Install build dependencies
145+
run: |
146+
python -m pip install --upgrade pip
147+
pip install build twine
148+
149+
- name: Build package
150+
run: python -m build
151+
152+
- name: Publish to PyPI
153+
env:
154+
TWINE_USERNAME: __token__
155+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
156+
run: |
157+
twine upload dist/*

.pre-commit-config.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-added-large-files
9+
- id: check-json
10+
- id: check-merge-conflict
11+
- id: debug-statements
12+
13+
- repo: https://github.com/psf/black
14+
rev: 23.7.0
15+
hooks:
16+
- id: black
17+
language_version: python3
18+
19+
- repo: https://github.com/pycqa/isort
20+
rev: 5.12.0
21+
hooks:
22+
- id: isort
23+
args: ["--profile", "black"]
24+
25+
- repo: https://github.com/pycqa/flake8
26+
rev: 6.0.0
27+
hooks:
28+
- id: flake8
29+
args:
30+
[
31+
"--max-line-length=120",
32+
"--extend-ignore=E203,W503,F401,F811,F841,E501,E231",
33+
]
34+
35+
# MyPy temporarily disabled - can be enabled for production
36+
# - repo: https://github.com/pre-commit/mirrors-mypy
37+
# rev: v1.5.1
38+
# hooks:
39+
# - id: mypy
40+
# additional_dependencies: [types-requests]
41+
42+
# Pytest check temporarily disabled - run manually with: python -m pytest tests/
43+
# - repo: local
44+
# hooks:
45+
# - id: pytest-check
46+
# name: pytest-check
47+
# entry: python3 -m pytest tests/ --tb=short -q
48+
# language: system
49+
# pass_filenames: false
50+
# always_run: true

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
## [0.1.1] - 2024-12-02
11+
12+
### Added - Initial Release
13+
- **Complete VoltAgent Python SDK** - Modern, type-safe, async-ready SDK for AI agent observability

0 commit comments

Comments
 (0)