Skip to main content

Official Python SDK for ArchiCore Architecture Analysis API

Project description

ArchiCore Python SDK

Official Python client for the ArchiCore Architecture Analysis API.

Installation

pip install archicore

Quick Start

from archicore import ArchiCore

# Initialize client
client = ArchiCore(api_key="your-api-key")

# List projects
projects = client.projects.list()
for project in projects:
    print(f"{project['name']} - {project['id']}")

# Search code semantically
results = client.projects.search(
    "project-id",
    query="authentication middleware"
)
for result in results:
    print(f"{result['file']}:{result['line']}")
    print(result['code'])

# Ask AI assistant
answer = client.projects.ask(
    "project-id",
    question="How does the authentication system work?"
)
print(answer['response'])

Features

  • Projects: Create, list, delete, and manage projects
  • Semantic Search: Search code using natural language
  • AI Assistant: Ask questions about your codebase
  • Impact Analysis: Analyze how changes affect your codebase
  • Code Metrics: Get code quality metrics
  • Security Scanning: Identify vulnerabilities
  • Webhooks: Subscribe to events

API Reference

Projects

# List all projects
projects = client.projects.list()

# Get a specific project
project = client.projects.get("project-id")

# Create a project
project = client.projects.create(
    name="my-project",
    github_url="https://github.com/user/repo"
)

# Delete a project
client.projects.delete("project-id")

# Trigger indexing
client.projects.index("project-id", force=True)

Search & AI

# Semantic search
results = client.projects.search(
    "project-id",
    query="error handling",
    limit=20,
    threshold=0.8
)

# Ask AI assistant
answer = client.projects.ask(
    "project-id",
    question="What design patterns are used?",
    context="Focus on the authentication module"
)

Analysis

# Get code metrics
metrics = client.projects.metrics("project-id")
print(f"Total files: {metrics['total_files']}")
print(f"Total lines: {metrics['total_lines']}")

# Get security scan results
security = client.projects.security("project-id")
for vuln in security['vulnerabilities']:
    print(f"[{vuln['severity']}] {vuln['message']}")

# Impact analysis
impact = client.projects.analyze(
    "project-id",
    files=["src/auth/login.ts", "src/auth/middleware.ts"]
)
print(f"Affected files: {len(impact['affected_files'])}")

Webhooks

# List webhooks
webhooks = client.webhooks.list()

# Create a webhook
webhook = client.webhooks.create(
    url="https://example.com/webhook",
    events=["project.indexed", "analysis.complete"],
    secret="your-webhook-secret"
)

# Delete a webhook
client.webhooks.delete("webhook-id")

Error Handling

from archicore import (
    ArchiCore,
    AuthenticationError,
    RateLimitError,
    NotFoundError,
    ValidationError,
)

client = ArchiCore(api_key="your-api-key")

try:
    project = client.projects.get("non-existent-id")
except NotFoundError:
    print("Project not found")
except AuthenticationError:
    print("Invalid API key")
except RateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after} seconds")
except ValidationError as e:
    print(f"Invalid request: {e.message}")

Configuration

Custom Base URL

For self-hosted instances:

client = ArchiCore(
    api_key="your-api-key",
    base_url="https://your-instance.com/api/v1"
)

Timeout

client = ArchiCore(
    api_key="your-api-key",
    timeout=60  # seconds
)

Context Manager

with ArchiCore(api_key="your-api-key") as client:
    projects = client.projects.list()
# Connection automatically closed

Requirements

  • Python 3.8+
  • requests >= 2.28.0

License

MIT License - see LICENSE for details.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

archicore-0.1.1.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

archicore-0.1.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file archicore-0.1.1.tar.gz.

File metadata

  • Download URL: archicore-0.1.1.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for archicore-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6bd28631748413a4e8cc412525f44610bb97622a23e43ebe4a3b214db1c8c263
MD5 c841b7740a71c93af083bf649fca62f3
BLAKE2b-256 0319f8c9925db0c5c9d4383b9cd3640af429a14d3baaae35791886cadfd59a76

See more details on using hashes here.

File details

Details for the file archicore-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: archicore-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for archicore-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 87200ca268597027fd23d08f5f7d511dcf60025f8ae0e18c43c7702e2cb1c5f2
MD5 f3185dac7dfa3decf4d4c3c63523ea31
BLAKE2b-256 d5d9438676522a8fa12cf8bbbf94e7b9038ef8f1f24485e97eba28bacbbe3555

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page