Skip to main content

Git-хостинг абстракция: GitHub/GitLab read-layer (provider pattern для любых репозиториев + фабрика)

Project description

gitkit

Git-хостинг абстракция: GitHub/GitLab read-layer.

Единая интерфейс для работы с произвольными git-репозиториями на GitHub, GitLab и self-hosted GitLab инстансах. Provider pattern позволяет добавить новых провайдеров.

Возможности

  • GitProvider Protocol — read-only операции (list_tags, resolve_tag, fetch_file, fetch_tree, clone_url)
  • GitHubProvider — поддержка github.com и GitHub Enterprise
  • GitLabProvider — поддержка gitlab.com и self-hosted GitLab
  • GitProviderFactory — автоматический выбор провайдера по URL
  • Парсинг URL — поддержка https и scp-like git URL-ов
  • Retry-политика — автоматический retry с exponential backoff (3 попытки)

Установка

uv add s-gitkit

Имя пакета для импорта — gitkit.

Быстрый старт

import gitkit

# Автоматический выбор провайдера по URL
factory = gitkit.GitProviderFactory()
provider, repo = factory.create(
    "https://github.com/owner/repo.git",
    token="ghp_xxx"  # опционально
)

# Работа с репозиторием
tags = await provider.list_tags(repo=repo)
sha = await provider.resolve_tag(repo=repo, tag="v1.0.0")
content = await provider.fetch_file(repo=repo, ref="main", path="README.md")
tree = await provider.fetch_tree(repo=repo, ref="main")

# Clone URL
clone = provider.clone_url(repo=repo)

Self-hosted GitLab

Для поддержки self-hosted GitLab инстансов передайте хосты при создании фабрики:

factory = gitkit.GitProviderFactory(
    self_hosted_hosts=["git.example.com", "gitlab.company.org"]
)
provider, repo = factory.create(
    "https://git.example.com/group/project.git",
    token="glpat_xxx"
)

GitHub Enterprise

Для GitHub Enterprise используйте github_base_url:

factory = gitkit.GitProviderFactory(
    github_base_url="https://github.enterprise.com/api/v3"
)

Разработка

uv sync --extra dev
uv run pytest -q
uv run ruff check gitkit

Лицензия

MIT © 2026 Dmitry.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

s_gitkit-0.1.1.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

s_gitkit-0.1.1-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file s_gitkit-0.1.1.tar.gz.

File metadata

  • Download URL: s_gitkit-0.1.1.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for s_gitkit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 39c569cf28124440aea1cc688b5a9b9ae94023f67439a14b6af87317c6c902c7
MD5 798490663e2c1f59b87d8884280c334c
BLAKE2b-256 c4e8c8bfbc1497de816b8889fe58a7c72fef605573b5d1002520ccb4e009fdd3

See more details on using hashes here.

File details

Details for the file s_gitkit-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: s_gitkit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for s_gitkit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1b7031be5c4b27ac15ad5236614939f39ae92fbf9fbd42991342a97524b353b9
MD5 2b422d97d4588c84c9ef9bd03cbdda04
BLAKE2b-256 e08ec96a58a8823ddcbcee343029576c6ecea9c3b57b717e64f81fca775a3604

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page