Ask HN: High quality Python scripts or small libraries to learn from

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  1. openai-cookbook

    Examples and guides for using the OpenAI API

    https://github.com/openai/openai-cookbook/blob/main/examples...

  2. CodeRabbit

    CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.

    CodeRabbit logo
  3. ruff

    An extremely fast Python linter and code formatter, written in Rust.

    I think I mention this all the time when this comes up, but I learned the most 'best practices' through using ruff.

    https://docs.astral.sh/ruff/

    I just installed and enabled all the rules by setting

  4. simonw

    https://simonwillison.net/2020/Jul/10/self-updating-profile-readme/

    Everything @simonw has worked on, honestly: https://github.com/simonw

  5. datasette

    An open source multi-tool for exploring and publishing data

    Simon Willison's github would be a great place to get started imo -

    https://github.com/simonw/datasette

  6. sqlite-utils

    Python CLI utility and library for manipulating SQLite databases

    https://github.com/simonw/sqlite-utils

    So, his code might not be a good place to find best patterns (for ex, I don't think they are fully typed), but his repos are very pragmatic, and his development process is super insightful (well documented PRs for personal repos!). Best part, he blogs about every non-trivial update, so you get all the context!

  7. elements-of-python-style

    Goes beyond PEP8 to discuss what makes Python code feel great. A Strunk & White for Python.

    I had 2 suggestions (plus a blog post) in my style guide here:

    https://github.com/amontalenti/elements-of-python-style#some...

    The style guide itself, published a few years back, also has some suggestions with small code snippets.

  8. beyond-jupyter

    Software design principles for machine learning applications

    If you're looking for some best practices related but limited to machine learning application code, you could have a look at [Beyond Jupyter](https://github.com/aai-institute/beyond-jupyter)

    Here's an excerpt from the readme:

  9. SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  10. pytudes

    Python programs, usually short, of considerable difficulty, to perfect particular skills.

    Peter Norvig's work is great to learn from https://github.com/norvig/pytudes

  11. Flask

    The Python micro framework for building web applications.

    I'd suggest Flask or some of the smaller projects in the Pallets ecosystem:

    https://github.com/pallets/flask

  12. pytheus

    experimenting with a new prometheus client for python

    I don't know if I can consider my code "Great" but I dedicated way too many months on a prometheus library where I focused on quality since I did it for me.

    It's relatively small and I think the main take away would be the use of Protocols for the pluggable backend system. I hope you get something out of it :)

    https://github.com/Llandy3d/pytheus

  13. tasktiger

    Python task queue using Redis

    I've recently looked at tasktiger https://github.com/closeio/tasktiger. It's a simple queue system that helped me understand how workers and schedulers work.

  14. starcel-panda3d

    Check out https://github.com/recursion-computing/starcel-panda3D for bleeding edge Python OS development

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Welcome to Datasette Cloud

    6 projects | news.ycombinator.com | 20 Aug 2023
  • SQLite Functions for Working with JSON

    10 projects | news.ycombinator.com | 10 Aug 2023
  • I'm sure I'm being stupid.. Copying data from an API and making a database

    2 projects | /r/Database | 19 Jan 2023
  • Ask HN: What Do You Use for a Personal Database

    4 projects | news.ycombinator.com | 16 Nov 2022
  • Big data, CSV file exploration. How do you do it? Here's my way

    2 projects | /r/Python | 28 Oct 2022

Did you know that Python is
the 2nd most popular programming language
based on number of references?