CLI for downloading all gists from a specified user.
Project description
gist-neko
CLI for downloading all gists from a specified user.
Installation
Via PyPI (Recommended)
pip install gist-neko
From Source (Development)
git clone git@github.com:NecRaul/gist-neko.git
cd gist-neko
# You can skip the next two commands
# for installing it globally
python -m venv .venv
source .venv/bin/activate
pip install -e .[dev,build]
Usage
gist-neko acts as a sync tool. If a gist folder doesn't exist, it clones it, if it does, it updates it.
# Download/Sync public gists with `requests`
gist-neko -u <github-username>
# Download/Sync public and private gists with `requests` (using a token)
gist-neko -u <github-username> -t <github-personal-access-token>
# Use 'git clone/pull' instead of 'requests' (preserves history, branches and submodules)
gist-neko -u <github-username> -g
# Use 'git' with a token for private gist syncing
gist-neko -u <github-username> -t <github-personal-access-token> -g
Environment Variables
You can save your credentials to environment variables to avoid passing them manually in every command.
# Set your credentials as environment variables
gist-neko -gu <github-username> -gpat <github-personal-access-token>
# Run using the stored environment variables
gist-neko -e
# Run using environment variables with the git engine
gist-neko -e -g
[!WARNING] The
-guand-gpatflags for setting environment variables only work on Windows.It is recommended to set
$GITHUB_USERNAMEand$GITHUB_PERSONAL_ACCESS_TOKENvariables in your shell profile.
Options
-u, --username USERNAME GitHub username to download gists from
-t, --token TOKEN GitHub personal access token (required for private gists)
-e, --environment - Use stored environment variables for username and token
-g, --git - Use git engine instead of requests (handles history/branches/submodules)
-gu, --gusername USERNAME Save the GitHub username to your environment variables
-gpat, --gpat TOKEN Save the GitHub token to your environment variables
[!TIP] The
-eand-gflags are a boolean toggle.
Dependencies
- requests: fetch data from the GitHub API and handle downloads.
How it works
The tool queries the https://api.github.com/users/{username}/gists endpoint. It retrieves public Gists when unauthenticated, or both public and private Gists when an authentication token is provided.
Once the gist list is retrieved, gist-neko automates the synchronization process using one of two engines:
- Requests Engine (Default): Fetches the gist as a compressed snapshot. This is fast but does not include history, branches or submodules.
- Git Engine (via
-gor--gitflag): Uses your local git installation to perform a full clone or pull This preserves the complete history, branches and submodules.
The Manual Way
Without this tool, you would need to manually parse JSON responses, manage authentication headers, and write logic to differentiate between new clones and existing updates:
# A simplified version of the logic gist-neko automates
# It fetches the id and description, then loops through them
curl -s -H "Authorization: token $GITHUB_PERSONAL_ACCESS_TOKEN" https://api.github.com/users/NecRaul/gists |
jq -r '.[] | "\(.description // .id) \(.id)"' | while read -r name id; do
if [ ! -d "$name" ]; then
git clone --recursive "git@gist.github.com:$id.git" "$name"
else
echo "Pulling '$name'..."
git -C "$name" pull --recurse-submodules
fi
done
The gist-neko way
- Dynamic API Routing: Automatically identifies the correct GitHub endpoint. It uses
/users/{username}/gistsfor browsing, ensuring that when authenticated, you get the full list of both public and private gists you have permission to view. - State-Aware Syncing: Instead of a simple download, it checks your local file system using the gist's description or ID as the folder name. If a gist already exists, it intelligently switches to an "update" mode (using
git pullor overwriting viarequests) to keep your local mirror current. - Hybrid Engine Support:
- Lightweight Mode: Uses
requeststo pull gist snapshots quickly without needinggitinstalled or SSH keys configured. - Developer Mode (
-g): Interfaces directly with your localgitbinary to handle full history, branch tracking, and submodule recursion.
- Lightweight Mode: Uses
- Secure Credential Persistence: Rather than requiring you to paste tokens into every command, the
-guand-gpatflags securely interface with your environment variables, allowing for a clean, single-flag execution with-e. - Subprocess Management: Uses
Python'ssubprocessandosmodules to provide a robust bridge between theGitHub APIand your local shell, handling directory navigation and command execution automatically.`
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 gist_neko-1.26.tar.gz.
File metadata
- Download URL: gist_neko-1.26.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
525c96306edfc627c0d8a1e512edde56d05943b6d51308027287201669bd555b
|
|
| MD5 |
a73ca80e1d7b16d934a4522fa655b473
|
|
| BLAKE2b-256 |
81b4d24f3170d9fd224f6af05218bfb5b04cbabf8341be315839d305a5e53588
|
Provenance
The following attestation bundles were made for gist_neko-1.26.tar.gz:
Publisher:
publish.yml on NecRaul/gist-neko
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gist_neko-1.26.tar.gz -
Subject digest:
525c96306edfc627c0d8a1e512edde56d05943b6d51308027287201669bd555b - Sigstore transparency entry: 791389535
- Sigstore integration time:
-
Permalink:
NecRaul/gist-neko@9885c2d0b29e4bd145966d2c1ad9ba69480cfc8b -
Branch / Tag:
refs/heads/release - Owner: https://github.com/NecRaul
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9885c2d0b29e4bd145966d2c1ad9ba69480cfc8b -
Trigger Event:
push
-
Statement type:
File details
Details for the file gist_neko-1.26-py3-none-any.whl.
File metadata
- Download URL: gist_neko-1.26-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e71b68bcc6159c3846bc8085bf64139dcbb76e43b8e770b70ce3f049dea5af4
|
|
| MD5 |
cd12c391c2a2d4a4901aefd66908137b
|
|
| BLAKE2b-256 |
7306d8ee7165aa0e0c4bb346be127e0dc84b8bc96f51770eb91cc8dbb9386dc2
|
Provenance
The following attestation bundles were made for gist_neko-1.26-py3-none-any.whl:
Publisher:
publish.yml on NecRaul/gist-neko
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gist_neko-1.26-py3-none-any.whl -
Subject digest:
2e71b68bcc6159c3846bc8085bf64139dcbb76e43b8e770b70ce3f049dea5af4 - Sigstore transparency entry: 791389539
- Sigstore integration time:
-
Permalink:
NecRaul/gist-neko@9885c2d0b29e4bd145966d2c1ad9ba69480cfc8b -
Branch / Tag:
refs/heads/release - Owner: https://github.com/NecRaul
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9885c2d0b29e4bd145966d2c1ad9ba69480cfc8b -
Trigger Event:
push
-
Statement type: