Skip to main content

A production-quality Python CLI for code templates

Project description

PySnips

PyPI Version 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.


Project Information


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
Click to see all 50+ templates

BASIC

  • for, while, if, ifelse, elif, try, tryfull, func, rfunc, listcomp, dictcomp, setcomp, lambda, maincheck, printfmt

MACHINE LEARNING

  • linear-reg, logistic-reg, knn, svm, decision-tree, random-forest, naive-bayes, kmeans, pca, model-eval

DEEP LEARNING

  • nn-basic, nn-compile, nn-train, cnn-basic, cnn-image, rnn-basic, lstm, dropout, predict, save-load-dl

ML PIPELINE

  • data-load, data-clean, train-test, scaler, pipeline

AI FULL-STACK

  • fastapi-app, route-get, route-post, ml-api, file-upload, json-response, async-api, db-connect, save-predict, logger

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.

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.3.tar.gz (11.5 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.3-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pysnips-0.1.3.tar.gz
  • Upload date:
  • Size: 11.5 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.3.tar.gz
Algorithm Hash digest
SHA256 1a2a6474aa22b0dd5f4e9aac54b2dbb6c790275248cf107be0aed9534ba50634
MD5 6f4d13eddf2320caeb71194605d9bc17
BLAKE2b-256 5a35044924d0b5a1a1ad0adc7bc38eb5a17c32b80f8aaea37f25a2057f4a060e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysnips-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 11.0 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4fb0a45541cc7949d8db3185e69d50657511975cfe2d570ab1f8ce239a984cc5
MD5 c03da9b3f8556964791384aa004f52a6
BLAKE2b-256 61215c354cdfc613c4e51b960d2872ede67003a54417ecd7a7d602101fe51d0a

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