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.11.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.11-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: githubinteract-0.2.11.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.11.tar.gz
Algorithm Hash digest
SHA256 181fd73b754c40d2d9a67869e9154f8f9c30794956a9daf6df7f91ae809dc528
MD5 c64c35c4f92021aacc7e0b5cbcd1f8f6
BLAKE2b-256 2638afb6d142882b98b2144fd34bfd55131c8c5ca0af4db3a233cf0daecfadd4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for githubInteract-0.2.11-py3-none-any.whl
Algorithm Hash digest
SHA256 9b9614c4be678c565d0ae749c47e41beb5c6ee1bc03e02eb89afd868350438f4
MD5 e8c7e2ae7543fad6c82a6a20d34f19c6
BLAKE2b-256 db4f13163577c26aff9034219735edfa546b2cdcafd05f3a6ed3ba3e6cb2e425

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