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/yourusername/pysnips.git
cd py-pkg
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.1.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.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pysnips-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 f070ebd187bb3e515971776c48882e8a050943a4da77f0d04149e7f191a8e42d
MD5 395386090150e479d727424ef52d3b02
BLAKE2b-256 998a2e47b7329d129a2385ff0fe6ce963e91ef0f4e5ed3ab595f06b7c6c34532

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysnips-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8ab75780c282cfc8efd00f6dfab61ff3b8cba41537859e4000c3749219675f4c
MD5 deefff1658683e5622258c0c2090adab
BLAKE2b-256 e86d135b808dc1ec4cb0fd4c89c484bec32e1dfc36b3b1c5cc3dd362a83f0e5d

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