Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to shrink all formatter errors #5943

Merged
merged 3 commits into from
Jul 21, 2023

Conversation

konstin
Copy link
Member

@konstin konstin commented Jul 21, 2023

Summary Add script to shrink all formatter errors: This started as a fun idea and turned out really useful: This script gives us a single Python file with all formatter stability errors. I want to keep it around to occasionally update #5828 so I added it to the git.

Test Plan None, this is a helper script

**Summary** This adds a sanity check to the minimizer script that the
input matches the condition (e.g. unstable formatting). Otherwise we run
through all checks with the whole file, which is extremely slow. It's
more reasonable for downstream usage to write an empty string to the
output file instead. It also prints the minimized code in the end
@konstin
Copy link
Member Author

konstin commented Jul 21, 2023

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@github-actions
Copy link
Contributor

PR Check Results

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00     10.9±0.04ms     3.7 MB/sec    1.00     11.0±0.05ms     3.7 MB/sec
formatter/numpy/ctypeslib.py               1.00      2.2±0.01ms     7.6 MB/sec    1.00      2.2±0.01ms     7.6 MB/sec
formatter/numpy/globals.py                 1.00    242.4±1.65µs    12.2 MB/sec    1.01    244.0±0.99µs    12.1 MB/sec
formatter/pydantic/types.py                1.00      4.7±0.01ms     5.4 MB/sec    1.01      4.8±0.02ms     5.3 MB/sec
linter/all-rules/large/dataset.py          1.00     15.4±0.07ms     2.6 MB/sec    1.00     15.5±0.05ms     2.6 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      3.9±0.01ms     4.3 MB/sec    1.00      3.9±0.01ms     4.3 MB/sec
linter/all-rules/numpy/globals.py          1.00    515.3±3.03µs     5.7 MB/sec    1.00    516.1±2.11µs     5.7 MB/sec
linter/all-rules/pydantic/types.py         1.00      7.0±0.04ms     3.7 MB/sec    1.00      7.0±0.03ms     3.7 MB/sec
linter/default-rules/large/dataset.py      1.01      7.9±0.02ms     5.2 MB/sec    1.00      7.8±0.04ms     5.2 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00   1687.0±7.06µs     9.9 MB/sec    1.00   1687.9±9.81µs     9.9 MB/sec
linter/default-rules/numpy/globals.py      1.00    186.6±0.85µs    15.8 MB/sec    1.00    186.2±0.38µs    15.8 MB/sec
linter/default-rules/pydantic/types.py     1.01      3.6±0.01ms     7.1 MB/sec    1.00      3.6±0.01ms     7.2 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00     11.0±0.12ms     3.7 MB/sec    1.05     11.6±0.13ms     3.5 MB/sec
formatter/numpy/ctypeslib.py               1.00      2.2±0.03ms     7.7 MB/sec    1.04      2.2±0.03ms     7.4 MB/sec
formatter/numpy/globals.py                 1.00    235.3±9.50µs    12.5 MB/sec    1.06    249.2±6.87µs    11.8 MB/sec
formatter/pydantic/types.py                1.00      4.7±0.06ms     5.4 MB/sec    1.06      5.0±0.06ms     5.1 MB/sec
linter/all-rules/large/dataset.py          1.00     15.5±0.13ms     2.6 MB/sec    1.00     15.4±0.14ms     2.6 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      4.1±0.07ms     4.1 MB/sec    1.00      4.0±0.05ms     4.1 MB/sec
linter/all-rules/numpy/globals.py          1.01    488.3±9.26µs     6.0 MB/sec    1.00    483.5±5.67µs     6.1 MB/sec
linter/all-rules/pydantic/types.py         1.00      7.0±0.08ms     3.7 MB/sec    1.00      7.0±0.08ms     3.7 MB/sec
linter/default-rules/large/dataset.py      1.00      8.0±0.08ms     5.1 MB/sec    1.00      8.0±0.06ms     5.1 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00  1669.7±25.03µs    10.0 MB/sec    1.00  1666.8±18.37µs    10.0 MB/sec
linter/default-rules/numpy/globals.py      1.00    190.2±3.40µs    15.5 MB/sec    1.00    189.5±3.02µs    15.6 MB/sec
linter/default-rules/pydantic/types.py     1.00      3.6±0.04ms     7.1 MB/sec    1.00      3.6±0.03ms     7.1 MB/sec

Base automatically changed from document-shrinking-script to main July 21, 2023 09:32
@konstin konstin merged commit c3b506f into main Jul 21, 2023
17 checks passed
@konstin konstin deleted the Add_script_to_shrink_all_formatter_errors branch July 21, 2023 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants