Skip to main content

This package allows users to interact with github from python.

Project description

Here is example code for using this package: f

init(access_token):
Users need to provide github access tokens to access their github account.

createRepository( repo_name = "new-repository" , repo_description = "This is a description for the new repository", is_private=True ):
Allows users to create a new repository in their account.

create_branch_in_repo( repo_path, branch_name):
Allows users to create new branches in their github repo.

create_branch_in_repo( repo_path, branch_name):
if branch does not exist, it creates the branch and selects it.
if the branch does exist, it ensures that is the branch that is selected.

uploadFolderFileAsCommitToRepo( repo_name="your_repo_name", folder_path="path/to/your/folder", commit_message="Add folder content", branch="main", force=True):
uploads entire folder to a repo. If there is a problem with merging you can select “force” to ensure it works.

delete_github_repository( repo_name):
Delete a repository from GitHub using the GitHub API.

delete_github_branch( repo_name, branch_name ):
Delete a branch from a GitHub repository using the GitHub API.

displayDifferences( self, repo_path, time1, time2, time_choice):
This function finds two Git commits based on given timestamps (time1 and time2) and a selection strategy (time_choice), then displays the differences between those two commits.
Parameters:
repo_path (str) - Path to the Git repository where you want to compare commits.
time1 (datetime) - The first reference time to locate the first commit.
time2 (datetime) - The second reference time to locate the second commit.
time_choice (str): - Strategy for selecting which commit to use based on the provided times.
Options:
'closest' - Picks the commit whose timestamp is closest to the given time (either before or after).
'before' - Picks the most recent commit before the given time. If no earlier commit exists, selects the earliest available commit.
'after' - Picks the first commit after the given time. If no later commit exists, selects the latest available commit.

How It Works:
For both time1 and time2, it runs a Git command to list all commits along with their timestamps.
It chooses a commit near each provided time according to the selected time_choice option.
It then runs git diff between the two selected commits and prints the differences to the console.

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

githubinteract-0.2.10.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

githubInteract-0.2.10-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file githubinteract-0.2.10.tar.gz.

File metadata

  • Download URL: githubinteract-0.2.10.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for githubinteract-0.2.10.tar.gz
Algorithm Hash digest
SHA256 edaf34e2bb4a191e139c054747139ce9fec25f1b483f376401ca2c06146bfc2c
MD5 80d34d2f6845c8aceb89f5d88862639d
BLAKE2b-256 099888a40ac4370dedb45b527aa310be7070cf04785ddde85a9f07ade430ee1e

See more details on using hashes here.

File details

Details for the file githubInteract-0.2.10-py3-none-any.whl.

File metadata

File hashes

Hashes for githubInteract-0.2.10-py3-none-any.whl
Algorithm Hash digest
SHA256 cdb9f944f604271b74e4fcf58f2be77aef8b6a35dbbc91888506fefa9ade44c7
MD5 fd9fe4d42e876d6d3b35e1a248690bfb
BLAKE2b-256 2c92a1b2bb46025e5496a238de81dcdb166e025231b1555c8e03981831bb508c

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