GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - stas00/python-cookbook: Stas' Python Cookbook - Python recipes that I use daily

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
build
build
 
 
content
content
 
 
images
images
 
 
.gitignore
.gitignore
 
 
LICENSE-CC-BY-SA
LICENSE-CC-BY-SA
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
SKILL.md
SKILL.md
 
 
chapters-md.txt
chapters-md.txt
 
 
python.txt
python.txt
 
 

Repository files navigation

Stas' Python Cookbook

An open book of practical, example-driven recipes for the Python standard library and the idioms that come up again and again in real work — text wrangling, data structures, files and processes, debugging, profiling, testing, and packaging.

This book grew out of a personal cheat sheet. Every section leads with the why, then shows the how with runnable snippets, and calls out the gotchas that bite people in practice. It targets Python 3.8+, and notes version specifics where they matter.

This is based on the python cheat sheet that I have been honing since many years and still refer to it daily. I then used Claude to convert it to more readable prose, that is hopefully more enjoyable to read. If you prefer the raw/dense cheat sheet you can find it here.

Table of Contents

The full cookbook is in content/, organized into four parts:

  1. Part I: Language Core - strings and text, formatting, numbers, regex, lists, tuples, sets, dictionaries, comprehensions/itertools, functions, classes, dates and times.

  2. Part II: Runtime and Environment - modules and imports, files/paths/IO, environment and arguments, subprocess, serialization, concurrency, networking.

  3. Part III: Debugging, Profiling and Testing - output and logging, debugging, introspection, profiling, exceptions, testing.

  4. Part IV: Packaging and Tooling - versions and dependencies, packaging, code quality, scaling pointers, and an appendix of one-liners.

Updates

I announce any significant updates on my twitter channel https://twitter.com/StasBekman.

Ebook versions of the book

You can download various ebook formats of this book:

  • PDF
  • EPUB

I will try to rebuild these once in a few weeks or so, but if you want the latest ebook versions, the instructions for building are here.

SKILL.md for AI agents

I maintain a SKILL.md file that you can use to teach your AI agent everyday Python and standard-library idioms better.

See also the companion skills: Machine Learning Engineering and The Art of Debugging.

Related Open Books

  • Machine Learning Engineering Open Book — training and operating large-scale ML models.
  • The Art of Debugging Open Book — methodologies and recipes for debugging Unix, Python and PyTorch programs.

Contributing

If you found a bug, typo or would like to propose an improvement please don't hesitate to open an Issue or contribute a PR.

License

The content of this site is distributed under Attribution-ShareAlike 4.0 International.

My repositories map

✔ Books: Machine Learning Engineering | The Art of Debugging | Stas' Python Cookbook

✔ Applications: ipyexperiments

✔ Tools and Cheatsheets: bash | conda | git | jupyter-notebook | make | python | tensorboard | unix

✔ Other Machine Learning: ML ways | Porting

About

Stas' Python Cookbook - Python recipes that I use daily

Topics

pythonrecipes

Resources

Readme
CC-BY-SA-4.0 license
Activity

Stars

68 stars

Watchers

0 watching

Forks

10 forks
Report repository

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.