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.0.tar.gz (11.3 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.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: s_gitkit-0.1.0.tar.gz
  • Upload date:
  • Size: 11.3 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.0.tar.gz
Algorithm Hash digest
SHA256 abf1313d6a94ecf126e45b0652be35d45ec41cb0657586ab42dd92be3b2a7abd
MD5 648419c2fff8877a8284eac2c287ffd0
BLAKE2b-256 4a12bc6b6aa9b2007e6e8dc36b3e26da2da6a87b39792f733594f5ca47c65bae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s_gitkit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e8768229fc3a7ee9df51f62d88e3af374e9c3bee8fdc2162c5f54870909a621e
MD5 92837f5e51ec71fa76278426f2dc1600
BLAKE2b-256 7b1e3732d153295760331f0da944cde03d33bddf31ffbf57f9a3893d288be40c

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