Skip to content

crazyguitar/pysheeet

Repository files navigation


pysheeet

Build Status Coverage License MIT DOI

Introduction

This project was started to bring together useful Python code snippets that make coding faster, easier, and more enjoyable. You can explore all the cheat sheets at Pysheeet. Contributions are always welcome—feel free to fork the repo and submit a pull request to help it grow!

/py Skill

pysheeet includes Claude Skills integration for intelligent access to Python cheat sheets directly within Claude Code and Claude.ai.

Installation

# Install globally for Claude Code
mkdir -p ~/.claude/skills
cp -r skills ~/.claude/skills/py

# Once installed, simply ask Claude any Python question and the ``/py``
# skill will automatically provide relevant examples and documentation
# from this cheat sheet collection.

What's New In Python 3

This part only provides a quick glance at some important features in Python 3. If you're interested in all of the most important features, please read the official document, What’s New in Python.

Cheat Sheet

Core Python fundamentals including data types, functions, classes, and commonly used patterns for everyday programming tasks.

System

Date/time handling, file I/O, and operating system interfaces.

Concurrency

Threading, multiprocessing, and concurrent.futures for parallel execution. Covers synchronization primitives, process pools, and bypassing the GIL.

Asyncio

Asynchronous programming with Python's asyncio module. Covers coroutines, event loops, tasks, networking, and advanced patterns.

C/C++ Extensions

Native extensions for performance-critical code. Covers modern pybind11 (used by PyTorch, TensorFlow), ctypes, cffi, Cython, and the traditional Python C API. Also includes a guide for Python developers learning modern C++ syntax.

Security

Modern cryptographic practices and common security vulnerabilities. Covers encryption, TLS/SSL, and why legacy patterns are dangerous.

Network

Low-level network programming with Python sockets. Covers TCP/UDP communication, server implementations, asynchronous I/O, SSL/TLS encryption, and packet analysis.

Database

Database access with SQLAlchemy, Python's most popular ORM. Covers connection management, raw SQL, object-relational mapping, and common query patterns.

LLM

Large Language Models (LLM) training, inference, and optimization. Covers PyTorch for model development, distributed training across GPUs, and vLLM/SGLang for high-performance LLM inference and serving.

  • PyTorch - Tensors, autograd, neural networks, training loops
  • Distributed Training - Multi-GPU training, DDP, FSDP, DeepSpeed
  • LLM Serving - vLLM and SGLang for production inference with TP/PP/DP/EP
  • LLM Benchmark - Benchmark suite for measuring serving performance

HPC

High-Performance Computing tools for cluster management and job scheduling. Covers Slurm workload manager for distributed computing and GPU clusters.

Appendix

Supplementary topics covering Python internals, debugging techniques, and language features that don't fit elsewhere.

PDF Version

pdf

How to run the server

$ virtualenv venv
$ . venv/bin/activate
$ pip install -r requirements.txt
$ make
$ python app.py

# URL: localhost:5000

About

Python Cheat Sheet

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 44