mirror of
https://github.com/astral-sh/ty.git
synced 2025-12-23 08:48:09 +00:00
Initial section
This commit is contained in:
parent
ef3d48ac4a
commit
6dc83fb2b2
2 changed files with 40 additions and 0 deletions
39
docs/reference/type-system-features.md
Normal file
39
docs/reference/type-system-features.md
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<!-- markdownlint-disable -->
|
||||
|
||||
# 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) |
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue