Skip to content

Commit a8609f5

Browse files
committed
feat: initial BNBAgent SDK for on-chain agent registration
0 parents  commit a8609f5

27 files changed

Lines changed: 6610 additions & 0 deletions

.github/workflows/release.yaml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: Release bnbagent to PyPI
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to release (e.g., 0.1.0)'
8+
required: true
9+
type: string
10+
release_to_prod:
11+
description: 'Release to production PyPI (unchecked = test PyPI)'
12+
required: false
13+
default: false
14+
type: boolean
15+
skip_tests:
16+
description: 'Skip tests before release'
17+
required: false
18+
default: false
19+
type: boolean
20+
21+
jobs:
22+
release:
23+
name: Build and Publish to PyPI
24+
runs-on: ubuntu-latest
25+
permissions:
26+
contents: write
27+
id-token: write # Required for trusted publishing to PyPI
28+
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 0 # Fetch all history for tags
34+
35+
- name: Set up Python
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: '3.12'
39+
40+
- name: Install uv
41+
uses: astral-sh/setup-uv@v4
42+
with:
43+
version: "latest"
44+
45+
- name: Install dependencies
46+
run: |
47+
uv sync --extra dev
48+
49+
- name: Run tests
50+
if: ${{ !inputs.skip_tests }}
51+
run: |
52+
uv run pytest -v
53+
54+
- name: Update version in pyproject.toml
55+
run: |
56+
# Update version in pyproject.toml
57+
sed -i 's/^version = ".*"/version = "${{ inputs.version }}"/' pyproject.toml
58+
echo "Updated version to ${{ inputs.version }}"
59+
cat pyproject.toml | grep "^version"
60+
61+
- name: Build package
62+
run: |
63+
uv build
64+
65+
- name: Check package contents
66+
run: |
67+
ls -lh dist/
68+
echo "Package files:"
69+
find dist -type f
70+
71+
- name: Publish to Production PyPI
72+
if: ${{ inputs.release_to_prod }}
73+
uses: pypa/gh-action-pypi-publish@release/v1
74+
with:
75+
packages-dir: ./dist/
76+
print-hash: true
77+
password: ${{ secrets.PYPI_API_TOKEN }}
78+
# Uses trusted publishing (OIDC) - no token needed
79+
# Configure OIDC in PyPI account settings: https://pypi.org/manage/account/publishing/
80+
81+
- name: Publish to Test PyPI
82+
if: ${{ !inputs.release_to_prod }}
83+
uses: pypa/gh-action-pypi-publish@release/v1
84+
with:
85+
packages-dir: ./dist/
86+
print-hash: true
87+
repository-url: https://test.pypi.org/legacy/
88+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
89+
# For Test PyPI, you can use trusted publishing or API token
90+
# If using API token, set TEST_PYPI_API_TOKEN secret
91+
92+
- name: Commit version update
93+
if: success() && inputs.release_to_prod
94+
run: |
95+
git config user.name "github-actions[bot]"
96+
git config user.email "github-actions[bot]@users.noreply.github.com"
97+
git add pyproject.toml
98+
git commit -m "chore: bump version to ${{ inputs.version }}" || exit 0
99+
git push origin HEAD:${{ github.ref_name }} || echo "No changes to commit or branch protection"
100+
101+
- name: Create Git tag
102+
if: success() && inputs.release_to_prod
103+
run: |
104+
git config user.name "github-actions[bot]"
105+
git config user.email "github-actions[bot]@users.noreply.github.com"
106+
git tag -a "bnbagent-v${{ inputs.version }}" -m "Release bnbagent v${{ inputs.version }}"
107+
git push origin "bnbagent-v${{ inputs.version }}"
108+
109+
- name: Create GitHub Release
110+
if: success() && inputs.release_to_prod
111+
uses: softprops/action-gh-release@v1
112+
with:
113+
tag_name: bnbagent-v${{ inputs.version }}
114+
name: bnbagent v${{ inputs.version }}
115+
body: |
116+
## bnbagent v${{ inputs.version }}
117+
118+
Python SDK for ERC-8004 on-chain agent registration and management.
119+
120+
### Installation
121+
122+
```bash
123+
pip install bnbagent==${{ inputs.version }}
124+
```
125+
126+
✅ Published to **Production PyPI**
127+
128+
### Changes
129+
130+
See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for details.
131+
draft: false
132+
prerelease: false

.gitignore

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
*.egg-info/
20+
.installed.cfg
21+
*.egg
22+
23+
# Virtual environments
24+
venv/
25+
env/
26+
ENV/
27+
.venv/
28+
29+
# IDE
30+
.vscode/
31+
.idea/
32+
*.swp
33+
*.swo
34+
*~
35+
36+
# Key files (NEVER commit private keys!)
37+
.bnbagent_state
38+
*.key
39+
*.pem
40+
*.keystore
41+
42+
# Environment variables
43+
.env
44+
.env.local
45+
46+
# Testing
47+
.pytest_cache/
48+
.coverage
49+
htmlcov/
50+
.tox/
51+
52+
# Type checking / Linting
53+
.mypy_cache/
54+
.ruff_cache/
55+
56+
# Logs
57+
*.log
58+
59+
# OS
60+
.DS_Store
61+
Thumbs.db

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 BNBChain Contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)