From b23d89509c91294505acd0172c66315ad64a23b3 Mon Sep 17 00:00:00 2001 From: Vinta Chen Date: Sun, 8 Nov 2026 20:40:02 +0800 Subject: [PATCH 1/3] style: audit Built-in Classes Enhancement Split the flat list by job, since demoting bidict left 1 obvious choice and 3 challengers, over the 2-challenger cap. Class Boilerplate: attrs. Mappings: python-box promoted to obvious (5,756,670 downloads/month); bidict demoted to Second Tier, since python-socketio hard-depends on it and accounts for 21.4M of its 23.0M on pypistats, leaving about 1.6M of its own. UUID: uuid-utils, kept on judgment (most of its count comes from langsmith and langchain-core depending on it). Description fixes for attrs, bidict, and python-box. No removals. Figures: ClickPy fetched 2026-11-08 unless marked pypistats (same date). Co-Authored-By: Claude --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c041a46f..c9559cc7 100644 --- a/README.md +++ b/README.md @@ -1050,10 +1050,13 @@ _Implementations of Python._ _Libraries for enhancing Python built-in classes._ -- [attrs](https://github.com/python-attrs/attrs) - Replacement for `__init__`, `__eq__`, `__repr__`, etc. boilerplate in class definitions. -- [bidict](https://github.com/jab/bidict) - Efficient, Pythonic bidirectional map data structures and related functionality. -- [uuid-utils](https://github.com/aminalaee/uuid-utils) - A fast, Rust-backed drop-in replacement for Python's built-in `uuid` module. -- [python-box](https://github.com/cdgriffith/Box) - Python dictionaries with advanced dot notation access. +- Class Boilerplate + - [attrs](https://github.com/python-attrs/attrs) - Writes `__init__`, `__eq__`, `__repr__`, and other boilerplate methods for your classes. +- Mappings + - [python-box](https://github.com/cdgriffith/Box) - Python dictionaries with advanced dot-notation access. + - [bidict](https://github.com/jab/bidict) - Efficient, Pythonic bidirectional map data structures. +- UUID + - [uuid-utils](https://github.com/aminalaee/uuid-utils) - A fast, Rust-backed drop-in replacement for Python's built-in `uuid` module. ### Functional Programming From 6b39e514e1079ccf67ccc6e98e126a83f4f9d25d Mon Sep 17 00:00:00 2001 From: Vinta Chen Date: Sun, 8 Nov 2026 20:40:47 +0800 Subject: [PATCH 2/3] feat: add dataclasses to Built-in Classes Enhancement Comparisons treat dataclasses as the default for class boilerplate and attrs as the upgrade for validators, converters, and slots. Co-Authored-By: Claude --- README.md | 1 + website/data/pypi_name_overrides.json | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index c9559cc7..7a37c4b9 100644 --- a/README.md +++ b/README.md @@ -1051,6 +1051,7 @@ _Implementations of Python._ _Libraries for enhancing Python built-in classes._ - Class Boilerplate + - [dataclasses](https://docs.python.org/3/library/dataclasses.html) - (Python standard library) Adds generated special methods such as `__init__()` and `__repr__()` to your classes. - [attrs](https://github.com/python-attrs/attrs) - Writes `__init__`, `__eq__`, `__repr__`, and other boilerplate methods for your classes. - Mappings - [python-box](https://github.com/cdgriffith/Box) - Python dictionaries with advanced dot-notation access. diff --git a/website/data/pypi_name_overrides.json b/website/data/pypi_name_overrides.json index 0ee6dfa6..ee534c13 100644 --- a/website/data/pypi_name_overrides.json +++ b/website/data/pypi_name_overrides.json @@ -6,6 +6,7 @@ "concurrent-futures": { "package": null, "reason": "stdlib module" }, "conda": { "package": null, "reason": "installed via Miniforge or Anaconda installers; PyPI conda is a stale 2017 upload" }, "cpython": { "package": null, "reason": "not pip-installable; the cpython PyPI name was squatted" }, + "dataclasses": { "package": null, "reason": "stdlib module; PyPI dataclasses is the Python 3.6 backport" }, "devpi": { "package": "devpi-server", "reason": "devpi is a deprecated metapackage; the server package carries real usage" }, "difflib": { "package": null, "reason": "stdlib module" }, "django-ai-plugins": { "package": null, "reason": "GitHub-only so far; young project, remap if it publishes" }, From 259bf48e3f2da5b74ad06f4a1b4a5f473908a3e3 Mon Sep 17 00:00:00 2001 From: Vinta Chen Date: Sun, 8 Nov 2026 20:41:27 +0800 Subject: [PATCH 3/3] docs: add dataclasses to Built-in Classes Enhancement category intro Co-Authored-By: Claude --- website/data/category_intros/built-in-classes-enhancement.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/website/data/category_intros/built-in-classes-enhancement.md b/website/data/category_intros/built-in-classes-enhancement.md index dfe74eed..418d3552 100644 --- a/website/data/category_intros/built-in-classes-enhancement.md +++ b/website/data/category_intros/built-in-classes-enhancement.md @@ -4,9 +4,12 @@ How to choose: - Classes with generated dunder methods, validators, and converters: attrs - Dicts read with dot notation, nested ones included: python-box +- Generated dunder methods with nothing to install: dataclasses - Looking up a key by its value, with both directions in sync: bidict - A faster drop-in for the `uuid` module: uuid-utils +The standard library's dataclasses [adds generated special methods](https://docs.python.org/3/library/dataclasses.html) such as `__init__()` and `__repr__()` to your classes. Put `@dataclass` on a class, and every class variable with a type annotation becomes a field. Pass `frozen=True` for [read-only instances](https://docs.python.org/3/library/dataclasses.html#frozen-instances). + attrs [writes the dunder methods](https://www.attrs.org/en/latest/) that implement object protocols, so you don't have to. For new code, its docs [recommend the modern API](https://www.attrs.org/en/latest/names.html#tl-dr): `@define` on the class and `field()` for an attribute, or `@frozen` for immutable instances, with slots on by default. Type annotations stay optional. The standard library's dataclasses [gave up features for simplicity](https://www.attrs.org/en/latest/why.html#data-classes), like validators and converters, so a class that needs them goes to attrs. It [isn't a full serialization library](https://www.attrs.org/en/latest/overview.html#what-attrs-is-not), though: to serialize and validate your attrs classes, its docs point you to its sibling project, cattrs. python-box installs Box, a [`dict` subclass](https://github.com/cdgriffith/Box) whose keys you can also read as attributes, even ones like `"imdb stars"`. Nested dicts and lists become Box and BoxList objects, so dot access works all the way down: `movie_box.Robin_Hood_Men_in_Tights.imdb_stars`. It [reads and writes JSON, YAML, TOML, and msgpack](https://github.com/cdgriffith/Box/wiki/Converters) with methods like `from_json()` and `to_json()`, and `to_dict()` gives you plain dicts back. Keep Box for data whose keys change: attrs' docs say a dict with a fixed and known set of keys [is an object, not a hash](https://www.attrs.org/en/latest/why.html#dicts), and belongs in a class.