From 6dc83fb2b2f4192d942e3442ca874a90e9802dbe Mon Sep 17 00:00:00 2001 From: David Peter Date: Sat, 13 Dec 2025 11:19:46 +0100 Subject: [PATCH] Initial section --- docs/reference/type-system-features.md | 39 ++++++++++++++++++++++++++ mkdocs.yml | 1 + 2 files changed, 40 insertions(+) create mode 100644 docs/reference/type-system-features.md diff --git a/docs/reference/type-system-features.md b/docs/reference/type-system-features.md new file mode 100644 index 0000000..7b8b8e1 --- /dev/null +++ b/docs/reference/type-system-features.md @@ -0,0 +1,39 @@ + + +# Type system features + +This page summarizes the support for various type system features in ty. + +## Dataclasses + +[Official documentation](https://typing.python.org/en/latest/spec/dataclasses.html) + +| Feature | Status | +| :-------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------- | +| `@dataclass` decorator (`init`, `repr`, `eq`, `order`, `frozen`, `match_args`, `kw_only`, `slots`, `weakref_slot`, `unsafe_hash`) | ✅ | +| `field()` (`default`, `default_factory`, `init`, `kw_only`, `doc`, `repr`, `hash`, `compare`) | ✅ | +| `InitVar[…]`, `ClassVar[…]` exclusion, `KW_ONLY` sentinel | ✅ | +| `fields()`, `__dataclass_fields__` | ✅ | +| `Final` fields | ✅ | +| Inheritance, generic dataclasses, descriptor-typed fields | ✅ | +| `replace()`, `__replace__` | ⚠️ `__replace__` works, `replace()` returns `Unknown` | +| `asdict()` | ⚠️ incorrectly accepts class objects | +| `astuple()` | ⚠️ not tested | +| `make_dataclass()`, `is_dataclass()` | ⚠️ not tested | +| Diagnostic: frozen dataclass inheriting from non-frozen | ⚠️ not tested | +| Diagnostic: non-default field after default field | ❌ [#111](https://github.com/astral-sh/ty/issues/111) | +| Diagnostic: `order=True` with custom comparison methods | ❌ [#111](https://github.com/astral-sh/ty/issues/111) | +| Diagnostic: `frozen=True` with `__setattr__`/`__delattr__` | ❌ [#111](https://github.com/astral-sh/ty/issues/111) | +| `__post_init__` signature validation | ❌ [#111](https://github.com/astral-sh/ty/issues/111) | + +## `dataclass_transform` + +[Official documentation](https://typing.python.org/en/latest/spec/dataclasses.html#dataclass-transform) + +| Feature | Status | +| ---------------------------------------------------------------------------------------- | ------------------------------------------------------- | +| Function-based, metaclass-based, base-class-based transformers | ✅ | +| `eq_default`, `order_default`, `kw_only_default` parameters | ✅ | +| `frozen_default` parameter | ⚠️ metaclass override not working | +| `field_specifiers` (`init`, `default`, `default_factory`, `factory`, `kw_only`, `alias`) | ✅ | +| `field_specifiers` (`converter`) | ❌ [#1327](https://github.com/astral-sh/ty/issues/1327) | diff --git a/mkdocs.yml b/mkdocs.yml index 5fa13cc..ab43db2 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -98,6 +98,7 @@ nav: - Exit codes: reference/exit-codes.md - Environment variables: reference/environment.md - Editor settings: reference/editor-settings.md + - Type system features: reference/type-system-features.md validation: omitted_files: warn absolute_links: warn