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.
>>> check_language("python")
True
>>> check_language("Ruby")
True
>>> check_language("TeaScript") # Does not exist
False
>>> check_language("")
False
check_spoken_language_code()
Validate the spoken language code parameter:
>>> check_spoken_language_code("es")
True
>>> check_spoken_language_code("FR")
True
>>> check_spoken_language_code("ZZ") # Does not exist
False
>>> check_spoken_language_code("")
False
check_since()
Check if the time range is correct — it must be daily, weekly, or monthly —
case-insensitive.
For more API usage details, go read the docs!
CLI
Usage:
gtrending [--json] <command> [<args>]
Examples
# 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
Getting help
# 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
# Still a json output
gtrending repos --json | jq '[.[] | {fullname, stars}]'
# Show only fullname for repos
# Not a json anymore
gtrending repos --json | jq '.[] | .fullname'
# 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} ]'