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

Uploaded Python 3

File details

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

File metadata

  • Download URL: githubinteract-0.2.2.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.2.tar.gz
Algorithm Hash digest
SHA256 65cc7ceeeeec35f727124d797e6ae87c44ccd100d67072d914def57f0aecdd36
MD5 2434364e9d05edae0fdaf7eed7d0eee9
BLAKE2b-256 ed1e06ec794be08e28b1a3d70f964b38ce737cb42cb99b322f0bb9a6e60b901a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: githubInteract-0.2.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f0bf249f6e53be281f729d2c8c2ac444b92a59a261bc660db855ad767b328d2c
MD5 318be2918ed5b5a44451726bb5dbba83
BLAKE2b-256 9d224bdc5f1c70ac3d1a2d2c9cca930e2b15dfb6d22aec6f04f0f190bedd494c

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