2
0
Files
gitcaddy-server/sdk/python/gitea/__init__.py
logikonline ca8557f033 feat(sdk): add CLI tool and SDK libraries for developer tooling (Phase 4)
Add comprehensive developer tooling for Gitea integration:

CLI Tool (cmd/gitea-cli/):
- gitea-cli auth login/logout/status - Authentication management
- gitea-cli upload release-asset - Chunked upload with progress
- gitea-cli upload resume - Resume interrupted uploads
- gitea-cli upload list - List pending upload sessions
- Parallel chunk uploads with configurable workers
- SHA256 checksum verification
- Progress bar with speed and ETA display

Go SDK (sdk/go/):
- GiteaClient with token authentication
- User, Repository, Release, Attachment types
- ChunkedUpload with parallel workers
- Progress callbacks for upload tracking
- Functional options pattern (WithChunkSize, WithParallel, etc.)

Python SDK (sdk/python/):
- GiteaClient with requests-based HTTP
- Full type hints and dataclasses
- ThreadPoolExecutor for parallel uploads
- Resume capability for interrupted uploads
- Exception hierarchy (APIError, UploadError, etc.)

TypeScript SDK (sdk/typescript/):
- Full TypeScript types and interfaces
- Async/await API design
- Browser and Node.js compatible
- Web Crypto API for checksums
- ESM and CJS build outputs

All SDKs support:
- Chunked uploads for large files
- Parallel upload workers
- Progress tracking with callbacks
- Checksum verification
- Resume interrupted uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 12:07:07 -05:00

52 lines
1.3 KiB
Python

# Copyright 2026 The Gitea Authors. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Gitea Python SDK
A Python client library for the Gitea API with chunked upload support.
Example usage:
from gitea import GiteaClient
client = GiteaClient("https://gitea.example.com", token="your_token")
# Get current user
user = client.get_current_user()
print(f"Logged in as {user.login}")
# Upload a release asset with progress
with open("app.tar.gz", "rb") as f:
result = client.upload_release_asset(
owner="myorg",
repo="myrepo",
release_id=123,
file=f,
filename="app.tar.gz",
progress_callback=lambda p: print(f"{p.percent:.1f}%")
)
print(f"Uploaded: {result.download_url}")
"""
from .client import GiteaClient
from .models import User, Repository, Release, Attachment, UploadSession, UploadResult, Progress
from .exceptions import GiteaError, APIError, AuthenticationError, NotFoundError, ValidationError
__version__ = "1.0.0"
__all__ = [
"GiteaClient",
"User",
"Repository",
"Release",
"Attachment",
"UploadSession",
"UploadResult",
"Progress",
"GiteaError",
"APIError",
"AuthenticationError",
"NotFoundError",
"ValidationError",
]