Skip to main content

A production-quality Python CLI for code templates

Project description

PySnips

Python Version License: MIT Code Style: Black

PySnips is a high-performance, production-quality CLI tool designed to accelerate Python development. It provides a library of 50+ expertly crafted code templates spanning from core language syntax to advanced Machine Learning and AI Full-Stack architectures.


Key Features

  • 50+ Specialized Templates: Instantly generate boilerplate for Basic Python, ML, Deep Learning, and FastAPI.
  • Dynamic Injection: Fully customizable snippets using CLI flags (e.g., --name MyModel --lr 0.01).
  • Zero Dependencies: Built entirely on the Python Standard Library for maximum compatibility and minimal footprint.
  • Clean Architecture: Engineered with a modular registry system, making it easy to extend and maintain.
  • Developer First: Outputs clean, PEP-8 compliant code directly to your terminal or into a file.

Installation

The easiest way to install PySnips is via pip:

pip install pysnips

Install from Source

For development or local modifications:

git clone https://github.com/anusha-b2803/pysnips.git
cd pysnips
pip install -e .

Quick Start

1. Explore Available Snippets

List all 50+ available commands categorized by domain:

pysnips list

2. Generate a Python Function

pysnips func --name calculate_metrics --args "data, threshold"

3. Scaffold a FastAPI Application

Generate a complete API boilerplate and save it directly to a file:

pysnips fastapi-app --title "Predictive Analytics API" > main.py

4. Build a Machine Learning Pipeline

pysnips random-forest --n_estimators 200 > train.py

Category Overview

Category Description Examples
BASIC Core Python syntax & control flow for, tryfull, listcomp
MACHINE LEARNING Scikit-learn model boilerplates svm, random-forest, pca
DEEP LEARNING Keras/TensorFlow architectures cnn-image, lstm, nn-train
ML PIPELINE Data engineering & preprocessing scaler, train-test, pipeline
AI FULL-STACK FastAPI, DB connections & Logging fastapi-app, db-connect, ml-api

Project Architecture

PySnips is built with scalability in mind:

  • pysnips/cli.py: Advanced argument parsing and UI handling.
  • pysnips/registry.py: Centralized template management system.
  • pysnips/generator.py: Regex-powered dynamic template engine.
  • pysnips/utils/: Enhanced console formatting and color support.

Deployment

To package and distribute PySnips:

  1. Build Distribution:
    python -m build
    
  2. Upload to PyPI:
    python -m twine upload dist/*
    

License

Distributed under the MIT License. See LICENSE for more information.


Built for the Python Community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysnips-0.1.2.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysnips-0.1.2-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file pysnips-0.1.2.tar.gz.

File metadata

  • Download URL: pysnips-0.1.2.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for pysnips-0.1.2.tar.gz
Algorithm Hash digest
SHA256 53416a16b595d910393f40c3e70057475778807e4f28d5ab8d0ab4aa9314c7ed
MD5 912ddfae4f1296fd39256e4ef0229537
BLAKE2b-256 754dd845dc1aaba079d4b10afa36d117616f2f14caa94722745687ce10e8c72a

See more details on using hashes here.

File details

Details for the file pysnips-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pysnips-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for pysnips-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7a09fd58f25c07614791442af4305bbe436113961ead84a41879de9a2e2bc724
MD5 4f6a712acf42cb919f4da8ab10e30614
BLAKE2b-256 c4ab6807412389e5ede81c41756b96290732029a8e2a84a74ceec3cf6ff7ba52

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page