Skip to content

Commit 4901c0c

Browse files
committed
Config changes to use our custom stubs
1 parent 0bc3248 commit 4901c0c

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

mypy.ini

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ disable_error_code =
1818

1919
## local
2020

21+
# Use our custom stubs for distutils
22+
mypy_path = $MYPY_CONFIG_FILE_DIR/typings
23+
2124
# CI should test for all versions, local development gets hints for oldest supported
2225
# But our testing setup doesn't allow passing CLI arguments, so local devs have to set this manually.
2326
# python_version = 3.8
@@ -48,17 +51,10 @@ disable_error_code =
4851
[mypy-pkg_resources.tests.*]
4952
disable_error_code = import-not-found
5053

51-
# - distutils doesn't exist on Python 3.12, unfortunately, this means typing
52-
# will be missing for subclasses of distutils on Python 3.12 until either:
53-
# - support for `SETUPTOOLS_USE_DISTUTILS=stdlib` is dropped (#3625)
54-
# for setuptools to import `_distutils` directly
55-
# - or non-stdlib distutils typings are exposed
56-
[mypy-distutils.*]
57-
ignore_missing_imports = True
58-
5954
# - wheel: does not intend on exposing a programmatic API https://github.com/pypa/wheel/pull/610#issuecomment-2081687671
6055
[mypy-wheel.*]
6156
ignore_missing_imports = True
57+
6258
# - The following are not marked as py.typed:
6359
# - jaraco: Since mypy 1.12, the root name of the untyped namespace package gets called-out too
6460
# - jaraco.develop: https://github.com/jaraco/jaraco.develop/issues/22

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ type = [
133133

134134
# local
135135

136+
# Referenced in distutils-stubs
137+
"types-docutils",
136138
# pin mypy version so a new version doesn't suddenly cause the CI to fail,
137139
# until types-setuptools is removed from typeshed.
138140
# For help with static-typing issues, or mypy update, ping @Avasam
@@ -203,6 +205,8 @@ include-package-data = true
203205
include = [
204206
"setuptools*",
205207
"pkg_resources*",
208+
# TODO: Include distutils stubs with package once we're confident in them
209+
# "typings/distutils-stubs",
206210
"_distutils_hack*",
207211
]
208212
exclude = [

pyrightconfig.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
],
1313
// Our testing setup doesn't allow passing CLI arguments, so local devs have to set this manually.
1414
// "pythonVersion": "3.8",
15+
// Allow using distutils-stubs on Python 3.12+
16+
"reportMissingModuleSource": false,
1517
// For now we don't mind if mypy's `type: ignore` comments accidentally suppresses pyright issues
1618
"enableTypeIgnoreComments": true,
1719
"typeCheckingMode": "basic",

ruff.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ ignore = [
3434
# Only enforcing return type annotations for public functions
3535
"ANN202", # missing-return-type-private-function
3636
"ANN204", # missing-return-type-special-method
37+
# Typeshed doesn't want complex or non-literal defaults for maintenance and testing reasons.
38+
# This doesn't affect us, let's have more complete stubs.
39+
"PYI011", # typed-argument-default-in-stub
3740

3841
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
3942
"W191",

0 commit comments

Comments
 (0)