Skip to content

Commit c6f1583

Browse files
authored
Update tool configurations (#162)
* Move isort and pytest config * Update isort config * Move and update mypy config
1 parent 8b433bf commit c6f1583

5 files changed

Lines changed: 56 additions & 52 deletions

File tree

pyproject.toml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,55 @@
22
requires = ["setuptools~=60.5", "wheel~=0.37.1"]
33
build-backend = "setuptools.build_meta"
44

5+
[tool.isort]
6+
# https://pycqa.github.io/isort/docs/configuration/options.html
7+
multi_line_output = 4
8+
line_length = 72
9+
combine_as_imports = true
10+
force_sort_within_sections = true
11+
known_first_party = [
12+
"python_typing_update",
13+
"tests",
14+
]
15+
forced_separate = ["tests"]
16+
517
[tool.pytest.ini_options]
18+
testpaths = ["tests"]
19+
norecursedirs = ["fixtures"]
20+
console_output_style = "count"
21+
log_level = "NOTSET"
622
asyncio_mode = "auto" # https://github.com/pytest-dev/pytest-asyncio#modes
23+
24+
[tool.mypy]
25+
# https://mypy.readthedocs.io/en/stable/config_file.html
26+
python_version = 3.8
27+
show_error_codes = true
28+
ignore_missing_imports = true
29+
strict = true
30+
follow_imports = "normal"
31+
exclude = "tests/fixtures/.+\\.py"
32+
# Untyped definitions and calls
33+
disallow_untyped_calls = true
34+
disallow_untyped_defs = true
35+
disallow_incomplete_defs = true
36+
check_untyped_defs = true
37+
# None and optional handeling
38+
no_implicit_optional = true
39+
strict_optional = true
40+
# Configure warnings
41+
warn_redundant_casts = true
42+
warn_unused_ignores = true
43+
warn_unused_configs = true
44+
# Misc
45+
implicit_reexport = false
46+
strict_equality = true
47+
enable_error_code = ["ignore-without-code"]
48+
# TODO
49+
allow_any_generics = true
50+
51+
# [[tool.mypy.overrides]]
52+
# module = "tests.*"
53+
# # Untyped definitions and calls
54+
# disallow_untyped_calls = false
55+
# disallow_untyped_defs = false
56+
# disallow_incomplete_defs = false

python_typing_update/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
import argparse
77
import asyncio
88
import builtins
9-
import io
10-
import logging
119
from collections.abc import Iterable
1210
from functools import partial
11+
import io
1312
from io import StringIO
13+
import logging
1414

1515
import aiofiles
16-
import reorder_python_imports
1716
from autoflake import _main as autoflake_main
1817
from isort.main import main as isort_main
1918
from pyupgrade._main import main as pyupgrade_main
19+
import reorder_python_imports
2020

2121
from .const import FileAttributes, FileStatus
2222
from .utils import (

python_typing_update/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
from __future__ import annotations
55

66
import asyncio
7+
from collections.abc import Iterable
78
import os
9+
from pathlib import Path
810
import token
911
import tokenize
10-
from collections.abc import Iterable
11-
from pathlib import Path
1212
from typing import TextIO
1313

1414
from .const import FileStatus

setup.cfg

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -52,49 +52,3 @@ extend_exclude =
5252
.vscode,
5353
tests/fixtures,
5454
venv*,
55-
56-
[tool:pytest]
57-
testpaths = tests
58-
norecursedirs = fixtures
59-
console_output_style = count
60-
log_level = NOTSET
61-
62-
[tool:isort]
63-
# https://github.com/PyCQA/isort/wiki/isort-Settings
64-
multi_line_output = 4
65-
line_length = 72
66-
known_first_party =
67-
python_typing_update, tests
68-
forced_separate =
69-
tests
70-
combine_as_imports = true
71-
72-
[mypy]
73-
# https://mypy.readthedocs.io/en/stable/config_file.html
74-
python_version = 3.8
75-
ignore_missing_imports = true
76-
follow_imports = normal
77-
exclude = tests/fixtures/.+\.py
78-
# Untyped definitions and calls
79-
disallow_untyped_calls = true
80-
disallow_untyped_defs = true
81-
disallow_incomplete_defs = true
82-
check_untyped_defs = true
83-
# None and optional handeling
84-
no_implicit_optional = true
85-
strict_optional = true
86-
# Configure warnings
87-
warn_redundant_casts = true
88-
warn_unused_ignores = true
89-
warn_unused_configs = true
90-
# Misc
91-
implicit_reexport = false
92-
strict_equality = true
93-
# TODO
94-
allow_any_generics = true
95-
96-
[mypy-tests.*]
97-
# Untyped definitions and calls
98-
disallow_untyped_calls = false
99-
disallow_untyped_defs = false
100-
disallow_incomplete_defs = false

tests/test_main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
from collections.abc import AsyncGenerator
44
from contextlib import asynccontextmanager
55

6+
from _pytest.capture import CaptureFixture
67
import aiofiles
78
import pytest
8-
from _pytest.capture import CaptureFixture
99

1010
from python_typing_update.__main__ import async_main
1111
from python_typing_update.utils import async_restore_files

0 commit comments

Comments
 (0)