3255e7872b
Enable all flake8-logging-format rules ( #164655 )
...
These rules are enabled by removing existing suppressions.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164655
Approved by: https://github.com/janeyx99 , https://github.com/mlazos
2025-10-19 00:59:28 +00:00
fdab48a7c1
Enable all PIE rules on ruff ( #165814 )
...
This PR enables all PIE rules on ruff, there are already some enabled rules from this family, the new added rules are
```
PIE796 Enum contains duplicate value: {value}
PIE808 Unnecessary start argument in range
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165814
Approved by: https://github.com/ezyang
2025-10-18 07:36:18 +00:00
24520b8386
Revert "Enable all PIE rules on ruff ( #165814 )"
...
This reverts commit c79dfdc6550e872783aa5cb5fc9e86589bf18872.
Reverted https://github.com/pytorch/pytorch/pull/165814 on behalf of https://github.com/cyyever due to Need to cover more files ([comment](https://github.com/pytorch/pytorch/pull/165814#issuecomment-3417931863 ))
2025-10-18 07:21:08 +00:00
c79dfdc655
Enable all PIE rules on ruff ( #165814 )
...
This PR enables all PIE rules on ruff, there are already some enabled rules from this family, the new added rules are
```
PIE796 Enum contains duplicate value: {value}
PIE808 Unnecessary start argument in range
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165814
Approved by: https://github.com/ezyang
2025-10-18 06:40:12 +00:00
e595136187
Enable PLC1802 on ruff ( #165813 )
...
This PR enables ruff check `PLC1802`, which detects len calls on sequences in a boolean test context.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165813
Approved by: https://github.com/ezyang
2025-10-18 05:44:14 +00:00
e925dfcc6b
Enable all SIM rules except disabled ones ( #164645 )
...
`SIM` rules are useful for simplifying boolean expressions and enhances code readability.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164645
Approved by: https://github.com/ezyang , https://github.com/mlazos
2025-10-17 07:27:11 +00:00
8de85896e0
Enable ruff rule E721 ( #165162 )
...
`E721` checks for object type comparisons using == and other comparison operators. This is useful because it is recommended to use `is` for type comparisons.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165162
Approved by: https://github.com/Skylion007
2025-10-13 01:48:55 +00:00
816fb7f48d
Revert "Enable ruff rule E721 ( #165162 )"
...
This reverts commit 9e7c19f72b6d0690915c307409c0c0a76b5a3bf0.
Reverted https://github.com/pytorch/pytorch/pull/165162 on behalf of https://github.com/pytorch-auto-revert due to Reverted automatically by pytorch's autorevert, to avoid this behaviour add the tag autorevert: disable ([comment](https://github.com/pytorch/pytorch/pull/165162#issuecomment-3393328271 ))
2025-10-11 13:25:40 +00:00
9e7c19f72b
Enable ruff rule E721 ( #165162 )
...
`E721` checks for object type comparisons using == and other comparison operators. This is useful because it is recommended to use `is` for type comparisons.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165162
Approved by: https://github.com/Skylion007
2025-10-11 06:43:53 +00:00
f713abab16
Revert "Enable all flake8-logging-format rules ( #164655 )"
...
This reverts commit e98c4e835b1db22092fc93b49d2cddd7b3537d1f.
Reverted https://github.com/pytorch/pytorch/pull/164655 on behalf of https://github.com/malfet due to Looks like it broke lint in trunk, see bd3b98a8a5/1
([comment](https://github.com/pytorch/pytorch/pull/164655#issuecomment-3379209309 ))
2025-10-08 00:55:17 +00:00
e98c4e835b
Enable all flake8-logging-format rules ( #164655 )
...
These rules are enabled by removing existing suppressions.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164655
Approved by: https://github.com/janeyx99
2025-10-08 00:16:13 +00:00
d1a62c8036
[BE][Ez]: Enable RUF007 Prefer itertools.pairwise over zip slicing ( #164856 )
...
Now that our min version is 3.10 we can support this rule. This is more concise, readable, and efficient than the previous zip slicing.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164856
Approved by: https://github.com/williamwen42
2025-10-07 22:51:17 +00:00
5d7360bb03
Revert "Enable all SIM rules except disabled ones ( #164645 )"
...
This reverts commit 321e6026925f6b6e8a36e3a8b7c0295cd7541911.
Reverted https://github.com/pytorch/pytorch/pull/164645 on behalf of https://github.com/izaitsevfb due to causes lint failures ([comment](https://github.com/pytorch/pytorch/pull/164645#issuecomment-3369274351 ))
2025-10-05 19:32:21 +00:00
321e602692
Enable all SIM rules except disabled ones ( #164645 )
...
`SIM` rules are useful for simplifying boolean expressions and enhances code readability.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164645
Approved by: https://github.com/ezyang
2025-10-05 07:38:25 +00:00
cf0a00d4f3
Enable ruff FURB161 rule ( #164654 )
...
This PR enables FURB161 in ruff.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164654
Approved by: https://github.com/Skylion007
2025-10-04 23:26:28 +00:00
50d418f69f
Replace setup.py bdist_wheel with python -m build --wheel ( #156712 )
...
Previously we already replaced most use of `python setup.py develop/install`.
This PR also replaces the use of `setup.py bdist_wheel` with the modern `python -m build --wheel` alternative.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/156712
Approved by: https://github.com/atalman
ghstack dependencies: #156711
2025-09-29 21:51:32 +00:00
7441a1b9b1
Update ruff to 0.13.1 ( #163744 )
...
Update ruff to 0.13.1 so that we can remove `UP038` from `pyproject.toml` because it has been removed from supported rules of ruff.
There are some fixes, the most notable one is [(PYI059)](https://docs.astral.sh/ruff/rules/generic-not-last-base-class/#generic-not-last-base-class-pyi059 )
```
Checks for classes inheriting from typing.Generic[] where Generic[] is not the last base class in the bases tuple.
```
A BC-breaking change is introduced to change the typing of `OrderedSet .storage`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/163744
Approved by: https://github.com/Skylion007 , https://github.com/jingsh
2025-09-26 10:12:21 +00:00
7bad9c5a64
Revert "Update ruff to 0.13.1 ( #163744 )"
...
This reverts commit 3dd89a079f2b0c1d39351f98ff5d5ca882523152.
Reverted https://github.com/pytorch/pytorch/pull/163744 on behalf of https://github.com/malfet due to Broke lint, see https://github.com/pytorch/pytorch/actions/runs/18016220484/job/51261729375 looks like a landrace with PR that updated min-version to 3.10 ([comment](https://github.com/pytorch/pytorch/pull/163744#issuecomment-3335534084 ))
2025-09-25 18:54:03 +00:00
3dd89a079f
Update ruff to 0.13.1 ( #163744 )
...
Update ruff to 0.13.1 so that we can remove `UP038` from `pyproject.toml` because it has been removed from supported rules of ruff.
There are some fixes, the most notable one is [(PYI059)](https://docs.astral.sh/ruff/rules/generic-not-last-base-class/#generic-not-last-base-class-pyi059 )
```
Checks for classes inheriting from typing.Generic[] where Generic[] is not the last base class in the bases tuple.
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/163744
Approved by: https://github.com/Skylion007 , https://github.com/jingsh
2025-09-25 17:52:35 +00:00
f9fa138a39
[BE] Delete all pre py-3.10 checks ( #163653 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/163653
Approved by: https://github.com/jansel
ghstack dependencies: #163648 , #163649
2025-09-23 23:22:53 +00:00
0696a4b0b8
[EZ] Perma-ignore UP038 ( #163649 )
...
As it has been removed, see https://docs.astral.sh/ruff/rules/non-pep604-isinstance/
Pull Request resolved: https://github.com/pytorch/pytorch/pull/163649
Approved by: https://github.com/Skylion007
ghstack dependencies: #163648
2025-09-23 17:58:18 +00:00
ca35dc2fdd
[EZ] Fix UP041 violations ( #163648 )
...
I.e. use `TimeoutError` instead of `socket.timeout`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/163648
Approved by: https://github.com/cyyever , https://github.com/Skylion007
2025-09-23 17:58:18 +00:00
5e7be98800
[BE] Update Python min version to 3.10 ( #162310 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/162310
Approved by: https://github.com/atalman , https://github.com/Skylion007 , https://github.com/ZainRizvi
2025-09-22 17:04:21 +00:00
10adeb9044
Revert "[BE] Update Python min version to 3.10 ( #162310 )"
...
This reverts commit 9f5a644f0768258bc81f8b38492754d297399f74.
Reverted https://github.com/pytorch/pytorch/pull/162310 on behalf of https://github.com/malfet due to Broke lint, but to the best of my knowledge it's no longer possible to run lint for all files on PRs ([comment](https://github.com/pytorch/pytorch/pull/162310#issuecomment-3319289031 ))
2025-09-22 14:13:59 +00:00
9f5a644f07
[BE] Update Python min version to 3.10 ( #162310 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/162310
Approved by: https://github.com/atalman , https://github.com/Skylion007 , https://github.com/ZainRizvi
2025-09-22 13:37:02 +00:00
578047838c
Revert "[BE] Update Python min version to 3.10 ( #162310 )"
...
This reverts commit 3016616ccbba3dc9bb6a80eb4a81a846ddf49cc9.
Reverted https://github.com/pytorch/pytorch/pull/162310 on behalf of https://github.com/malfet due to Breaks some windows tests ([comment](https://github.com/pytorch/pytorch/pull/162862#issuecomment-3310606135 ))
2025-09-19 05:16:49 +00:00
3016616ccb
[BE] Update Python min version to 3.10 ( #162310 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/162310
Approved by: https://github.com/atalman , https://github.com/Skylion007 , https://github.com/ZainRizvi
ghstack dependencies: #162862
2025-09-19 04:28:56 +00:00
31345fb4f7
Make functorch notebook symlinks PEP 517 valid ( #157813 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/157813
Approved by: https://github.com/zou3519 , https://github.com/atalman
2025-09-12 03:52:08 +00:00
43b7c86a2c
Add dependency-groups.dev to pyproject.toml ( #161216 )
...
[PEP 735](https://peps.python.org/pep-0735 ) introduces the
[dependency-groups] table for a number of use-cases one of
which includes specifying development dependencies for projects.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/161216
Approved by: https://github.com/seemethere
2025-09-04 16:51:36 +00:00
178515d0ff
[BE][PYFMT] remove black
: finish black -> ruff format
migration ( #144557 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/144557
Approved by: https://github.com/ezyang
2025-08-08 07:46:10 +00:00
b935ad17d5
[BE][Easy] add missing Python 3.14 PyPI classifier ( #158904 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/158904
Approved by: https://github.com/albanD
2025-07-23 21:01:02 +00:00
d3f9107d68
Remove top limit for cpython version and fix lint appropriately. ( #158853 )
...
As per title.
Sorry for the churn in the main commit.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/158853
Approved by: https://github.com/seemethere , https://github.com/Skylion007 , https://github.com/jingsh , https://github.com/malfet , https://github.com/ZainRizvi
2025-07-22 23:59:00 +00:00
659bfbf443
Revert "We do support 3.14" ( #158856 )
...
Reverting to fix lint
This reverts commit 2a249f1967d29626fe6ac6a07f28440348d1cc93.
An emergency fix since the change needed to fix this is a little more complex than expected (see https://github.com/pytorch/pytorch/pull/158853 for reference)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/158856
Approved by: https://github.com/Camyll , https://github.com/atalman
2025-07-22 19:40:53 +00:00
2a249f1967
We do support 3.14
...
This has been added a bit back.
2025-07-22 10:40:18 -07:00
feaa02f9ad
Revert "[build] pin setuptools>=77
to enable PEP 639 ( #158104 )"
...
This reverts commit a78fb63dbdf98a1db219095293de1a11005e0390.
Reverted https://github.com/pytorch/pytorch/pull/158104 on behalf of https://github.com/malfet due to It still breaks inductor-perf-nightly, see https://github.com/pytorch/pytorch/actions/runs/16425364208/job/46417088208 , I'm going to dismiss all previous reviews ([comment](https://github.com/pytorch/pytorch/pull/158104#issuecomment-3099706457 ))
2025-07-21 22:46:53 +00:00
a78fb63dbd
[build] pin setuptools>=77
to enable PEP 639 ( #158104 )
...
For reference here is the link PEP 639: [peps.python.org/pep-0639](https://peps.python.org/pep-0639/ )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/158104
Approved by: https://github.com/rgommers , https://github.com/Skylion007 , https://github.com/atalman
2025-07-21 17:46:40 +00:00
5e1232871b
Revert "[build] pin setuptools>=77
to enable PEP 639 ( #158104 )"
...
This reverts commit a4ec381302f8acd279033707b182bed30ffd2091.
Reverted https://github.com/pytorch/pytorch/pull/158104 on behalf of https://github.com/malfet due to This break inductor-perf-nighly-macos by failing to build torchvision, see https://github.com/pytorch/pytorch/issues/158728 ([comment](https://github.com/pytorch/pytorch/pull/158104#issuecomment-3095048940 ))
2025-07-21 02:24:11 +00:00
a4ec381302
[build] pin setuptools>=77
to enable PEP 639 ( #158104 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/158104
Approved by: https://github.com/rgommers , https://github.com/Skylion007 , https://github.com/atalman
2025-07-18 11:49:54 +00:00
a0308edb6c
[build] remove wheel
from build requirements ( #158027 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/158027
Approved by: https://github.com/Skylion007
2025-07-12 16:45:51 +00:00
7a08755c5f
[BE][Ez]: Update ruff to 0.12.2 ( #157937 )
...
Updates to the latest version of ruff and apply some fixes that it flagged and silence a few new lints
Pull Request resolved: https://github.com/pytorch/pytorch/pull/157937
Approved by: https://github.com/ezyang
2025-07-11 15:16:20 +00:00
4283d96bcd
[build] pin setuptools>=70.1.0
for integrated bdist_wheel
command ( #157783 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/157783
Approved by: https://github.com/Skylion007
2025-07-11 12:10:42 +00:00
af3d069094
[BE][Easy] remove unused build-time dependency astunparse
and change astunparse.unparse
-> ast.unparse
( #157907 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/157907
Approved by: https://github.com/Skylion007
2025-07-10 07:04:42 +00:00
524e827095
[build] modernize build-backend: setuptools.build_meta:__legacy__
-> setuptools.build_meta
( #155998 )
...
Change `build-system.build-backend`: `setuptools.build_meta:__legacy__` -> `setuptools.build_meta`. Also, move static package info from `setup.py` to `pyproject.toml`.
Now the repo can be installed from source via `pip` command instead of `python setup.py develop`:
```bash
python -m pip install --verbose --editable .
python -m pip install --verbose --no-build-isolation --editable .
```
In addition, the SDist is also buildable:
```bash
python -m build --sdist
python -m install dist/torch-*.tar.gz # build from source using SDist
```
Note that we should build the SDist with a fresh git clone if we will upload the output to PyPI. Because all files under `third_party` will be included in the SDist. The SDist file will be huge if the git submodules are initialized.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/155998
Approved by: https://github.com/ezyang , https://github.com/cyyever , https://github.com/atalman
ghstack dependencies: #157557
2025-07-04 19:25:14 +00:00
2e64e45b0b
Revert "[build] modernize build-backend: setuptools.build_meta:__legacy__
-> setuptools.build_meta
( #155998 )"
...
This reverts commit 404008e3efdabeaf5b140a3aff77131461c33a0a.
Reverted https://github.com/pytorch/pytorch/pull/155998 on behalf of https://github.com/malfet due to Broke inductor_cpp, wrapper see e472daa809/1
([comment](https://github.com/pytorch/pytorch/pull/155998#issuecomment-3032915058 ))
2025-07-03 16:47:07 +00:00
404008e3ef
[build] modernize build-backend: setuptools.build_meta:__legacy__
-> setuptools.build_meta
( #155998 )
...
Change `build-system.build-backend`: `setuptools.build_meta:__legacy__` -> `setuptools.build_meta`. Also, move static package info from `setup.py` to `pyproject.toml`.
Now the repo can be installed from source via `pip` command instead of `python setup.py develop`:
```bash
python -m pip install --verbose --editable .
python -m pip install --verbose --no-build-isolation --editable .
```
In addition, the SDist is also buildable:
```bash
python -m build --sdist
python -m install dist/torch-*.tar.gz # build from source using SDist
```
Note that we should build the SDist with a fresh git clone if we will upload the output to PyPI. Because all files under `third_party` will be included in the SDist. The SDist file will be huge if the git submodules are initialized.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/155998
Approved by: https://github.com/ezyang , https://github.com/cyyever , https://github.com/atalman
2025-07-03 04:10:44 +00:00
90b973a2e2
[BE] parse CMake version from cmake -E capabilities
instead of cmake --version
( #157073 )
...
`cmake -E capabilities` produces a JSON format that is more machine-friendly.
```console
$ cmake --version
cmake version 4.0.3
CMake suite maintained and supported by Kitware (kitware.com/cmake).
$ cmake -E capabilities | jq '.version.string'
"4.0.3"
$ cmake -E capabilities | jq
{
"debugger": true,
"fileApi": {
"requests": [
{
"kind": "codemodel",
"version": [
{
"major": 2,
"minor": 8
}
]
},
{
"kind": "configureLog",
"version": [
{
"major": 1,
"minor": 0
}
]
},
{
"kind": "cache",
"version": [
{
"major": 2,
"minor": 0
}
]
},
{
"kind": "cmakeFiles",
"version": [
{
"major": 1,
"minor": 1
}
]
},
{
"kind": "toolchains",
"version": [
{
"major": 1,
"minor": 0
}
]
}
]
},
"generators": [
{
"extraGenerators": [],
"name": "Watcom WMake",
"platformSupport": false,
"toolsetSupport": false
},
{
"extraGenerators": [
"Kate"
],
"name": "Ninja Multi-Config",
"platformSupport": false,
"toolsetSupport": false
},
{
"extraGenerators": [
"CodeBlocks",
"CodeLite",
"Eclipse CDT4",
"Kate",
"Sublime Text 2"
],
"name": "Ninja",
"platformSupport": false,
"toolsetSupport": false
},
{
"extraGenerators": [],
"name": "Xcode",
"platformSupport": false,
"toolsetSupport": true
},
{
"extraGenerators": [
"CodeBlocks",
"CodeLite",
"Eclipse CDT4",
"Kate",
"Sublime Text 2"
],
"name": "Unix Makefiles",
"platformSupport": false,
"toolsetSupport": false
}
],
"serverMode": false,
"tls": true,
"version": {
"isDirty": false,
"major": 4,
"minor": 0,
"patch": 3,
"string": "4.0.3",
"suffix": ""
}
}
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/157073
Approved by: https://github.com/Skylion007
2025-06-28 23:20:10 +00:00
6c493e2b14
[BE] add codespell
linter ( #156066 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/156066
Approved by: https://github.com/malfet
2025-06-16 14:56:07 +00:00
386aa72003
[BE] Cleanup old ExecuTorch codegen and runtime code ( #154165 )
...
Summary: These files are added to pytorch/pytorch before ExecuTorch is
opensourced. Now is a good time to remove it from pytorch/pytorch, since
the code is moved to pytorch/executorch already.
Test Plan: Rely on CI jobs.
Differential Revision: [D75985423](https://our.internmc.facebook.com/intern/diff/D75985423 )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/154165
Approved by: https://github.com/kimishpatel , https://github.com/Skylion007 , https://github.com/cyyever
2025-06-07 06:54:12 +00:00
67067512a1
Revert "[BE] Cleanup old ExecuTorch codegen and runtime code ( #154165 )"
...
This reverts commit 515c19a3856e953c0fe23a0ed4fa844f8eea34d8.
Reverted https://github.com/pytorch/pytorch/pull/154165 on behalf of https://github.com/seemethere due to This is failing when attempting to test against executorch main internally, author has acknowledged that this should be reverted ([comment](https://github.com/pytorch/pytorch/pull/154165#issuecomment-2931489616 ))
2025-06-02 16:28:46 +00:00
515c19a385
[BE] Cleanup old ExecuTorch codegen and runtime code ( #154165 )
...
Summary: These files are added to pytorch/pytorch before ExecuTorch is
opensourced. Now is a good time to remove it from pytorch/pytorch, since
the code is moved to pytorch/executorch already.
Test Plan: Rely on CI jobs.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/154165
Approved by: https://github.com/kimishpatel , https://github.com/Skylion007 , https://github.com/cyyever
2025-06-02 01:47:02 +00:00