-
-
Notifications
You must be signed in to change notification settings - Fork 344
WIP: feat(multithreading): imprement support for multithreading and fix linter warning #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Scott-Nx
wants to merge
6
commits into
Shpota:main
Choose a base branch
from
Scott-Nx:feat/multithreading
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1c8eff4
feat: multithreading support with progress bar
Scott-Nx 18c7a0d
docs: update README with multithreading features and optional tqdm
Scott-Nx 93746a8
docs(README): using alerts format for disclaimer and note
Scott-Nx b5028a6
style: reformat code for better readability
Scott-Nx d453118
docs(style): fix another rumdl warning in README
Scott-Nx d9181cf
fix: resolve type checker warning for tqdm optional import
Scott-Nx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,11 @@ | ||
| GitHub Activity Generator [](https://gitter.im/github-activity-generator/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [](https://github.com/Shpota/github-activity-generator/actions?query=workflow%3Abuild) | ||
| ========================= | ||
| # GitHub Activity Generator [](https://gitter.im/github-activity-generator/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [](https://github.com/Shpota/github-activity-generator/actions?query=workflow%3Abuild) | ||
|
|
||
| A script that helps you *instantly* generate a beautiful GitHub Contributions Graph | ||
| A script that helps you _instantly_ generate a beautiful GitHub Contributions Graph | ||
| for the last year. | ||
|
|
||
| ## ⚠ Disclaimer | ||
|
|
||
| This script is for educational purposes and demonstrating GitHub mechanics. It should not be used to misrepresent professional contributions or coding activity. | ||
| > [!IMPORTANT] | ||
| > | ||
| > This script is for educational purposes and demonstrating GitHub mechanics. It should not be used to misrepresent professional contributions or coding activity. | ||
|
|
||
| ## Check my other projects | ||
|
|
||
|
|
@@ -18,43 +17,89 @@ tools** which I encourage you to check: | |
| - [goxygen](https://github.com/Shpota/goxygen) - Web project generator | ||
| - [zeit](https://github.com/Shpota/zeit) - A Fitbit clock face for learners of the German language | ||
|
|
||
|
|
||
| ## What it looks like | ||
|
|
||
| ### Before :neutral_face: :no_mouth: :unamused: | ||
| ### Before :neutral_face: :no_mouth: :unamused: | ||
|
|
||
|  | ||
|
|
||
| ### After :muscle: :relieved: :heart: :sunglasses: :metal: :horse: :wink: :fire: :dancer: :santa: :fireworks: :cherries: :tada: | ||
|
|
||
|  | ||
|
|
||
| ## How to use | ||
|
|
||
| 1. Create an empty GitHub repository. Do not initialize it. | ||
| 2. Download [the contribute.py script](https://github.com/Shpota/github-activity-generator/archive/master.zip) | ||
| and execute it passing the link on the created repository | ||
| 2. Download [the contribute.py script](https://github.com/Shpota/github-activity-generator/archive/master.zip) | ||
| and execute it passing the link on the created repository | ||
|
|
||
| ```sh | ||
| python contribute.py [email protected]:user/repo.git | ||
| ``` | ||
|
|
||
| Now you have a repository with lots of changes in your GitHub account. | ||
| Note: it takes several minutes for GitHub to reindex your activity. | ||
|
|
||
| > [!NOTE] | ||
| > Note: it takes several minutes for GitHub to reindex your activity. | ||
|
|
||
| ### Multithreading Support | ||
|
|
||
| The script now uses **multithreading** to generate commits in parallel, making it **2-4x faster**! | ||
|
|
||
| ```sh | ||
| # Use 6 threads for faster execution (default is 4) | ||
| python contribute.py --max_threads=6 [email protected]:user/repo.git | ||
| ``` | ||
|
|
||
| ### Progress Bar | ||
|
|
||
| Watch your commits being generated in real-time with a beautiful progress bar | ||
|
|
||
| ``` | ||
| Creating commits: 45%|████████████▌ | 452/1000 [00:23<00:28, 19.45commit/s] | ||
| ``` | ||
|
|
||
| > [!NOTE] | ||
| > The progress bar requires `tqdm` (optional dependency). Install it for the best experience: | ||
|
|
||
| ```sh | ||
| pip install tqdm | ||
| # OR | ||
| pip install -r requirements.txt | ||
| ``` | ||
|
|
||
| **Without tqdm:** The script works perfectly fine without it! Fallback to simple progress indicator instead | ||
|
|
||
| ### Performance Improvements | ||
|
|
||
| - **1000 commits**: ~5-8 minutes → ~2-3 minutes (with 4 threads) | ||
| - **2000 commits**: ~10-16 minutes → ~4-6 minutes (with 4 threads) | ||
|
|
||
| ## How it works | ||
| The script initializes an empty git repository, creates a text file and starts | ||
| generating changes to the file for every day within the last year (0-20 commits | ||
|
|
||
| The script initializes an empty git repository, creates a text file and starts | ||
| generating changes to the file for every day within the last year (0-20 commits | ||
| per day). Once the commits are generated it links the created repository with | ||
| the remote repository and pushes the changes. | ||
|
|
||
| ## Customizations | ||
|
|
||
| You can customize how often to commit and how many commits a day to make, etc. | ||
|
|
||
| For instance, with the following command, the script will make from 1 to 12 | ||
| For instance, with the following command, the script will make from 1 to 12 | ||
| commits a day. It will commit 60% days a year. | ||
|
|
||
| ```sh | ||
| python contribute.py --max_commits=12 --frequency=60 [email protected]:user/repo.git | ||
| ``` | ||
|
|
||
| Use `--no_weekends` option if you don't want to commit on weekends | ||
|
|
||
| ```sh | ||
| python contribute.py --no_weekends | ||
| ``` | ||
| If you do not set the `--repository` argument the script won't push the changes. | ||
|
|
||
| If you do not set the `--repository` argument the script won't push the changes. | ||
| This way you can import the generated repository yourself. | ||
|
|
||
| Use `--days_before` and `--days_after` to specify how many days before the current | ||
|
|
@@ -65,37 +110,63 @@ will keep committing. | |
| python contribute.py --days_before=10 --days_after=15 | ||
| ``` | ||
|
|
||
| Use `--max_threads` to control the number of parallel threads (default: 4, recommended: 2-8): | ||
|
|
||
| ```sh | ||
| python contribute.py --max_threads=8 --frequency=90 [email protected]:user/repo.git | ||
| ``` | ||
|
|
||
| Run `python contribute.py --help` to get help. | ||
|
|
||
| ## System requirements | ||
| To be able to execute the script you need to have Python and Git installed. | ||
|
|
||
| To be able to execute the script you need to have **Python** and **Git** installed. | ||
|
|
||
| **Optional dependency:** | ||
|
|
||
| - `tqdm` - For enhanced progress bar (highly recommended but not required) | ||
|
|
||
| ```sh | ||
| pip install tqdm | ||
| ``` | ||
|
|
||
| The script works without it, showing a simple text progress indicator instead. | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| #### I performed the script but my GitHub activity is still the same. | ||
| ### I performed the script but my GitHub activity is still the same | ||
|
|
||
| It might take several minutes for GitHub to reindex your activity. Check | ||
| if the repository has new commits and wait a couple of minutes. | ||
| #### The changes are still not reflected after some time. | ||
|
|
||
| ### The changes are still not reflected after some time | ||
|
|
||
| Are you using a private repository? If so, enable showing private contributions | ||
| [following this guide](https://help.github.com/en/articles/publicizing-or-hiding-your-private-contributions-on-your-profile). | ||
|
|
||
| #### Still no luck | ||
|
|
||
| Make sure the email address you have in GitHub is the same as you have in | ||
| your local settings. GitHub counts contributions only when they are made | ||
| your local settings. GitHub counts contributions only when they are made | ||
| using the corresponding email. | ||
|
|
||
| Check your local email settings with: | ||
| ``` | ||
|
|
||
| ```sh | ||
| git config --get user.email | ||
| ``` | ||
|
|
||
| If it doesn't match with the one from GitHub reset it with | ||
| ``` | ||
|
|
||
| ```sh | ||
| git config --global user.email "[email protected]" | ||
| ``` | ||
|
|
||
| Create a new repository and rerun the script. | ||
|
|
||
| #### There are errors in the logs of the script. | ||
| ### There are errors in the logs of the script | ||
|
|
||
| Maybe you tried to use an existing repository. If so, make sure you are using | ||
| a new one which is *not initialized*. | ||
| a new one which is _not initialized_. | ||
|
|
||
| **If none of the options helped, open an issue and I will fix it as soon as possible.** | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The note about the progress bar not requiring tqdm contradicts the earlier statement. Line 63 says "The progress bar requires
tqdm" but line 71 says "Without tqdm: The script works perfectly fine without it! Fallback to simple progress indicator instead". Consider clarifying that tqdm is optional but provides an enhanced progress bar, while a basic progress indicator is used as a fallback.