Fetch and track GitHub stargazers and followers
Project description
watchy
Python library and CLI tool for fetching and tracking GitHub stargazers and followers.
See ryan-williams/.watchy for an example daily GHA that polls for stargazers and followers of a few orgs and repos.
Features
- Fetch stargazers for GitHub repositories
- Fetch followers for GitHub users or organizations
- Save data to simple text files (one username per line)
Installation
pip install watchy
Usage
Command Line Interface
Fetch Repository Stargazers
# Single repository
watchy stars owner/repo
# Multiple repositories
watchy stars owner/repo1 owner/repo2 another-user/repo3
# All repositories for a user/org
watchy stars username
watchy stars orgname
# Mixed targets
watchy stars owner/repo username orgname
Fetch User/Organization Followers
# Single user
watchy follows username
# Multiple users
watchy follows user1 user2 user3
# Mix users and orgs
watchy follows user1 orgname user2
Output
watchy always:
- saves usernames to text files under
.watchy/(configurable with$WATCHY_DIR) - prints usernames to stdout (first 5, ..., last 5 if >10 total)
- shows counts in log messages (to stderr)
File locations:
- Stargazers:
.watchy/github/stars/<owner>/<repo>.txt - Followers:
.watchy/github/follows/<user>.txt
Example output:
42 stargazers for owner/repo
alice
bob
charlie
david
emily
...
user38
user39
user40
user41
user42
Authentication
watchy automatically loads GitHub tokens from:
--tokencommand line argumentGITHUB_TOKENenvironment variable.tokenfile in current directorygh auth token(GitHub CLI)
# Using environment variable
export GITHUB_TOKEN=your_personal_access_token
watchy stars owner/repo
# Using command line argument
watchy --token your_token stars owner/repo
# Using .token file
echo "your_token" > .token
watchy stars owner/repo
# Using GitHub CLI (if logged in)
gh auth login
watchy stars owner/repo # Automatically uses gh token
Rate Limiting
# Add delay between requests when fetching multiple repos
watchy stars myorg -s 1.0 # 1 second delay between repos
Python API
from watchy.github import GitHubClient
from watchy.storage import save_logins_to_txt
from pathlib import Path
# Create client (auto-detects token)
client = GitHubClient()
# Fetch stargazers
stargazers = list(client.get_stargazers("owner", "repo"))
logins = save_logins_to_txt(iter(stargazers), Path("stargazers.txt"))
# Fetch followers
followers = list(client.get_followers("username"))
Development
# Install with dev dependencies
pip install -e .[dev]
# Lint
ruff check src/watchy/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file watchy-0.0.5.tar.gz.
File metadata
- Download URL: watchy-0.0.5.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cab857454bde40c3f3bf1a3bee1a4ecd57bb2d6a29bda858771796f9aac92d42
|
|
| MD5 |
af9d6eafbc710c8490d7cdbbc159e7e2
|
|
| BLAKE2b-256 |
ed98f1e9be9a35829fe5e5d1e10d46622fda1d6c67c2865ebf7d6e3a65597d83
|
File details
Details for the file watchy-0.0.5-py3-none-any.whl.
File metadata
- Download URL: watchy-0.0.5-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a29c28df57eef67cb057c33f0b2ce0b18a900eb40a3d4490d3af8a6075f875c4
|
|
| MD5 |
129ee899e247f176ddae92bb428504be
|
|
| BLAKE2b-256 |
be7b9f221279c8d8d74f5c356823250a0d4472f3a0c6288fd63bc9ecf2477865
|