Skip to main content

pygitops

CI pipeline status PyPI PyPI - Python Version codecov Checked with mypy Code style: black

Pygitops is a wrapper around low-level GitPython logic, that makes it very simple to do basic git operations. This system is especially useful for systems that create automated pull requests, or otherwise operate on contents of repositories locally.

For example, clone a repository, make some changes, and push those changes to a branch:

from pathlib import Path

from pygitops.operations import feature_branch, stage_commit_push_changes, get_updated_repo, build_github_repo_url
from git import Actor, Repo

repo_name = 'some-repo'
repo_namespace = 'some-namespace'
branch_name = 'new-chores'
some_actor = Actor('some-service-account', 'some-service-account@some-enterprise.com')
commit_message = 'Add list of chores'

# Build the URL for cloning the repository 
repo_url = build_github_repo_url(
    "some-service-account_name",
    "some-access-token",
    repo_namespace,
    repo_name,
    "github.com",
)

# Clone the repository to the local filesystem (updating the repo if it is already present)
repo: Repo = get_updated_repo(
    repo_url, Path("some-clone-dir" / repo_name) 
)

# Make some changes on a feature branch, commit and push the changes
with feature_branch(repo, branch_name):
    Path('some-clone-dir' / repo_name / 'chores.txt').write_text('haircut\ngroceries\ndishes')

    stage_commit_push_changes(repo, branch_name, some_actor, commit_message)

Features

  • Clone repositories to your local filesystem from any remote git repository
  • Create feature branches and add commits, without worrying about the underlying GitPython complexity

Installation

pip install pygitops

Usage

For more information, please see the pygitops docs

Metadata

Release files for pygitops 0.18.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pygitops 0.18.0
File Size Uploaded Provenance Actions
pygitops-0.18.0.tar.gz 10.5 kB Without provenance Details for pygitops-0.18.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pygitops 0.18.0
File Interpreter ABI Platform Actions
pygitops-0.18.0-py3-none-any.whl Python 3 none any Details for pygitops-0.18.0-py3-none-any.whl

Total release size: 20.9 kB

Release files / pygitops-0.18.0.tar.gz

Download URL pygitops-0.18.0.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fe59879b970daa01616be83981e4f7910a687f223c3fa26c7b6f2b6e00ac8707
BLAKE2b-256 checksum
How to use checksums
dd8d11e4371af43faf39354bfce79d6d57c015e915124dc001c70ce4fe39eeb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.11

Release files / pygitops-0.18.0-py3-none-any.whl

Download URL pygitops-0.18.0-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a679a51056b68666da9dd711747d47a5c39cd56470afcb37a7ac2b503368c146
BLAKE2b-256 checksum
How to use checksums
eee70c607d56bbdad2fa7043ee950193dd5aabe61d6eacdfe14918ab6e7f07f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.11

Security for pygitops 0.18.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page