.. raw:: html
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!
Plugin
======
**pysheeet** is available as a Claude Code plugin. Once installed, Claude
automatically uses the cheat sheets to answer Python questions — just ask
naturally and the skill triggers based on context.
Installation
------------
**As a Claude Code plugin (recommended):**
.. code-block:: bash
# Step 1: Add the marketplace
claude plugin marketplace add crazyguitar/pysheeet
# Step 2: Install the plugin
claude plugin install pysheeet@pysheeet
**Local testing (single session only):**
.. code-block:: bash
claude --plugin-dir /path/to/pysheeet
**Manual installation (requires cloning the repo):**
.. code-block:: bash
git clone https://github.com/crazyguitar/pysheeet.git
mkdir -p ~/.claude/skills
cp -r pysheeet/skills/py ~/.claude/skills/py
Python Interview Cheatsheet
===========================
Curated Python interview questions indexed by topic — each question links
directly to the section of the cheat sheet that answers it. Use it for quick
review before an interview, or to drill down on a specific area (GIL, asyncio,
decorators, MRO, and more).
- `Python Interview Cheatsheet `_
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 `_.
- `New in Python3 `_
Cheat Sheet
===========
Core Python fundamentals including data types, functions, classes, and commonly
used patterns for everyday programming tasks.
- `From Scratch `_
- `Future `_
- `Typing `_
- `Class `_
- `Function `_
- `Unicode `_
- `List `_
- `Set `_
- `Dictionary `_
- `Heap `_
- `Generator `_
- `Regular expression `_
System
======
Date/time handling, file I/O, and operating system interfaces.
- `Datetime `_ - Timestamps, formatting, parsing, timezones, timedelta
- `Files and I/O `_ - Reading, writing, pathlib, shutil, tempfile
- `Operating System `_ - Processes, environment, system calls
Concurrency
===========
Threading, multiprocessing, and concurrent.futures for parallel execution.
Covers synchronization primitives, process pools, and bypassing the GIL.
- `Threading `_ - Threads, locks, semaphores, events, conditions
- `Multiprocessing `_ - Processes, pools, shared memory, IPC
- `concurrent.futures `_ - Executors, futures, callbacks
Asyncio
=======
Asynchronous programming with Python's ``asyncio`` module. Covers coroutines,
event loops, tasks, networking, and advanced patterns.
- `A Hitchhiker's Guide to Asynchronous Programming `_ - Design philosophy and evolution
- `Asyncio Basics `_ - Coroutines, tasks, gather, timeouts
- `Asyncio Networking `_ - TCP/UDP servers, HTTP, SSL/TLS
- `Asyncio Advanced `_ - Synchronization, queues, subprocesses
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.
- `ctypes `_ - Load shared libraries without compilation
- `Python C API `_ - Traditional C extension reference
- `Modern C/C++ Extensions `_ - pybind11, Cython
- `Learn C++ from Python `_ - Modern C++ for Python developers
Security
========
Modern cryptographic practices and common security vulnerabilities. Covers
encryption, TLS/SSL, and why legacy patterns are dangerous.
- `Modern Cryptography `_ - AES-GCM, RSA-OAEP, Ed25519, Argon2
- `TLS/SSL and Certificates `_ - HTTPS servers, certificate generation
- `Common Vulnerabilities `_ - Padding oracle, injection, timing attacks
Network
=======
Low-level network programming with Python sockets. Covers TCP/UDP communication,
server implementations, asynchronous I/O, SSL/TLS encryption, and packet analysis.
- `Socket Basics `_
- `Socket Servers `_
- `Async Socket I/O `_
- `SSL/TLS Sockets `_
- `Packet Sniffing `_
- `SSH and Tunnels `_
Database
========
Database access with SQLAlchemy, Python's most popular ORM. Covers connection
management, raw SQL, object-relational mapping, and common query patterns.
- `SQLAlchemy Basics `_
- `SQLAlchemy ORM `_
- `SQLAlchemy Query Recipes `_
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
- `Megatron `_ - NVIDIA Megatron training/fine-tuning framework with enroot/pyxis
- `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 and Ray for distributed computing on GPU clusters.
- `Slurm `_
- `Ray Cluster `_
Blog
====
Supplementary topics covering Python internals, debugging techniques, and
language features that don't fit elsewhere.
- `NCCL Multi-Rail Broadcast with More GPU Ranks `_
- `NVSHMEM Multi-NIC Support with AWS EFA `_
- `Is Disaggregated Prefill/Decode a Silver Bullet for LLM Serving? `_
- `Monitoring EFA with NCCL GIN and Nsys `_
- `GPU-Initiated Networking for NCCL on AWS `_
- `PEP 572 and the walrus operator `_
- `Python Interpreter in GNU Debugger `_
PDF Version
============
`pdf`_
.. _pdf: https://media.readthedocs.org/pdf/pysheeet/latest/pysheeet.pdf
How to run the server
=======================
.. code-block:: bash
$ virtualenv venv
$ . venv/bin/activate
$ pip install -r requirements.txt
$ make
$ python app.py
# URL: localhost:5000