Skip to main content

Git operations and utilities (clone, branch, commit, retry, remote helpers) — standalone module from the SciTeX ecosystem

Project description

scitex-git

Git operations and utilities extracted from the SciTeX ecosystem as a standalone package.

Install

pip install scitex-git

API

import scitex_git as sxg

# Clone / init
sxg.clone_repo(url, dest_dir)
sxg.git_init(repo_path)

# Add / commit
sxg.git_add_all(repo_path)
sxg.git_commit(repo_path, message="…")

# Branch
sxg.git_checkout_new_branch(repo_path, branch_name)
sxg.git_branch_rename(repo_path, old, new)
sxg.setup_branches(repo_path, template_name)

# Repo init / discovery
sxg.init_git_repo(project_dir, git_strategy="parent")
sxg.find_parent_git(project_dir)
sxg.create_child_git(project_dir)
sxg.remove_child_git(project_dir)

# Remote
sxg.get_remote_url(repo_path)
sxg.is_cloned_from(repo_path, url)
sxg.ls_remote(url)
sxg.get_head_hash(repo_path)

# Retry decorator
@sxg.git_retry(max_attempts=3)
def maybe_flaky_operation(): ...

Status

Standalone fork of scitex.git. scitex.logging.getLogger is replaced by stdlib logging.getLogger; the scitex.sh.sh shell wrapper is replaced by a tiny ~70-LOC _vendor_sh.py that supports just the call-shape used here. The optional scitex.writer.verify_tree_structure validation step in create_child_git is gated behind a try/except ImportError so it only runs when scitex-writer is installed.

The umbrella package's scitex.git import path is preserved via a sys.modules-alias bridge so existing code continues to work.

License

AGPL-3.0-only (see LICENSE).

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

scitex_git-0.1.0.tar.gz (25.1 kB view details)

Uploaded Source

Built Distribution

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

scitex_git-0.1.0-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scitex_git-0.1.0.tar.gz
  • Upload date:
  • Size: 25.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for scitex_git-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e431f0e430fa70115011f149a5f9fe863e073f53892e5cd3de878258b76edcd3
MD5 59086ab7014b648801e4e9ddaf9c594f
BLAKE2b-256 dfdcc7aef3b35a12e45b6a828832c0097e2ccf5530986c3460858a878b019c15

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scitex_git-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 30.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for scitex_git-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 641a50f4d07d9644c4e015160ea699efe695608c647e32e3bbfa83a4e22f0565
MD5 8b93f6522a7ac7891f1a28c0d0014b3c
BLAKE2b-256 8243b318b9befb454cb80947b04a39fed8d29e5f337312aaa43dbca4b0248a81

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