Skip to content

[BE] Apply pep585 and turn on flake8 rule so no regressions - #2411

Merged
Lucaskabela merged 2 commits into
pytorch:mainfrom
Lucaskabela:lucaskabela/pep_585_fix
Feb 24, 2026
Merged

Lucaskabela merged 2 commits into
pytorch:mainfrom
Lucaskabela:lucaskabela/pep_585_fix

Conversation

@Lucaskabela

@Lucaskabela Lucaskabela commented Feb 20, 2026 •

Copy link
Copy Markdown
Contributor

Since python>=3.10 is defined in the pyproject.toml, we can enable pep585 (in python >=3.9)

Why?

  1. Fewer imports making code simpler
  2. Standardization - prior to this change, we could have List and list intermixed in the codebase
  3. Future proof for direction of python type system

Test

Ran

 python -m flake8 --pep585-activation=always .

Explicitly

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Feb 20, 2026
@Lucaskabela
Lucaskabela force-pushed the lucaskabela/pep_585_fix branch from a9196f8 to 21ea7f0 Compare February 20, 2026 22:07
@Lucaskabela
Lucaskabela marked this pull request as ready for review February 20, 2026 23:26
@fegin

fegin commented Feb 23, 2026

Copy link
Copy Markdown
Contributor

Nice BE task, but you have to rebase after #2386 is landed.

@Lucaskabela
Lucaskabela force-pushed the lucaskabela/pep_585_fix branch from 21ea7f0 to a21c9dd Compare February 23, 2026 21:00
@Lucaskabela

Copy link
Copy Markdown
Contributor Author

Hi @fegin - should be ready for review :)

@Lucaskabela
Lucaskabela merged commit 736f12d into pytorch:main Feb 24, 2026
24 of 38 checks passed
TXacs pushed a commit to McmillanTAC/torchtitan that referenced this pull request Apr 13, 2026
…2411)

Since python>=3.10 is defined in the pyproject.toml, we can enable
[pep585](https://peps.python.org/pep-0585/) (in python >=3.9)

Why? 

1) Fewer imports making code simpler
2) Standardization - prior to this change, we could have `List` and
`list` intermixed in the codebase
3) Future proof for direction of python type system

### Test 
Ran 
```
 python -m flake8 --pep585-activation=always .
```
Explicitly
ACharacterInASimulation pushed a commit to ACharacterInASimulation/torchtitan that referenced this pull request Apr 21, 2026
…2411)

Since python>=3.10 is defined in the pyproject.toml, we can enable
[pep585](https://peps.python.org/pep-0585/) (in python >=3.9)

Why? 

1) Fewer imports making code simpler
2) Standardization - prior to this change, we could have `List` and
`list` intermixed in the codebase
3) Future proof for direction of python type system

### Test 
Ran 
```
 python -m flake8 --pep585-activation=always .
```
Explicitly
@Lucaskabela
Lucaskabela deleted the lucaskabela/pep_585_fix branch May 6, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/8gpu CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants