githarbor
Class info¶
Re-exported classes¶
| Class | Module | Description |
|---|---|---|
| AuthenticationError | githarbor.exceptions | Raised when authentication fails. |
| BaseRepository | githarbor.core.base | Base repository class. All methods raise FeatureNotSupportedError by default. |
| Branch | githarbor.core.models | Branch(name: 'str', sha: 'str', protected: 'bool' = False, default: 'bool' = False, created_at: 'datetime |
| Comment | githarbor.core.models | Comment(id: 'str', body: 'str', author: 'User', created_at: 'datetime', updated_at: 'datetime |
| Commit | githarbor.core.models | Commit(sha: 'str', message: 'str', author: 'User |
| GitHarborError | githarbor.exceptions | Base exception for GitHarbor. |
| Issue | githarbor.core.models | Issue(number: 'int', title: 'str', description: 'str' = '', state: 'str' = 'open', author: 'User |
| Label | githarbor.core.models | Label(name: 'str', color: 'str' = '', description: 'str' = '', created_at: 'datetime |
| OperationNotAllowedError | githarbor.exceptions | Raised when an operation is not allowed. |
| ProviderNotConfiguredError | githarbor.exceptions | Raised when provider is not properly configured (missing token etc). |
| PullRequest | githarbor.core.models | Pull request model. |
| RateLimitError | githarbor.exceptions | Raised when API rate limit is exceeded. |
| Release | githarbor.core.models | Model representing a repository release. |
| RepositoryNotFoundError | githarbor.exceptions | Raised when a repository cannot be found. |
| ResourceNotFoundError | githarbor.exceptions | Raised when a requested resource is not found. |
| User | githarbor.core.models | User or organization account on a Git hosting platform. |
| Workflow | githarbor.core.models | Workflow(id: 'str', name: 'str', path: 'str', state: 'str', created_at: 'datetime |
| WorkflowRun | githarbor.core.models | WorkflowRun(id: 'str', name: 'str', workflow_id: 'str', status: 'str', conclusion: 'str |
🛈 DocStrings¶
GitHarbor: main package.
Unified client for GitHub, GitLab and BitBucket.
AuthenticationError
¶
Bases: GitHarborError
Raised when authentication fails.
BaseRepository
¶
Base repository class. All methods raise FeatureNotSupportedError by default.
Source code in src/githarbor/core/base.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | |
compare_branches_async
async
¶
compare_branches_async(
base: str,
head: str,
include_commits: bool = True,
include_files: bool = True,
include_stats: bool = True,
) -> dict[str, Any]
Compare two branches asynchronously.
Source code in src/githarbor/core/base.py
create_branch
¶
create_branch(name: str, base_commit: str) -> Branch
Create a new branch at the specified commit.
create_branch_async
async
¶
create_branch_async(name: str, base_commit: str) -> Branch
Create a new branch at the specified commit asynchronously.
Source code in src/githarbor/core/base.py
create_issue
¶
create_issue(
title: str, body: str, labels: list[str] | None = None, assignees: list[str] | None = None
) -> Issue
Create a new issue.
Source code in src/githarbor/core/base.py
create_issue_async
async
¶
create_issue_async(
title: str, body: str, labels: list[str] | None = None, assignees: list[str] | None = None
) -> Issue
Create a new issue asynchronously.
Source code in src/githarbor/core/base.py
create_pull_request_from_diff
¶
create_pull_request_from_diff(
title: str,
body: str,
base_branch: str,
diff: str,
head_branch: str | None = None,
draft: bool = False,
) -> PullRequest
Create a pull request from a diff string.
Source code in src/githarbor/core/base.py
create_pull_request_from_diff_async
async
¶
create_pull_request_from_diff_async(
title: str,
body: str,
base_branch: str,
diff: str,
head_branch: str | None = None,
draft: bool = False,
) -> PullRequest
Create a pull request from a diff string asynchronously.
Source code in src/githarbor/core/base.py
download_async
async
¶
Download repository content asynchronously.
Source code in src/githarbor/core/base.py
get_branch_async
async
¶
get_branch_async(name: str) -> Branch
Get branch information asynchronously.
get_commit_async
async
¶
get_commit_async(sha: str) -> Commit
Get commit information asynchronously.
get_contributors_async
async
¶
get_contributors_async(
sort_by: Literal["commits", "name", "date"] = "commits", limit: int | None = None
) -> list[User]
Get repository contributors asynchronously.
Source code in src/githarbor/core/base.py
get_issue_async
async
¶
get_issue_async(issue_id: int) -> Issue
Get issue information asynchronously.
get_languages_async
async
¶
Get repository language statistics asynchronously.
get_latest_release_async
async
¶
get_latest_release_async(
include_drafts: bool = False, include_prereleases: bool = False
) -> Release
Get latest release asynchronously.
Source code in src/githarbor/core/base.py
get_pull_request_async
async
¶
get_pull_request_async(number: int) -> PullRequest
Get pull request information asynchronously.
get_repo_user_async
async
¶
get_repo_user_async() -> User
Get repository owner information asynchronously.
get_workflow_async
async
¶
get_workflow_async(workflow_id: str) -> Workflow
Get workflow information asynchronously.
get_workflow_run_async
async
¶
get_workflow_run_async(run_id: str) -> WorkflowRun
Get workflow run information asynchronously.
list_commits_async
async
¶
list_commits_async(
branch: str | None = None,
since: datetime | None = None,
until: datetime | None = None,
author: str | None = None,
path: str | None = None,
max_results: int | None = None,
) -> list[Commit]
List commits asynchronously.
Source code in src/githarbor/core/base.py
list_issues_async
async
¶
list_issues_async(state: IssueState = 'open') -> list[Issue]
List issues asynchronously.
list_pull_requests_async
async
¶
list_pull_requests_async(state: PullRequestState = 'open') -> list[PullRequest]
List pull requests asynchronously.
Source code in src/githarbor/core/base.py
list_releases_async
async
¶
list_releases_async(
include_drafts: bool = False, include_prereleases: bool = False, limit: int | None = None
) -> list[Release]
List releases asynchronously.
Source code in src/githarbor/core/base.py
search_commits_async
async
¶
search_commits_async(
query: str, branch: str | None = None, path: str | None = None, max_results: int | None = None
) -> list[Commit]
Search commits asynchronously.
Source code in src/githarbor/core/base.py
Branch
dataclass
¶
Source code in src/githarbor/core/models.py
created_at
class-attribute
instance-attribute
¶
Date and time when the branch was created.
default
class-attribute
instance-attribute
¶
Whether this is the default branch of the repository.
last_commit_author
class-attribute
instance-attribute
¶
last_commit_author: User | None = None
Author of the last commit.
last_commit_date
class-attribute
instance-attribute
¶
Date of the last commit.
last_commit_message
class-attribute
instance-attribute
¶
Message of the last commit.
protected
class-attribute
instance-attribute
¶
Whether the branch has protection rules enabled.
protection_rules
class-attribute
instance-attribute
¶
Branch protection settings if any.
updated_at
class-attribute
instance-attribute
¶
Date and time when the branch was last updated.
Comment
dataclass
¶
Source code in src/githarbor/core/models.py
Commit
dataclass
¶
Source code in src/githarbor/core/models.py
author
class-attribute
instance-attribute
¶
author: User | None = None
User who authored the commit.
committer
class-attribute
instance-attribute
¶
committer: User | None = None
User who committed the changes.
created_at
class-attribute
instance-attribute
¶
Date and time when the commit was authored.
files_changed
class-attribute
instance-attribute
¶
Changed file paths.
parents
class-attribute
instance-attribute
¶
List of parent commit SHAs.
stats
class-attribute
instance-attribute
¶
Commit statistics.
GitHarborError
¶
Issue
dataclass
¶
Source code in src/githarbor/core/models.py
assignee
class-attribute
instance-attribute
¶
assignee: User | None = None
User who is assigned to the issue.
closed_at
class-attribute
instance-attribute
¶
Date and time when the issue was closed.
created_at
class-attribute
instance-attribute
¶
Date and time when the issue was created.
labels
class-attribute
instance-attribute
¶
labels: list[Label] = field(default_factory=list)
List of labels attached to the issue.
updated_at
class-attribute
instance-attribute
¶
Date and time when the issue was last updated.
Label
dataclass
¶
Source code in src/githarbor/core/models.py
OperationNotAllowedError
¶
Bases: GitHarborError
Raised when an operation is not allowed.
ProviderNotConfiguredError
¶
Bases: GitHarborError
Raised when provider is not properly configured (missing token etc).
PullRequest
dataclass
¶
Pull request model.
Source code in src/githarbor/core/models.py
assignees
class-attribute
instance-attribute
¶
assignees: list[User] = field(default_factory=list)
Assigned reviewers.
changed_files
class-attribute
instance-attribute
¶
Number of files changed.
closed_at
class-attribute
instance-attribute
¶
Closing timestamp if closed.
comments
class-attribute
instance-attribute
¶
comments: list[Comment] = field(default_factory=list)
PR comments.
commits_count
class-attribute
instance-attribute
¶
Number of commits.
created_at
class-attribute
instance-attribute
¶
Creation timestamp.
description
class-attribute
instance-attribute
¶
Description/body of the pull request.
labels
class-attribute
instance-attribute
¶
labels: list[Label] = field(default_factory=list)
Applied labels.
mergeable
class-attribute
instance-attribute
¶
Whether PR can be merged.
merged_at
class-attribute
instance-attribute
¶
Merge timestamp if merged.
merged_by
class-attribute
instance-attribute
¶
merged_by: User | None = None
User who merged the PR.
review_comments_count
class-attribute
instance-attribute
¶
Number of review comments.
state
class-attribute
instance-attribute
¶
Current state (open/closed/merged).
updated_at
class-attribute
instance-attribute
¶
Last update timestamp.
RateLimitError
¶
Bases: GitHarborError
Raised when API rate limit is exceeded.
Release
dataclass
¶
Model representing a repository release.
Source code in src/githarbor/core/models.py
assets
class-attribute
instance-attribute
¶
assets: list[Asset] = field(default_factory=list)
List of assets attached to the release.
author
class-attribute
instance-attribute
¶
author: User | None = None
User who created the release.
created_at
class-attribute
instance-attribute
¶
Date and time when the release was created.
description
class-attribute
instance-attribute
¶
Description/body of the release.
prerelease
class-attribute
instance-attribute
¶
Whether this is a pre-release.
published_at
class-attribute
instance-attribute
¶
Date and time when the release was published.
target_commitish
class-attribute
instance-attribute
¶
The branch/tag/commit the release targets.
RepositoryNotFoundError
¶
Bases: GitHarborError
Raised when a repository cannot be found.
ResourceNotFoundError
¶
Bases: GitHarborError
Raised when a requested resource is not found.
User
dataclass
¶
User or organization account on a Git hosting platform.
Source code in src/githarbor/core/models.py
avatar_url
class-attribute
instance-attribute
¶
URL of the user's avatar image.
company
class-attribute
instance-attribute
¶
Company/organization the user belongs to.
created_at
class-attribute
instance-attribute
¶
Date and time when the user account was created.
following
class-attribute
instance-attribute
¶
Number of users being followed.
gravatar_id
class-attribute
instance-attribute
¶
Gravatar id for this user.
hireable
class-attribute
instance-attribute
¶
Whether user is available for hiring
is_admin
class-attribute
instance-attribute
¶
Whether the user has admin privileges.
last_activity_on
class-attribute
instance-attribute
¶
Date of last activity.
location
class-attribute
instance-attribute
¶
Geographic location of the user.
public_repos
class-attribute
instance-attribute
¶
Number of public repositories.
state
class-attribute
instance-attribute
¶
State of the user (active / inactive).
twitter_username
class-attribute
instance-attribute
¶
X / Twitter username of this user
Workflow
dataclass
¶
Source code in src/githarbor/core/models.py
badge_url
class-attribute
instance-attribute
¶
URL to the badge image for the workflow.
created_at
class-attribute
instance-attribute
¶
Date and time when the workflow was created.
definition
class-attribute
instance-attribute
¶
Content of the workflow definition file.
disabled
class-attribute
instance-attribute
¶
Indicates if the workflow is disabled.
last_run_at
class-attribute
instance-attribute
¶
Date and time when the workflow was last run.
triggers
class-attribute
instance-attribute
¶
List of triggers that can start the workflow.
updated_at
class-attribute
instance-attribute
¶
Date and time when the workflow was last updated.
WorkflowRun
dataclass
¶
Source code in src/githarbor/core/models.py
branch
class-attribute
instance-attribute
¶
Branch the workflow was run on.
commit_sha
class-attribute
instance-attribute
¶
SHA of the commit that triggered the workflow.
completed_at
class-attribute
instance-attribute
¶
Date and time when the workflow run completed.
created_at
class-attribute
instance-attribute
¶
Date and time when the workflow run was created.
run_number
class-attribute
instance-attribute
¶
Sequential run number.
started_at
class-attribute
instance-attribute
¶
Date and time when the workflow run started.
updated_at
class-attribute
instance-attribute
¶
Date and time when the workflow run was last updated.
create_repository
¶
create_repository(url: str, **kwargs: Any) -> Repository
Create a proxy-wrapped repository instance from a URL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The repository URL (e.g. 'https://github.com/owner/repo') |
required |
**kwargs
|
Any
|
Repository-specific configuration (tokens, credentials, etc.) |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
Repository |
Repository
|
Proxy-wrapped repository instance |
Raises:
| Type | Description |
|---|---|
RepositoryNotFoundError
|
If the URL isn't supported or no repository found |
Example
repo = create_repository('https://github.com/owner/repo', token='my-token') issues = repo.list_issues()