Skip to content

Latest commit

 

History

History
310 lines (208 loc) · 13.2 KB

File metadata and controls

310 lines (208 loc) · 13.2 KB

My Awesome YouTube Channel

Welcome to my YouTube channel! 🎉 In this channel, I share exciting content related to web development. Whether you're interested in Angular, Javascript, or Productivity tips, you'll find something valuable here. YouTube Channel

About Me

I'm Sam, and I'm passionate about product engineering and web development. I create videos that will help you learn web development.

What You'll Find Here

  • [ Angular ]: [Learn the fundamentals. I explained everything you need to get started with this JavaScript framework written in TypeScript. It is the web development framework for building the future. works at any scale. Loved by millions. Build for everyone. open-source framework for building single-page client applications using HTML and TypeScript.]
  • [ Javascript ]: [JavaScript is a powerful programming language that can add interactivity to a website. JavaScript is easy to learn. It's the foundation of frontend web development.]
  • [ Career Tips ]: [self-assessment, goal setting, action planning, implementation, and refinement. By following these steps, you can develop a road map for achieving your career goals. Tips to improve your career development. Cultivating a beginner's mindset is a critical part of career growth. critical part of your professional growth.]
  • [ Common Errors ]: [Mistakes to Avoid in Software Development Projects.]
  • [ Development Tools ]: [Top Software Development Tools List.]
  • [ Typescript ]: [TypeScript extends JavaScript by adding types to the language. TypeScript speeds up your development experience by catching errors. TypeScript can help enhance and improve your web development projects.]
  • [ Git & GitHub ]: [GitHub is where over 100 million developers shape the future of software together. Contribute to the open-source community and manage Git repositories. This practical guide gets you to jump right into using GitHub, learning the basics of Git. Git and GitHub are two of the most essential tools in the world of software development.]
  • [ Video Conferencing Tool ]: [Unlock the potential of video conferencing software development. Dive into our guide for insights on key features and cost factors. If you're looking to integrate video communication into your app or planning to build a video streaming/conference app from scratch, create a fully customized audio & video conferencing app.]

About the app - Multi-Repo Command Center

Moved from a simple script to a high-performance automation tool, and the core Python concepts we used to get there. In modern software development, we rarely work on just one project. We have frontends, backends, microservices, and documentation repos. The "Multi-Repo Headache" occurs when you forget to push a critical fix in one folder while moving to another.

how to use Python to build a Local Repository Tracker—a tool that scans hundreds of directories in seconds and provides a visual dashboard of your work.

1. The Engine: Interfacing with Git (subprocess)

The first thing we learned is that Python doesn't need to "re-invent" Git. Instead, it acts as a driver. We used the subprocess module to send commands to the system’s Git installation.

  • The "Porcelain" Secret: When scripts talk to Git, we use the --porcelain flag. While standard git status is designed to be "pretty" for humans, "porcelain" output is designed to be stable and easy for machines to parse.
  • The Logic: If git status --porcelain returns an empty string, the repo is "Clean." If it returns any text at all, we know there are "Changes."

2. The Map: Navigating the Filesystem (os and pathlib)

To find your projects, Python has to "walk" through your hard drive. We explored two ways to do this:

  • Shallow Scanning: Looking only at the immediate folders inside a directory.
  • Deep/Recursive Scanning: Using os.walk, which dives into every sub-folder.

The "signature" of a repository is the .git folder. By teaching our script to look for that specific hidden folder, it can distinguish between a random folder of cat pictures and a professional coding project.

3. The Dashboard: User Interface with Rich

Raw text data is hard to read. To make the tool useful, we used the Rich library to create a Terminal User Interface (TUI).

  • Visual Hierarchy: We learned that colors aren't just for decoration—they are status indicators.
    • Red creates urgency (Uncommitted changes).
    • Yellow signals a "pending" state (Unpushed commits).
    • Green signals safety (Clean repo).
  • Tables: By using a structured table, we condensed 10 lines of Git output into a single, high-density row, allowing us to see the status of 50 repos on one screen.

4. Scaling Up: The Power of Concurrency (Threaded Execution)

When you have 5 or 10 repositories, a simple script is fast. When you have 100+ repositories, checking them one-by-one (sequentially) becomes painfully slow because the script has to wait for the hard drive to respond for each repo.

We solved this using Multi-threading (concurrent.futures):

  • Sequential: Repo 1... (wait)... Repo 2... (wait)... Repo 3.
  • Parallel: Repo 1, 2, 3, 4, 5, 6, 7, 8, 9, 10... (all at once).

This is a "Pro" level optimization. It moves the bottleneck from the CPU to the I/O (Input/Output), making the script feel "instant" even with massive amounts of data.

5. Summary: The Automation Mindset

The most important lesson in this chapter isn't actually Python code—it's the Automation Mindset.

Instead of manually typing cd repo_name and git status 100 times a day, we spent that time building a tool to do it for us. This reduces "Cognitive Load"—the mental energy spent remembering where you left off—allowing you to focus entirely on writing code.


Key Takeaways for your "Developer Toolbox":

  1. Don't Rebuild, Wrap: Use Python to wrap existing CLI tools (like Git) to add new features.
  2. UX Matters in the Terminal: A well-formatted table with colors is 10x more effective than a wall of black-and-white text.
  3. Speed through Parallelism: When tasks involve waiting for the system (I/O bound), use threads to do many things at once.
  4. Relative vs. Absolute Paths: Use os.path.abspath(__file__) to make your scripts "portable" so they work no matter where you move them.

To run the project:

# Basic scan (all repos) - displays Commits, Lines of Code (LOC), Behind, and Last Active
py tracker.py

# Sort repositories by Lines of Code, Commits, Changes, or Unpushed (highest first)
py tracker.py --sort loc
py tracker.py --sort commits
py tracker.py --sort changes

# Filter repositories by status
py tracker.py --filter clean     # only clean repos
py tracker.py --filter red       # repos with uncommitted changes (dirty)
py tracker.py --filter unpushed  # repos with local commits not pushed to remote
py tracker.py --filter behind    # repos with commits waiting to be pulled from remote

# Export output report to CSV, JSON, Markdown, or TXT file (includes LOC & Commits)
py tracker.py --export report.csv
py tracker.py --filter clean --export clean_repos.json
py tracker.py --sort loc --export repo_stats.md

# Exclude folders from scanning (skip node_modules, venv, or specific folders)
py tracker.py --exclude venv node_modules
py tracker.py -x build dist temp_folder

Excluding Folders (.trackerignore & CLI)

You can exclude specific folders from being scanned in two ways:

  1. Command line (-x / --exclude): Pass one or more folder names or relative paths:
    py tracker.py --exclude venv node_modules
    py tracker_cached.py -x temp build "archive/legacy_repo"
  2. .trackerignore file: Create a .trackerignore file in your root folder with one folder name or pattern per line:
    venv
    .venv
    node_modules
    dist
    build
    __pycache__
    

Instant Filtering with Cache (tracker_cached.py)

To avoid rescanning your repositories every time you want to switch between clean, dirty, or unpushed repos:

# 1. First run: scans repos once and saves to local cache (.tracker_cache.json)
py tracker_cached.py

# 2. Instant filtering & sorting: loads from cache in milliseconds (no re-scanning!)
py tracker_cached.py --filter clean
py tracker_cached.py --filter red
py tracker_cached.py --filter unpushed
py tracker_cached.py --filter behind
py tracker_cached.py --sort loc
py tracker_cached.py --sort commits

# 3. Whenever you want fresh git data, force a re-scan:
py tracker_cached.py --refresh
py tracker_cached.py --filter red --export dirty_repos.md

GitHub Repository Analytics Command Center (github_tracker.py)

A complete software development analytics tool for monitoring commits, open issues, pull requests, and releases across multiple remote GitHub projects in one place.

Key Features:

  • Centralized Multi-Repo Dashboard: Track metrics across teams and projects (Stars, Forks, Languages, Open PRs, Open Issues, Latest Commits, Latest Releases).
  • Single Project Deep Dive (--detail): View top recent commits, open pull requests, issues, releases, and language distribution.
  • Smart Local Cache: Avoids GitHub API rate limits by caching fetched repository data locally (.github_tracker_cache.json).
  • Exporting: Generate .md, .csv, or .json executive reports.
  • Token Support: Use GitHub Personal Access Token for up to 5,000 requests/hour (GITHUB_TOKEN env var or --token).

Usage Examples:

# 1. Monitor projects listed in repos.txt (default)
py github_tracker.py

# 2. Monitor specific repositories on the fly
py github_tracker.py --repos facebook/react vercel/next.js pallets/flask

# 3. Sort projects by stars, open PRs, issues, or forks
py github_tracker.py --sort prs
py github_tracker.py --sort issues
py github_tracker.py --sort stars

# 4. Deep-dive into a single project (recent commits, PRs, issues, releases)
py github_tracker.py --detail pallets/flask

# 5. Export analytics report
py github_tracker.py --export github_projects_summary.md
py github_tracker.py --export github_projects_summary.csv

# 6. Force a live update from GitHub API (bypass cache)
py github_tracker.py --refresh

# 7. Use custom repos file or provide GitHub API token
py github_tracker.py --file my_repos.txt --token ghp_yourTokenHere

Useful Links

APIs Detail

Packages used

Subscribe and Stay Updated!

Don't miss out on new videos! Subscribe to my channel and hit the notification bell 🔔 to receive updates whenever I upload fresh content. Let's learn, laugh, and explore together!

!Subscribe to My Channel

Connect with Me

Feel free to reach out, comment on videos, and share your thoughts. I appreciate your support! 🙌

License

This project is licensed under the MIT License.


If you have any questions or need further assistance, feel free to ask! 🚀

Steps to contribute and generate PR(pull request)

clone the repository

clone the forked repository to your system. Go to your GitHub account, open the forked repository, click on the code button and then clone the repository. If you want to use the terminal, use the following commands after you fork the repository, open the terminal type the given command

git clone repo url

create a branch

create a branch on your local repository to solve a problem.

Terminal commands

git checkout -b your_new_branch_name

add & commit

add your changes(folder) to that branch. Make necessary changes and commit those changes. Terminal commands

git add .
git commit -m "your-commit-message"

push changes to github

finally, push your local repository to the remote repository compare & submit a pull request

terminal commands

git push origin

Go to your repository on GitHub, you'll see a compare & pull request button. Click on that button.

Now submit the pull request.

For quick approval of the pull request, reach out to me on the mentioned social media channels.

 _____ _                 _     __   __
|_   _| |               | |    \ \ / /
  | | | |__   __ _ _ __ | | __  \ V /___  _   _
  | | | '_ \ / _` | '_ \| |/ /   \ // _ \| | | |
  | | | | | | (_| | | | |   <    | | (_) | |_| |
  \_/ |_| |_|\__,_|_| |_|_|\_\   \_/\___/ \__,_|


______
|  ___|
| |_ ___  _ __
|  _/ _ \| '__|
| || (_) | |
\_| \___/|_|


______      _               _   _               _
| ___ \    (_)             | | | |             | |
| |_/ / ___ _ _ __   __ _  | |_| | ___ _ __ ___| |
| ___ \/ _ \ | '_ \ / _` | |  _  |/ _ \ '__/ _ \ |
| |_/ /  __/ | | | | (_| | | | | |  __/ | |  __/_|
\____/ \___|_|_| |_|\__, | \_| |_/\___|_|  \___(_)
                     __/ |
                    |___/




if (youEnjoyed) {
  //  (star ⭐ & fork 🍽️) this repository.
  // - Fork this repository by clicking on the fork button at the top of this page. This will create a copy of this repository in your account.
  starThisRepository();
}

happy coding fellas!!💕✨

py repo_code.py