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).
  • IDE Integration: Install snippets natively into VS Code for "type and enter" expansion.
  • Jupyter Magic: Type keywords in notebooks and expand them instantly with %load_ext pysnips.
  • Zero Dependencies: Core CLI is built entirely on the Python Standard Library.
  • Clean Architecture: Engineered with a modular registry system, making it easy to extend and maintain.

Installation

The easiest way to install PySnips is via pip:

pip install pysnips

To enable Jupyter Notebook support:

pip install "pysnips[notebook]"

🚀 Usage & Integration

1. VS Code Integration (Native Snippets)

Install all templates into VS Code to enable "type and enter" expansion:

pysnips install --vscode

Example: In any .py file, type linear-reg and press Enter to expand the full template.

2. Jupyter & Notebook Magic

Enable auto-expansion in your Jupyter cells:

%load_ext pysnips

# Type the keyword and run the cell to expand!
linear-reg

3. CLI Command Line

Explore and generate snippets directly:

pysnips list
pysnips for --item i --iterable "range(10)"

4. Python Library API

Use pysnips in your own scripts:

import pysnips
snippet = pysnips.get("for", item="idx")
snippet.show() # Renders beautifully in Notebooks

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

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.4.tar.gz (14.3 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.4-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pysnips-0.1.4.tar.gz
  • Upload date:
  • Size: 14.3 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.4.tar.gz
Algorithm Hash digest
SHA256 eafa40d88d6b17ed27b371a3c9322c152e0093cb1b183eb212f84d72457e8d6b
MD5 8a97b563267a3036ece694d55a635651
BLAKE2b-256 0313efa31492d24445baef32e25ac3d943c2fe8cf6669e3b9a0f7aa25aa8003e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysnips-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 14.5 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9e69258b32fdcf66b63dd6b69273e01f2e5b6663e8b3cb1564af6b51144ad05a
MD5 e37c9e1736a6e438de527a0d1975ecd2
BLAKE2b-256 83f0da62584ead58ddf6b4d83735e4a034e1754c49e87358952af1e2c40d3b1e

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