Skip to content

Commit

Permalink
update user guide to include admonition on mypy config
Browse files Browse the repository at this point in the history
  • Loading branch information
fcogidi committed Feb 29, 2024
1 parent 45bf8c7 commit b3088d6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/source/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ Additional dependency groups can be installed using the `--with` flag. For examp
python3 -m poetry install --with docs,test
```

```{admonition} mypy configuration options
:class: important
By default, the `mypy` configuration in the `pyproject.toml` disallows subclassing
the `Any` type - `allow_subclassing_any = false`. In cases where the type checker
is not able to determine the types of objects in some external library (e.g. `PyTorch`),
it will treat them as `Any` and raise errors. If your codebase has many of such
cases, you can set `allow_subclassing_any = true` in the `mypy` configuration or
remove it entirely to use the default value (which is `true`). For example, in
a `PyTorch` project, subclassing `nn.Module` will raise errors if `allow_subclassing_any`
is set to `false`.
```


## pre-commit

You can use [pre-commit](https://pre-commit.com/) to run pre-commit hooks (code checks,
Expand Down

0 comments on commit b3088d6

Please sign in to comment.