Skip to main content

watchy

PyPI version

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:

  1. --token command line argument
  2. GITHUB_TOKEN environment variable
  3. .token file in current directory
  4. gh 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/

Metadata

Release files for watchy 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for watchy 0.0.7
File Size Uploaded
watchy-0.0.7.tar.gz 11.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for watchy 0.0.7
File Interpreter ABI Platform
watchy-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 24.0 kB

Release files / watchy-0.0.7.tar.gz

Download URL watchy-0.0.7.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9365ee49245a68d64caef32021fb1ff5a8afbe0bbcba44a33908c4e3a6c765f1
BLAKE2b-256 checksum
How to use checksums
c9c5885cfd77d459a8faf0e94da766f9d9d6c64b9dab6f9fa154641126158011
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.13

Release files / watchy-0.0.7-py3-none-any.whl

Download URL watchy-0.0.7-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4009ebe0cf145d07e60c1c7227e3fcd7cb70c395aae9d40243691d7efc3a6d86
BLAKE2b-256 checksum
How to use checksums
9baeea7190aed39c44edcd913c6ca7db7b7144d3454ef073a145d5513a30756c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.13

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page