Metadata-Version: 2.1
Name: blocks_sdk
Version: 0.1.101
Summary: Write custom AI-enabled codebase automations in Python. Leverage a full codebase-aware API. Automatically trigger automations from Github, Slack, and other providers.
Home-page: https://github.com/BlocksOrg/sdk
Author: BlocksOrg
Author-email: dev@blocks.team
License: AGPL
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Bug Tracking
Classifier: Topic :: Software Development :: Debuggers
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Software Development :: Version Control :: Git
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE

# Blocks SDK

Write custom AI-enabled codebase automations in Python. Leverage a full codebase-aware API. Automatically trigger automations from Github, Slack, and other providers.

> We're currently in private alpha, we recommend consistently updating your SDK to the latest version to get the latest features and fixes.

## Getting Started

### 1. Install SDK

```bash
pip install blocks-sdk
```

### 2. Create a new Blocks project

```bash
mkdir -p .blocks/myautomation
cd .blocks/myautomation
```

### 3. Create a new automation

```python
# automation.py
from blocks import task, on

@task(name="my_automation")
@on("github.pull_request", repos=["MyOrg/MyRepo"])
def my_automation(event):
    print(event)
```

### 5. Upload your automation

```bash
blocks init --api-key <your-api-key>
blocks push automation.py
```

## Repository Provider Configuration

Set `REPO_PROVIDER` when using `blocks.repo` APIs.

### GitHub

- `REPO_PROVIDER=github`
- `GITHUB_TOKEN=<token>`
- `REPO_URL=https://github.com/<owner>/<repo>.git` (or legacy `GITHUB_REPOSITORY_PATH=<owner>/<repo>`)

### GitLab

- `REPO_PROVIDER=gitlab`
- `GITLAB_TOKEN=<token>`
- `REPO_URL=https://gitlab.com/<owner>/<repo>.git`

### Bitbucket Cloud

- `REPO_PROVIDER=bitbucket`
- `BITBUCKET_TOKEN=<token>`
- `REPO_URL=https://bitbucket.org/<workspace>/<repo_slug>.git`
- Optional for git clone auth flows: `BITBUCKET_USERNAME=<username>`

Bitbucket pull request support includes creating/updating PRs, general and inline comments, replies, approvals, and request-changes reviews.
