Skip to content

repositories

Class info

🛈 DocStrings

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()

Source code in src/githarbor/repositories.py
def create_repository(url: str, **kwargs: Any) -> Repository:
    """Create a proxy-wrapped repository instance from a URL.

    Args:
        url: The repository URL (e.g. 'https://github.com/owner/repo')
        **kwargs: Repository-specific configuration (tokens, credentials, etc.)

    Returns:
        Repository: Proxy-wrapped repository instance

    Raises:
        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()
    """
    try:
        return RepoRegistry.from_url(url, **kwargs)
    except Exception as e:
        msg = f"Failed to create repository from {url}: {e!s}"
        raise RepositoryNotFoundError(msg) from e