Skip to content

Commit

Permalink
Drop typed-ast as is no longer maintained/used (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat committed Jul 21, 2023
1 parent 89988e6 commit a417158
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
24 changes: 0 additions & 24 deletions README.md
Expand Up @@ -111,27 +111,3 @@ creates a circular import problem. The solution to this is the following:
2. Use forward references in the type annotations (e.g. `def methodname(self, param1: 'othermodule.OtherClass'):`)

On Python 3.7, you can even use `from __future__ import annotations` and remove the quotes.

## Using type hint comments

If you\'re documenting code that needs to stay compatible with Python 2.7, you cannot use regular type annotations.
Instead, you must either be using Python 3.8 or later or have [typed_ast](https://pypi.org/project/typed-ast/)
installed. The package extras `type_comments` will pull in the appropriate dependencies automatically. Then you can add
type hint comments in the following manner:

```python
def myfunction(arg1, arg2):
# type: (int, str) -> int
return 42
```

or alternatively:

```python
def myfunction(
arg1, # type: int
arg2, # type: str
):
# type: (...) -> int
return 42
```
3 changes: 0 additions & 3 deletions pyproject.toml
Expand Up @@ -56,9 +56,6 @@ optional-dependencies.testing = [
"sphobjinv>=2.3.1",
"typing-extensions>=4.6.3",
]
optional-dependencies.type-comment = [
'typed-ast>=1.5.4; python_version < "3.8"',
]
urls.Changelog = "https://github.com/tox-dev/sphinx-autodoc-typehints/blob/main/CHANGELOG.md"
urls.Homepage = "https://github.com/tox-dev/sphinx-autodoc-typehints"
urls.Source = "https://github.com/tox-dev/sphinx-autodoc-typehints"
Expand Down

0 comments on commit a417158

Please sign in to comment.