fix: restructure aitbc-agent-sdk package for proper testing
Some checks failed
package-tests / test-python-packages (map[name:aitbc-agent-sdk path:packages/py/aitbc-agent-sdk python_version:3.13]) (push) Successful in 35s
package-tests / test-python-packages (map[name:aitbc-cli path:. python_version:3.13]) (push) Successful in 2s
package-tests / test-python-packages (map[name:aitbc-core path:packages/py/aitbc-core python_version:3.13]) (push) Successful in 3s
package-tests / test-python-packages (map[name:aitbc-crypto path:packages/py/aitbc-crypto python_version:3.13]) (push) Successful in 4s
package-tests / test-python-packages (map[name:aitbc-sdk path:packages/py/aitbc-sdk python_version:3.13]) (push) Successful in 2s
package-tests / test-javascript-packages (map[name:aitbc-sdk node_version:24 path:packages/js/aitbc-sdk]) (push) Failing after 1s
python-tests / test (push) Failing after 1s
package-tests / cross-language-compatibility (push) Has been skipped
package-tests / package-integration-tests (push) Has been skipped
python-tests / test-specific (push) Has been skipped
security-scanning / audit (push) Failing after 1s
integration-tests / test-service-integration (push) Successful in 1m24s

- Add pyproject.toml with modern Python packaging
- Create src/ directory structure for standard layout
- Add comprehensive test suite (test_agent_sdk.py)
- Fix package discovery for linting tools
- Resolve CI package test failures
- Ensure proper import paths and module structure

Changes:
- packages/py/aitbc-agent-sdk/pyproject.toml (new)
- packages/py/aitbc-agent-sdk/src/aitbc_agent/ (moved)
- packages/py/aitbc-agent-sdk/tests/ (new)
- Update setuptools configuration for src layout
This commit is contained in:
aitbc1
2026-03-29 12:07:21 +02:00
parent 39e4282525
commit 326a10e51d
7 changed files with 201 additions and 0 deletions

View File

@@ -0,0 +1,123 @@
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "aitbc-agent-sdk"
version = "0.1.0"
description = "Python SDK for AITBC AI Agent Network"
readme = "README.md"
license = {text = "MIT"}
authors = [
{name = "AITBC Agent Network", email = "dev@aitbc.bubuit.net"}
]
maintainers = [
{name = "AITBC Agent Network", email = "dev@aitbc.bubuit.net"}
]
keywords = ["ai", "agents", "blockchain", "decentralized", "computing", "swarm", "intelligence"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: System :: Distributed Computing",
]
requires-python = ">=3.13"
dependencies = [
"fastapi>=0.104.0",
"uvicorn>=0.24.0",
"pydantic>=2.4.0",
"sqlalchemy>=2.0.0",
"alembic>=1.12.0",
"redis>=5.0.0",
"cryptography>=41.0.0",
"web3>=6.11.0",
"requests>=2.31.0",
"psutil>=5.9.0",
"asyncio-mqtt>=0.16.0"
]
[project.optional-dependencies]
dev = [
"pytest>=7.4.0",
"pytest-asyncio>=0.21.0",
"black>=23.9.0",
"flake8>=6.1.0",
"mypy>=1.6.0",
"pre-commit>=3.4.0",
]
gpu = [
"torch>=2.1.0",
"torchvision>=0.16.0",
"torchaudio>=2.1.0",
"nvidia-ml-py>=12.535.0",
]
edge = [
"paho-mqtt>=1.6.0",
"aiohttp>=3.9.0",
"cryptography>=41.0.0",
]
[project.scripts]
aitbc-agent = "aitbc_agent.cli:main"
aitbc-agent-provider = "aitbc_agent.provider:main"
aitbc-agent-consumer = "aitbc_agent.consumer:main"
aitbc-agent-coordinator = "aitbc_agent.coordinator:main"
[project.urls]
Homepage = "https://github.com/oib/AITBC"
Documentation = "https://docs.aitbc.bubuit.net"
Repository = "https://github.com/oib/AITBC"
"Bug Tracker" = "https://github.com/oib/AITBC/issues"
[tool.setuptools]
package-dir = {"" = "src"}
packages = ["aitbc_agent"]
[tool.setuptools.package-data]
aitbc_agent = [
"config/*.yaml",
"templates/*.json",
"schemas/*.json",
]
[tool.black]
line-length = 88
target-version = ['py313']
include = '\.pyi?$'
extend-exclude = '''
/(
# directories
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| build
| dist
)/
'''
[tool.mypy]
python_version = "3.13"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = [
"--verbose",
"--tb=short",
"--strict-markers",
"--disable-warnings",
"-ra"
]

View File

@@ -0,0 +1 @@
"""Tests for AITBC Agent SDK"""

View File

@@ -0,0 +1,77 @@
"""Test suite for AITBC Agent SDK"""
import pytest
from aitbc_agent.agent import AITBCAgent
from aitbc_agent.compute_provider import ComputeProvider
from aitbc_agent.swarm_coordinator import SwarmCoordinator
class TestAITBCAgent:
"""Test AITBC Agent functionality"""
def test_agent_initialization(self):
"""Test agent can be initialized"""
agent = AITBCAgent(agent_id="test-agent")
assert agent.agent_id == "test-agent"
assert agent.status == "initialized"
def test_agent_config_validation(self):
"""Test agent configuration validation"""
config = {
"agent_id": "test-agent",
"compute_type": "gpu",
"capabilities": ["inference", "training"]
}
agent = AITBCAgent(**config)
assert agent.compute_type == "gpu"
assert "inference" in agent.capabilities
class TestComputeProvider:
"""Test Compute Provider functionality"""
def test_provider_registration(self):
"""Test provider can register with network"""
provider = ComputeProvider(
provider_id="test-provider",
gpu_count=4,
memory_gb=32
)
assert provider.provider_id == "test-provider"
assert provider.gpu_count == 4
assert provider.memory_gb == 32
def test_resource_availability(self):
"""Test resource availability reporting"""
provider = ComputeProvider(
provider_id="test-provider",
gpu_count=2,
memory_gb=16
)
resources = provider.get_available_resources()
assert resources["gpu_count"] == 2
assert resources["memory_gb"] == 16
class TestSwarmCoordinator:
"""Test Swarm Coordinator functionality"""
def test_coordinator_initialization(self):
"""Test coordinator initialization"""
coordinator = SwarmCoordinator(coordinator_id="test-coordinator")
assert coordinator.coordinator_id == "test-coordinator"
assert len(coordinator.agents) == 0
def test_agent_registration(self):
"""Test agent registration with coordinator"""
coordinator = SwarmCoordinator(coordinator_id="test-coordinator")
agent = AITBCAgent(agent_id="test-agent")
success = coordinator.register_agent(agent)
assert success is True
assert len(coordinator.agents) == 1
assert "test-agent" in coordinator.agents
if __name__ == "__main__":
pytest.main([__file__])