Skip to content

Commit

Permalink
Remove TorchFix from test-infra (#4764)
Browse files Browse the repository at this point in the history
As it has been migrated to https://github.com/pytorch-labs/torchfix
  • Loading branch information
kit1980 authored Nov 28, 2023
1 parent fd0c09b commit 084790b
Show file tree
Hide file tree
Showing 70 changed files with 1 addition and 2,088 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ on:
tags:
- v*
pull_request:
# A caveat https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions:
# If you define a path with the ! character, you must also define at least one path without
# the ! character. If you only want to exclude paths, use paths-ignore instead
paths-ignore:
- 'tools/torchfix/**'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/test-torchfix.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ on:
- mypy.ini
- '**.py'
- '**requirements.txt'
- '!tools/torchfix/**'
push:
branches:
- main
paths:
- mypy.ini
- '**.py'
- '**requirements.txt'
- '!tools/torchfix/**'

jobs:
test-tools:
Expand Down
3 changes: 0 additions & 3 deletions .lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,6 @@ command = [
'--',
'@{{PATHSFILE}}'
]
exclude_patterns = [
'tools/torchfix/**',
]
init_command = [
'python3',
'tools/linter/adapters/pip_init.py',
Expand Down
5 changes: 0 additions & 5 deletions tools/torchfix/.flake8

This file was deleted.

4 changes: 0 additions & 4 deletions tools/torchfix/.gitignore

This file was deleted.

67 changes: 1 addition & 66 deletions tools/torchfix/README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1 @@
# TorchFix - a linter for PyTorch-using code with autofix support

TorchFix is a Python code static analysis tool - a linter with autofix capabilities -
for users of PyTorch. It can be used to find and fix issues like usage of deprecated
PyTorch functions and non-public symbols, and to adopt PyTorch best practices in general.

TorchFix is built upon https://github.com/Instagram/LibCST - a library to manipulate
Python concrete syntax trees. LibCST enables "codemods" (autofixes) in addition to
reporting issues.

TorchFix can be used as a Flake8 plugin (linting only) or as a standalone
program (with autofix available for a subset of the lint violations).

Currently TorchFix is in a **beta version** stage, so there are still a lot of rough
edges and many things can and will change.

## Installation

To install the latest code from GitHub, clone/download
https://github.com/pytorch/test-infra/tree/main/tools/torchfix and run `pip install .`
inside the directory.

To install a release version from PyPI, run `pip install torchfix`.

## Usage

After the installation, TorchFix will be available as a Flake8 plugin, so running
Flake8 normally will run the TorchFix linter.

To see only TorchFix warnings without the rest of the Flake8 linters, you can run
`flake8 --isolated --select=TOR0,TOR1,TOR2`

TorchFix can also be run as a standalone program: `torchfix .`
Add `--fix` parameter to try to autofix some of the issues (the files will be overwritten!)
To see some additional debug info, add `--show-stderr` parameter.

Please keep in mind that autofix is a best-effort mechanism. Given the dynamic nature of Python,
and especially the beta version status of TorchFix, it's very difficult to have
certainty when making changes to code, even for the seemingly trivial fixes.

Warnings for issues with codes starting with TOR0, TOR1, and TOR2 are enabled by default.
Warnings with other codes may be too noisy, so not enabled by default.
To enable them, use standard flake8 configuration options for the plugin mode or use
`torchfix --select=ALL .` for the standalone mode.


## Reporting problems

If you encounter a bug or some other problem with TorchFix, please file an issue on
https://github.com/pytorch/test-infra/issues, mentioning [TorchFix] in the title.


## Rules

### TOR001 Use of removed function

#### torch.solve

This function was deprecated since PyTorch version 1.9 and is now removed.

`torch.solve` is deprecated in favor of `torch.linalg.solve`.
`torch.linalg.solve` has its arguments reversed and does not return the LU factorization.

To get the LU factorization see `torch.lu`, which can be used with `torch.lu_solve` or `torch.lu_unpack`.

`X = torch.solve(B, A).solution` should be replaced with `X = torch.linalg.solve(A, B)`.
TorchFix moved to a separate repo - https://github.com/pytorch-labs/torchfix
29 changes: 0 additions & 29 deletions tools/torchfix/pyproject.toml

This file was deleted.

5 changes: 0 additions & 5 deletions tools/torchfix/requirements-dev.txt

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 084790b

Please sign in to comment.