Skip to main content

Pygister

A Python tool to interact with GitHub Gists. This tool allows you to create, read, update, and sync Gists directly from the command line.

Features

  • Create a new Gist from a local file.
  • Read the content of a Gist by its ID.
  • Update an existing Gist with the content of a local file.
  • Synchronize a local file with a remote Gist, keeping them in sync at regular intervals.
  • Print the version of the pygister library.

Installation

Using pip

You can install pygister directly from the source:

pip install -e .

Using setup.py

To install using the setup.py script:

python setup.py install

Usage

Command Line Interface

Print the version

To print the version of the pygister library:

pygist version

Create a Gist

To create a new Gist from a local file and return the short URL of the new Gist:

pygist push <filename>

Read a Gist

To read the content of a Gist by its ID and print it to stdout:

pygist read <ID>

Update a Gist

To update an existing Gist with the content of a local file:

pygist push <filename> <ID>

Sync a Local File with a Gist

To synchronize a local file with a remote Gist every specified number of seconds:

pygist sync <ID> <Seconds>
  • If the local file does not exist, it will be created.
  • If the local file is newer, it will update the Gist.
  • If the Gist is newer, it will update the local file.
  • The process will run in a loop every <Seconds> and will gracefully shut down on receiving CTRL-C.

Example Usage

  1. Create a Gist:

    pygist push example.txt
    
  2. Read a Gist:

    pygist read 1234567890abcdef1234567890abcdef
    
  3. Update a Gist:

    pygist push example.txt 1234567890abcdef1234567890abcdef
    
  4. Sync a Local File with a Gist:

    pygist sync 1234567890abcdef1234567890abcdef 60
    

    This command will sync the local file associated with the Gist ID every 60 seconds.

Development

Running Tests

To run tests:

pytest

Linting and Formatting

To lint and format the code:

make lint

Type Checking

To perform type checking:

make type-check

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Author

Farshid Ashouri - farsheed.ashouri@gmail.com

Metadata

Release files for pygister 0.1.5

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

Source distribution (sdist)

Source distribution for pygister 0.1.5
File Size Uploaded
pygister-0.1.5.tar.gz 8.8 kB Details

Built distribution (wheel)

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

Total release size: 12.0 kB

Release files / pygister-0.1.5.tar.gz

Download URL pygister-0.1.5.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bd9917e32aca431299ab0449f0c3e18eb56fcb941c1d04a11486fef998e73909
BLAKE2b-256 checksum
How to use checksums
c762688b727f58aecd55308477e5a0a7d33d2d5972eacf70a57817310003a53d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.4

Release files / pygister-0.1.5-py3-none-any.whl

Download URL pygister-0.1.5-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c608fc495dc068b20d84ec00053af37b752279e654d5a565e4dbfa434c2f33c
BLAKE2b-256 checksum
How to use checksums
8a30428098ec9afdc386844f4269fc8eb974e1b1382fe84d28f9319d00109172
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.1

2 release files

0.1.0

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