Fetch repositories and developers from GitHub trending.
from gtrending import fetch_repos
repos = fetch_repos(language="python") # Returns a dictionary
for repo in repos:
print(repo["fullname"]) # "user/repo" for each repo
or using the CLI
gtrending repos --language python
The above examples will fetch all the trending Python projects on GitHub trending today.
- Python 3.6 or higher
gtrending is published on PyPI, use your favorite package manager and add it as a dependency.
Pip:
pip3 install gtrending
Poetry:
poetry add gtrending
You get the idea.
Documentation: Read the docs
Fetch trending repositories on GitHub.
Parameters:
language (str, optional)
: Filtering by language, eg: pythonspoken_language_code (str, optional)
: The spoken language, eg: en for englishsince (str, optional)
: The time range, choose from: [daily, weekly, monthly]. Defaults to "daily"
Returns:
A list of dictionaries containing information for the trending repositories found.
Fetch trending developers on GitHub.
Parameters:
language (str, optional)
: The programming language, eg: pythonsince (str, optional)
: The time range, choose from [daily, weekly, monthly]. Defaults to "daily"
Returns:
A list of dictionaries containing information for the trending developers found.
Fetch languages
Returns:
A list of dictionaries containing programming languages.
Fetch spoken languages.
Returns:
A list of spoken languages.
Check if the language exists.
Parameters:
language (str)
: The language, eg: python.
Returns:
A boolean value. True for valid language, False otherwise.
Check if the spoken language exists.
Parameters:
spoken_language_code (str)
: The spoken language, eg: English, or en, for English.
Returns:
A boolean value. True for valid spoken language, False otherwise.
Check if the time range is correct.
Parameters:
since (str)
: The time range.
Returns:
A boolean value. True for valid parameter, False otherwise.
Usage:
gtrending [--json] <command> [<args>]
# Sort repos by stars
gtrending repos --sort stars
# See only python repositories
gtrending repos --language python
# See weekly trending repos
gtrending repos --since weekly --sort forks
# Print output in json format (-j/--json)
gtrending repos --json
# See trending rust developers
gtrending developers --language rust
# See available coding languages
gtrending langs
# See available spoken languages
gtrending spoken-langs
# Help commands
gtrending --help
# or see available arguments for specific sub-command
gtrending developers --help
## Usage with jq
# Show only fullname (user/repo) and total stars for each repo
gtrending repos --json | jq '[.[] | {fullname, stars}]' # Still a json output
# Show only fullname for repos
gtrending repos --json | jq '.[] | .fullname' # Not a json anymore
# Similarly for trending developers
# Show only username and repository url
gtrending developers -j | jq '.[] | {username, repo: .repo.url}'
# Show only developers with a sponsorUrl
gtrending developers -j | jq 'map(select(.sponsorUrl != null)) | .[] | {username, repo_name: .repo.name}'
- github-trending-api -- JavaScript library with API
- requests -- Making API requests