Skip to content

Commit a15df83

Browse files
committed
merge ty_all and pyrefly_strict
1 parent 841a9ca commit a15df83

75 files changed

Lines changed: 682 additions & 388 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/comment_commands.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
actions: write
1717
checks: write
1818
# if more commands are added, they will need to be added here too as we don't have access to env at this stage
19-
if: (github.event.issue.pull_request) && contains(fromJSON('["/pandas_nightly", "/mypy_nightly", "/pyrefly_strict", "/pyrefly_all", "/ty_all"]'), github.event.comment.body) && github.event.comment.author_association == 'MEMBER'
19+
if: (github.event.issue.pull_request) && contains(fromJSON('["/pandas_nightly", "/mypy_nightly", "/pyrefly_all"]'), github.event.comment.body) && github.event.comment.author_association == 'MEMBER'
2020

2121
steps:
2222
- name: Resolve comment command
@@ -34,18 +34,10 @@ jobs:
3434
echo "poe_command=mypy --mypy_nightly" >> "${GITHUB_OUTPUT}"
3535
echo "check_name=Mypy nightly tests" >> "${GITHUB_OUTPUT}"
3636
;;
37-
/pyrefly_strict)
38-
echo "poe_command=pyrefly_strict" >> "${GITHUB_OUTPUT}"
39-
echo "check_name=Pyrefly tests strict preset" >> "${GITHUB_OUTPUT}"
40-
;;
4137
/pyrefly_all)
4238
echo "poe_command=pyrefly_all" >> "${GITHUB_OUTPUT}"
4339
echo "check_name=Pyrefly tests all preset" >> "${GITHUB_OUTPUT}"
4440
;;
45-
/ty_all)
46-
echo "poe_command=ty_all" >> "${GITHUB_OUTPUT}"
47-
echo "check_name=Ty tests all rules raising errors" >> "${GITHUB_OUTPUT}"
48-
;;
4941
*)
5042
echo "Unknown command: ${COMMENT_BODY}" >&2
5143
exit 1

.github/workflows/optional.yml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,6 @@ jobs:
5151
- name: Run mypy tests with mypy nightly
5252
run: poetry run poe mypy --mypy_nightly
5353

54-
pyrefly_strict:
55-
runs-on: ubuntu-latest
56-
timeout-minutes: 10
57-
58-
steps:
59-
- uses: actions/checkout@v7
60-
61-
- name: Install project dependencies
62-
uses: ./.github/setup
63-
with:
64-
os: ubuntu-latest
65-
python-version: '3.14'
66-
67-
- name: Run pyrefly tests with preset 'strict'
68-
run: poetry run poe pyrefly_strict
69-
7054
pyrefly_all:
7155
runs-on: ubuntu-latest
7256
timeout-minutes: 10
@@ -82,19 +66,3 @@ jobs:
8266

8367
- name: Run pyrefly tests with preset 'all'
8468
run: poetry run poe pyrefly_all
85-
86-
ty_all:
87-
runs-on: ubuntu-latest
88-
timeout-minutes: 10
89-
90-
steps:
91-
- uses: actions/checkout@v7
92-
93-
- name: Install project dependencies
94-
uses: ./.github/setup
95-
with:
96-
os: ubuntu-latest
97-
python-version: '3.14'
98-
99-
- name: Run ty tests with all rules raising errors
100-
run: poetry run poe ty_all

docs/tests.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,11 @@ The following tests are **optional**. Some of them are run by the CI but it is o
2121

2222
- Run pytest against pandas nightly: `poe pytest --nightly`
2323
- Use mypy nightly to validate the annotations: `poe mypy --mypy_nightly`
24-
- Use pyrefly with [preset](https://pyrefly.org/en/docs/configuration/#preset) 'strict': `poe pyrefly_strict`
2524
- Use pyrefly with preset 'all': `poe pyrefly_all`
26-
- Use ty with [all rules raising errors](https://docs.astral.sh/ty/rules/#rule-levels): `poe ty_all`
2725
- Run stubtest to compare the installed pandas-stubs against pandas (this will fail): `poe stubtest`. If you have created an allowlist to ignore certain errors: `poe stubtest path_to_the_allow_list`
2826

2927
Among the tests above, the following can be run directly during a PR by commenting in the discussion.
3028

3129
- Run pytest against pandas nightly by commenting `/pandas_nightly`
3230
- Use mypy nightly to validate the annotations by commenting `/mypy_nightly`
33-
- Use pyrefly with preset 'strict': `/pyrefly_strict`
3431
- Use pyrefly with preset 'all': `/pyrefly_all`
35-
- Use ty with all rules raising errors: `/ty_all`

pandas-stubs/_config/config.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ from typing import (
1010
type_check_only,
1111
)
1212

13+
from typing_extensions import override
14+
1315
def get_option(pat: str) -> Any: ...
1416
@overload
1517
def set_option(*args: dict[str, Any]) -> None: ...
@@ -70,10 +72,12 @@ def describe_option(pat: str, _print_desc: Literal[True] = True) -> None: ...
7072

7173
class DictWrapper:
7274
def __init__(self, d: dict[str, Any], prefix: str = "") -> None: ...
75+
@override
7376
def __setattr__(
7477
self, key: str, val: str | bool | int | DictWrapper | None
7578
) -> None: ...
7679
def __getattr__(self, key: str) -> str | bool | int | DictWrapper | None: ...
80+
@override
7781
def __dir__(self) -> Iterable[str]: ...
7882

7983
@type_check_only

pandas-stubs/_libs/interval.pyi

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,17 @@ from typing import (
88
)
99

1010
import numpy as np
11-
from pandas import (
12-
IntervalIndex,
13-
Series,
14-
Timedelta,
15-
Timestamp,
16-
)
1711
from pandas._stubs_only import (
1812
OrderableScalarT,
1913
OrderableT,
2014
OrderableTimesT,
2115
)
16+
from pandas.core.indexes.interval import IntervalIndex
17+
from pandas.core.series import Series
18+
from typing_extensions import override
2219

20+
from pandas._libs.tslibs.timedeltas import Timedelta
21+
from pandas._libs.tslibs.timestamps import Timestamp
2322
from pandas._typing import (
2423
IntervalClosedType,
2524
IntervalT,
@@ -78,6 +77,7 @@ class Interval(IntervalMixin, Generic[OrderableT]):
7877
right: OrderableT,
7978
closed: IntervalClosedType = "right",
8079
) -> Self: ...
80+
@override
8181
def __hash__(self) -> int: ...
8282
@overload
8383
def __contains__(self: Interval[int], key: float | np.floating) -> bool: ...
@@ -191,18 +191,24 @@ class Interval(IntervalMixin, Generic[OrderableT]):
191191
@overload
192192
def __le__(self: IntervalT, other: IntervalIndex[IntervalT]) -> np_1darray_bool: ...
193193
@overload
194-
def __eq__(self, other: Interval[OrderableT]) -> bool: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
194+
@override
195+
def __eq__(self, other: Interval[OrderableT]) -> bool: ... # type: ignore[overload-overlap]
195196
@overload
196197
def __eq__(self: IntervalT, other: IntervalIndex[IntervalT]) -> np_1darray_bool: ...
197198
@overload
198199
def __eq__(self, other: Series[OrderableT]) -> Series[bool]: ... # type: ignore[overload-overlap]
199200
@overload
200-
def __eq__(self, other: object) -> Literal[False]: ...
201+
def __eq__( # pyright: ignore[reportOverlappingOverload]
202+
self, other: object
203+
) -> Literal[False]: ...
201204
@overload
202-
def __ne__(self, other: Interval[OrderableT]) -> bool: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
205+
@override
206+
def __ne__(self, other: Interval[OrderableT]) -> bool: ... # type: ignore[overload-overlap]
203207
@overload
204208
def __ne__(self: IntervalT, other: IntervalIndex[IntervalT]) -> np_1darray_bool: ...
205209
@overload
206210
def __ne__(self, other: Series[OrderableT]) -> Series[bool]: ... # type: ignore[overload-overlap]
207211
@overload
208-
def __ne__(self, other: object) -> Literal[True]: ...
212+
def __ne__( # pyright: ignore[reportOverlappingOverload]
213+
self, other: object
214+
) -> Literal[True]: ...

pandas-stubs/_libs/missing.pyi

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@ import numpy as np
1111
from pandas.core.arrays.boolean import BooleanArray
1212
from pandas.core.indexes.base import Index
1313
from pandas.core.series import Series
14+
from typing_extensions import override
1415

1516
from pandas._typing import Scalar
1617

1718
@final
1819
class NAType:
1920
def __new__(cls, *args: Any, **kwargs: Any) -> Self: ...
21+
@override
2022
def __format__(self, format_spec: str) -> str: ...
23+
@override
2124
def __hash__(self) -> int: ...
25+
@override
2226
def __reduce__(self) -> str: ...
2327
@overload
2428
def __add__(self, other: Series, /) -> Series: ...
@@ -107,19 +111,19 @@ class NAType:
107111
@overload
108112
def __rdivmod__(self, other: Scalar, /) -> tuple[NAType, NAType]: ...
109113
@overload # type: ignore[override]
110-
def __eq__( # pyrefly: ignore[bad-override]
111-
self, other: Series, /
112-
) -> Series[bool]: ...
114+
@override
115+
# pyrefly: ignore[bad-override]
116+
def __eq__(self, other: Series, /) -> Series[bool]: ...
113117
@overload
114118
def __eq__(self, other: Index, /) -> BooleanArray: ...
115119
@overload
116120
def __eq__( # pyright: ignore[reportIncompatibleMethodOverride] # ty: ignore[invalid-method-override]
117121
self, other: Scalar, /
118122
) -> NAType: ...
119123
@overload # type: ignore[override]
120-
def __ne__( # pyrefly: ignore[bad-override]
121-
self, other: Series, /
122-
) -> Series[bool]: ...
124+
@override
125+
# pyrefly: ignore[bad-override]
126+
def __ne__(self, other: Series, /) -> Series[bool]: ...
123127
@overload
124128
def __ne__(self, other: Index, /) -> BooleanArray: ...
125129
@overload

pandas-stubs/_libs/tslibs/nattype.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ from typing import (
1111
)
1212

1313
import numpy as np
14+
from typing_extensions import override
1415

1516
from pandas._libs.tslibs.period import Period
1617
from pandas._typing import (
@@ -34,6 +35,7 @@ class _NatComparison:
3435
@final
3536
class NaTType:
3637
value: np.int64
38+
@override
3739
def __hash__(self) -> int: ...
3840
def asm8(self) -> np.datetime64: ...
3941
def to_datetime64(self) -> np.datetime64: ...
@@ -147,7 +149,9 @@ class NaTType:
147149
# inject Period properties
148150
@property
149151
def qyear(self) -> float: ...
152+
@override
150153
def __eq__(self, other: object) -> bool: ...
154+
@override
151155
def __ne__(self, other: object) -> bool: ...
152156
__lt__: _NatComparison
153157
__le__: _NatComparison

pandas-stubs/_libs/tslibs/offsets.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ from typing import (
1515

1616
from dateutil.relativedelta import weekday as WeekdayClass
1717
import numpy as np
18-
from pandas import Timestamp
18+
from typing_extensions import override
1919

20+
from pandas._libs.tslibs.timestamps import Timestamp
2021
from pandas._typing import (
2122
ShapeT,
2223
np_ndarray_object,
@@ -32,8 +33,11 @@ class ApplyTypeError(TypeError): ...
3233
class BaseOffset:
3334
n: int
3435
def __init__(self, n: int = ..., normalize: bool = ...) -> None: ...
36+
@override
3537
def __eq__(self, other: object) -> bool: ...
38+
@override
3639
def __ne__(self, other: object) -> bool: ...
40+
@override
3741
def __hash__(self) -> int: ...
3842
@property
3943
def kwds(self) -> dict[str, Any]: ...
@@ -107,6 +111,7 @@ class SingleConstructorOffset(BaseOffset): ...
107111
class Tick(SingleConstructorOffset):
108112
def __init__(self, n: int = ..., normalize: bool = ...) -> None: ...
109113
@property
114+
@override
110115
def nanos(self) -> int: ...
111116

112117
class Day(Tick): ...

pandas-stubs/_libs/tslibs/period.pyi

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ from pandas.core.indexes.base import Index
1111
from pandas.core.indexes.period import PeriodIndex
1212
from pandas.core.indexes.timedeltas import TimedeltaIndex
1313
from pandas.core.series import Series
14+
from typing_extensions import override
1415

1516
from pandas._libs.tslibs import NaTType
1617
from pandas._libs.tslibs.offsets import BaseOffset
@@ -80,15 +81,18 @@ class Period(PeriodMixin):
8081
# ignore[misc] here because we know all other comparisons
8182
# are False, so we use Literal[False]
8283
@overload
83-
def __eq__(self, other: Self) -> bool: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
84+
@override
85+
def __eq__(self, other: Self) -> bool: ... # type: ignore[overload-overlap]
8486
@overload
8587
def __eq__(self, other: Index) -> np_1darray_bool: ... # type: ignore[overload-overlap]
8688
@overload
8789
def __eq__(self, other: Series[Period]) -> Series[bool]: ... # type: ignore[overload-overlap]
8890
@overload
8991
def __eq__(self, other: np_ndarray_object[ShapeT]) -> np_ndarray_bool[ShapeT]: ... # type: ignore[overload-overlap]
9092
@overload
91-
def __eq__(self, other: object) -> Literal[False]: ...
93+
def __eq__( # pyright: ignore[reportOverlappingOverload]
94+
self, other: object
95+
) -> Literal[False]: ...
9296
@overload
9397
def __ge__(self, other: Self) -> bool: ...
9498
@overload
@@ -124,15 +128,18 @@ class Period(PeriodMixin):
124128
# ignore[misc] here because we know all other comparisons
125129
# are False, so we use Literal[False]
126130
@overload
127-
def __ne__(self, other: Self) -> bool: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
131+
@override
132+
def __ne__(self, other: Self) -> bool: ... # type: ignore[overload-overlap]
128133
@overload
129134
def __ne__(self, other: Index) -> np_1darray_bool: ... # type: ignore[overload-overlap]
130135
@overload
131136
def __ne__(self, other: Series[Period]) -> Series[bool]: ... # type: ignore[overload-overlap]
132137
@overload
133138
def __ne__(self, other: np_ndarray_object[ShapeT]) -> np_ndarray_bool[ShapeT]: ... # type: ignore[overload-overlap]
134139
@overload
135-
def __ne__(self, other: object) -> Literal[True]: ...
140+
def __ne__( # pyright: ignore[reportOverlappingOverload]
141+
self, other: object
142+
) -> Literal[True]: ...
136143
@property
137144
def day(self) -> int: ...
138145
@property
@@ -144,6 +151,7 @@ class Period(PeriodMixin):
144151
@property
145152
def days_in_month(self) -> int: ...
146153
@property
154+
@override
147155
def end_time(self) -> Timestamp: ...
148156
@property
149157
def freq(self) -> BaseOffset: ...
@@ -166,6 +174,7 @@ class Period(PeriodMixin):
166174
@property
167175
def is_leap_year(self) -> bool: ...
168176
@property
177+
@override
169178
def start_time(self) -> Timestamp: ...
170179
@property
171180
def week(self) -> int: ...

0 commit comments

Comments
 (0)