Skip to content

Commit

Permalink
Fix links broken by pyright removing their transform spec
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Apr 16, 2023
1 parent bef2f52 commit dadc020
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -285,7 +285,7 @@ See https://github.com/python-attrs/attrs/blob/main/.github/CONTRIBUTING.md#chan
See the [new docs on comparison](https://www.attrs.org/en/stable/comparison.html) for more details.
[#787](https://github.com/python-attrs/attrs/issues/787)

- Added **provisional** support for static typing in `pyright` via the [dataclass_transforms specification](https://github.com/microsoft/pyright/blob/main/specs/dataclass_transforms.md).
- Added **provisional** support for static typing in `pyright` via [PEP 681](https://peps.python.org/pep-0681/).
Both the `pyright` specification and `attrs` implementation may change in future versions of both projects.

Your constructive feedback is welcome in both [attrs#795](https://github.com/python-attrs/attrs/issues/795) and [pyright#1782](https://github.com/microsoft/pyright/discussions/1782).
Expand Down
3 changes: 0 additions & 3 deletions docs/conf.py
Expand Up @@ -20,9 +20,6 @@
r"https://github.com/.*/(issues|pull)/\d+",
# Rate limits and the latest tag is missing anyways on release.
"https://github.com/python-attrs/attrs/tree/.*",
# It never finds the anchor even though it's there.
"https://github.com/microsoft/pyright/blob/main/specs/"
"dataclass_transforms.md#attrs",
]

# In nitpick mode (-n), still ignore any of the following "broken" references
Expand Down
9 changes: 1 addition & 8 deletions docs/extending.md
Expand Up @@ -94,7 +94,7 @@ You can only use this trick to tell *Mypy* that a class is actually an *attrs* c

### Pyright

Generic decorator wrapping is supported in [*Pyright*](https://github.com/microsoft/pyright) via their [`dataclass_transform`] specification.
Generic decorator wrapping is supported in [*Pyright*](https://github.com/microsoft/pyright) via `dataclass_transform` / {pep}`689`.

For a custom wrapping of the form:

Expand All @@ -118,11 +118,6 @@ def __dataclass_transform__(
def custom_define(f): ...
```

:::{warning}
`dataclass_transform` is supported **provisionally** as of `pyright` 1.1.135.

Both the *Pyright* [`dataclass_transform`] specification and *attrs* implementation may change in future versions.
:::

## Types

Expand Down Expand Up @@ -332,5 +327,3 @@ It has the signature
>>> json.dumps(data)
'{"dt": "2020-05-04T13:37:00"}'
```

[`dataclass_transform`]: https://github.com/microsoft/pyright/blob/main/specs/dataclass_transforms.md
5 changes: 1 addition & 4 deletions docs/types.md
Expand Up @@ -73,7 +73,7 @@ class SomeClass:

## Pyright

*attrs* provides support for [*Pyright*] though the [`dataclass_transform`] specification.
*attrs* provides support for [*Pyright*] through the `dataclass_transform` / {pep}`681` specification.
This provides static type inference for a subset of *attrs* equivalent to standard-library {mod}`dataclasses`,
and requires explicit type annotations using the {func}`attrs.define` or `@attr.s(auto_attribs=True)` API.

Expand All @@ -94,13 +94,10 @@ The *Pyright* inferred types are a tiny subset of those supported by *Mypy*, inc

- The `attrs.frozen` decorator is not typed with frozen attributes, which are properly typed via `attrs.define(frozen=True)`.

A [full list](https://github.com/microsoft/pyright/blob/main/specs/dataclass_transforms.md#attrs) of limitations and incompatibilities can be found in *Pyright*'s repository.

Your constructive feedback is welcome in both [attrs#795](https://github.com/python-attrs/attrs/issues/795) and [pyright#1782](https://github.com/microsoft/pyright/discussions/1782).
Generally speaking, the decision on improving *attrs* support in *Pyright* is entirely Microsoft's prerogative, though.
:::

[`dataclass_transform`]: https://github.com/microsoft/pyright/blob/main/specs/dataclass_transforms.md
[*Mypy*]: http://mypy-lang.org
[*Pyright*]: https://github.com/microsoft/pyright
[*pytype*]: https://google.github.io/pytype/

0 comments on commit dadc020

Please sign in to comment.