Skip to main content

Alt text

Project Snippify

Snippify is a Python library designed to simplify the creation, management, and usage of code snippets. With Snippify, you can save snippets of code, organize them efficiently, and retrieve them with ease. It provides an intuitive API and enhances the user experience by beautifully formatted tables and colored terminal output.


Features :

  • List All Snippets: View all saved snippets in a well-formatted table.
  • Snip Objects: Snip Python objects (like classes) with detailed metadata such as title, author, version, and more.
  • Snip Code from Files: Snip specific lines of code from files using a range selector.
  • Search and Open Snippets: Search for snippets by title or unique ID and easily copy or open them.

Installation :

Install Snippify and its dependencies using pip:

pip install Snippify

Usage

1. Listing All Snippets

View all the snippets in a well-structured table format, complete with names and unique IDs. You can also quickly copy a snippet by selecting its index.

from Snippify.core.snippet import Snippet

snippet_obj = Snippet()
snippet_obj.ListAll()

2. Snipping an Object (Class Example)

Snip any Python object (e.g., classes), while assigning metadata like title, author, and version. The version is auto-generated if not provided.

class HelloWorld:
    def __init__(self) -> None: pass
    def say_hello(self) -> None: pass
    def say_goodbye(self) -> None: pass

snippet_obj.snipObject(HelloWorld, title="Hello World!", author="XYZ", version='3.12.4')

3. Snipping Code from a File

You can extract snippets from specific lines of code in a file by specifying ranges, such as 1-10, 15-20. If no file is specified, the current file is used.

snippet_obj.snipCode(title="Test Code", author="XYZ", lines='1-10')

4. Searching and Opening Snippets

Search for snippets by title or unique ID (UID). If multiple results are found for a title, you will be prompted to select the correct one. You can then copy the snippet directly.

snippet_obj.OpenSnippet(uid='bb8fa2ad80bf799465')

Example Code

Here’s an example of how to create and list snippets using Snippify:

python
from Snippify.core.snippet import Snippet

snippet_obj = Snippet()

# List all snippets
snippet_obj.ListAll()

# Snip a class object
class HelloWorld:
    def __init__(self) -> None: pass

snippet_obj.snipObject(HelloWorld, title="Hello World!", author="XYZ")

# Snip specific lines from a file
snippet_obj.snipCode(title="Important Code", author="ABC", lines='5-15')

# Search for and open a snippet
snippet_obj.OpenSnippet(uid='12345abcd')

License

Snippify is licensed under the GPL License. See the LICENSE file for more details.

Contact

For any questions, feature requests, or issues, please contact:

Author: Aditya Gaur

Email: adityagaur.home@gmail.com

GitHub: https://github.com/xdityagr/

Feel free to open issues or pull requests on GitHub for any improvements or bug fixes.

Release files for Snippify 1.0.2

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

Source distribution (sdist)

Source distribution for Snippify 1.0.2
File Size Uploaded
snippify-1.0.2.tar.gz 47.6 kB Details

Built distribution (wheel)

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

Total release size:84.1 kB

Release files / snippify-1.0.2.tar.gz

Download URL snippify-1.0.2.tar.gz
Size 47.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bc5405e5c0e0cb61aad13db9829f814bb9e4459843c96510a3b3fd246b0127bc
BLAKE2b-256 checksum
How to use checksums
50ace9dd7f39303f2d07d76a8f94bf5b9158c1fec64db4783c4cf38c3633e268
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.7

Release files / Snippify-1.0.2-py3-none-any.whl

Download URL Snippify-1.0.2-py3-none-any.whl
Size 36.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c8a10e29429904fb65003294fe5ff815197e73de5f3f6460b919b9d04295412d
BLAKE2b-256 checksum
How to use checksums
988493cde9fdee6ec9c2b6891cd90315555832b0d7df8928f9e20869164c9179
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.7

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.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