Skip to content

Commit

Permalink
docs: Document pydantic support
Browse files Browse the repository at this point in the history
  • Loading branch information
sondrelg committed Jan 4, 2022
1 parent 3c5b088 commit 0e56de1
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,48 @@ so please only choose one.

To select one of the ranges, just specify the code in your flake8 config:

```
```ini
[flake8]
max-line-length = 80
max-complexity = 12
...
ignore = E501
select = C,E,F,W,..., TC, TC2 # or TC1
# alternatively:
# You can use 'select':
select = C,E,F..., TC, TC2 # or TC1
# or 'enable-extensions':
enable-extensions = TC, TC2 # or TC1
```

## Configuration

The plugin currently only has one setting:
These options are configurable,
and can be set in your flake8 config.

### Exempt modules

If you wish to exempt certain modules from
needing to be moved into type-checking blocks, you can specify which
modules to ignore.

- `type-checking-exempt-modules`: Specify a list of modules to ignore TC001/TC002 errors from.
Could be useful if you, e.g., want to handle big libraries, but prefer not to handle `typing` imports.
- **setting name**: `type-checking-exempt-modules`
- **type**: `list`

```ini
[flake8]
type-checking-exempt-modules: typing, typing_extensions # default []
```

### Pydantic support

If you use Pydantic models in your code, you should enable Pydantic support.
This will treat any class variable annotation as being needed during runtime.

- **name**: `type-checking-pydantic-enabled`
- **type**: `bool`
```ini
[flake8]
type-checking-pydantic-enabled: true # default false
```

## Rationale

Expand Down

0 comments on commit 0e56de1

Please sign in to comment.