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.0.tar.gz (10.8 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.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: archicore-0.1.0.tar.gz
  • Upload date:
  • Size: 10.8 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.0.tar.gz
Algorithm Hash digest
SHA256 6ffe3f7225a69c3f0d7a46b57d2f5b58a4c6781e4a37b83c21635777fbf1622b
MD5 feaebfc7d5e5d26a531c9df50470324f
BLAKE2b-256 84fc7cae6d8a827544d8116b6298299b38dd417d8b2e95274ca72eb5dbd7c014

See more details on using hashes here.

File details

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

File metadata

  • Download URL: archicore-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18658a4b8c3cd613183a807ec8e3a1ac5a663e9d615e5b1899856fd3d805924a
MD5 69544bd48aae14b22c92b3b256e97aa4
BLAKE2b-256 e52c5539aa991a447725e62006d75dc1194c7411f2b43a591c143b62a83dbd8e

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