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.8.tar.gz (5.1 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.8-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: githubinteract-0.2.8.tar.gz
  • Upload date:
  • Size: 5.1 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.8.tar.gz
Algorithm Hash digest
SHA256 11333ef6fdcdaca97b7384cd0b204820f9a30733a33431eb95a8ced8a3aad4c8
MD5 b6e6c33011f4bb6b0c9c9629857742e4
BLAKE2b-256 76985f92075b861752de4896e4b42fae7abbd952887acf6b253c6756484f363b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: githubInteract-0.2.8-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for githubInteract-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 39025855ec6a94c29113bd0e9cea600d866fc4e353dd6243adb0f0f3c87e1840
MD5 a28c23c2e01be59ad020427c8a661c24
BLAKE2b-256 a4ec201895e2316498e55fff39d99626eff01b1cdd916085663feae758ca8fd3

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