Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
max-line-length = 160
extend-ignore = E203, W503, E402
exclude = .git,__pycache__,.venv,build,dist,venv
71 changes: 71 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: CI Pipeline

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

env:
PYTHON_VERSION: '3.9'

jobs:
test:
name: Test Suite
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Run linting
run: |
make lint
- name: Run linting
run: |
make format
- name: Run tests
run: |
make test

integration-test:
name: Integration Tests
runs-on: ubuntu-20.04
needs: test
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Run integration tests
env:
LABELLERR_API_KEY: ${{ secrets.LABELLERR_API_KEY }}
LABELLERR_API_SECRET: ${{ secrets.LABELLERR_API_SECRET }}
LABELLERR_CLIENT_ID: ${{ secrets.LABELLERR_CLIENT_ID }}
LABELLERR_TEST_EMAIL: ${{ secrets.LABELLERR_TEST_EMAIL }}
run: |
python -m pytest labellerr_use_case_tests.py -v
73 changes: 73 additions & 0 deletions .github/workflows/claude-code-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Claude Code Review

on:
issue_comment:
types: [created]

jobs:
claude-review:
# Only run when @claude is mentioned in a PR comment
if: |
github.event.issue.pull_request &&
contains(github.event.comment.body, '@claude')

runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0

- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@beta
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
# model: "claude-opus-4-20250514"

# Direct prompt for manual review (triggered by @claude mention)
direct_prompt: |
Please review this pull request and provide feedback on:
- Code quality and best practices
- Logical issues
- Potential bugs or issues
- Performance considerations and optimization
- Security concerns
- Test coverage
- Code repeatability
- Over engineering

Be constructive and helpful in your feedback.

# Optional: Customize review based on file types
# direct_prompt: |
# Review this PR focusing on:
# - For TypeScript files: Type safety and proper interface usage
# - For API endpoints: Security, input validation, and error handling
# - For React components: Performance, accessibility, and best practices
# - For tests: Coverage, edge cases, and test quality

# Optional: Different prompts for different authors
# direct_prompt: |
# ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
# 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
# 'Please provide a thorough code review focusing on our coding standards and best practices.' }}

# Optional: Add specific tools for running tests or linting
# allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"

# Optional: Skip review for certain conditions
# if: |
# !contains(github.event.pull_request.title, '[skip-review]') &&
# !contains(github.event.pull_request.title, '[WIP]')
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@ build/
dist/
*.egg-info/
*.pyc
*/*.pyc
.idea
.env
.DS_Store
.claude
tests/test_data
if file == '.DS_Store':
continue
44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.PHONY: help install clean test lint format version info

SOURCE_DIR := labellerr
PYTHON := python3
PIP := pip3

help:
@echo "Labellerr SDK - Simple Development Commands"
@echo "=========================================="
@echo ""
@awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z_-]+:.*?##/ { printf " %-15s %s\n", $$1, $$2 }' $(MAKEFILE_LIST)

install:
$(PIP) install -e .

install-dev:
$(PIP) install -e ".[dev]"

clean:
find . -type f -name "*.pyc" -delete
find . -type d -name "__pycache__" -delete
find . -type d -name "*.egg-info" -exec rm -rf {} +
rm -rf build/ dist/ .coverage .pytest_cache/ .mypy_cache/

test:
$(PYTHON) -m pytest tests/ -v

lint:
flake8 .

format:
black .

build: ## Build package
$(PYTHON) -m build

version:
@grep '^version = ' pyproject.toml | cut -d'"' -f2 | sed 's/^/Current version: /' || echo "Version not found"

info:
@echo "Python: $(shell $(PYTHON) --version)"
@echo "Working directory: $(shell pwd)"
@echo "Git branch: $(shell git branch --show-current 2>/dev/null || echo 'Not a git repository')"
@make version
25 changes: 23 additions & 2 deletions labellerr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
# labellerr/__init__.py
"""Labellerr SDK - Python client for Labellerr API."""

__version__ = "0.1.0"
from .async_client import AsyncLabellerrClient
from .client import LabellerrClient
from .exceptions import LabellerrError

# Get version from package metadata
try:
from importlib.metadata import version

__version__ = version("labellerr-sdk")
except ImportError:
# Python < 3.8
from importlib_metadata import version

__version__ = version("labellerr-sdk")
except Exception:
__version__ = "unknown"

__all__ = [
"__version__",
"LabellerrClient",
"AsyncLabellerrClient",
"LabellerrError",
]
Binary file modified labellerr/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file modified labellerr/__pycache__/client.cpython-310.pyc
Binary file not shown.
Binary file modified labellerr/__pycache__/exceptions.cpython-310.pyc
Binary file not shown.
Loading
Loading