Doc/CLN: pass pre-commit (#3604)

This commit is contained in:
Zhengbo Wang 2023-03-20 03:20:11 +08:00 committed by GitHub
parent 3a65af4dae
commit b08326162b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 15 deletions

View File

@ -1,8 +1,8 @@
## Ruff Micro-benchmarks # Ruff Micro-benchmarks
Benchmarks for the different Ruff-tools. Benchmarks for the different Ruff-tools.
### Run Benchmark ## Run Benchmark
You can run the benchmarks with You can run the benchmarks with
@ -10,7 +10,7 @@ You can run the benchmarks with
cargo benchmark cargo benchmark
``` ```
### Benchmark driven Development ## Benchmark driven Development
You can use `--save-baseline=<name>` to store an initial baseline benchmark (e.g. on `main`) and then use You can use `--save-baseline=<name>` to store an initial baseline benchmark (e.g. on `main`) and then use
`--benchmark=<name>` to compare against that benchmark. Criterion will print a message telling you if the benchmark improved/regressed compared to that baseline. `--benchmark=<name>` to compare against that benchmark. Criterion will print a message telling you if the benchmark improved/regressed compared to that baseline.
@ -23,7 +23,8 @@ cargo benchmark --save-baseline=main
cargo benchmark --baseline=main cargo benchmark --baseline=main
``` ```
### PR Summary ## PR Summary
You can use `--save-baseline` and `critcmp` to get a pretty comparison between two recordings. You can use `--save-baseline` and `critcmp` to get a pretty comparison between two recordings.
This is useful to illustrate the improvements of a PR. This is useful to illustrate the improvements of a PR.
@ -43,11 +44,11 @@ You must install [`critcmp`](https://github.com/BurntSushi/critcmp) for the comp
cargo install critcmp cargo install critcmp
``` ```
### Tips ## Tips
* Use `cargo benchmark <filter>` to only run specific benchmarks. For example: `cargo benchmark linter/pydantic` to only run the pydantic tests. - Use `cargo benchmark <filter>` to only run specific benchmarks. For example: `cargo benchmark linter/pydantic` to only run the pydantic tests.
* Use `cargo benchmark --quiet` for a more cleaned up output (without statistical relevance) - Use `cargo benchmark --quiet` for a more cleaned up output (without statistical relevance)
* Use `cargo benchmark --quick` to get faster results (more prone to noise) - Use `cargo benchmark --quick` to get faster results (more prone to noise)
## Profiling ## Profiling
@ -83,5 +84,5 @@ Then run the profiler with
cargo instruments -t time --bench linter --profile release-debug -p ruff_benchmark -- --profile-time=1 cargo instruments -t time --bench linter --profile release-debug -p ruff_benchmark -- --profile-time=1
``` ```
* `-t`: Specifies what to profile. Useful options are `time` to profile the wall time and `alloc` for profiling the allocations. - `-t`: Specifies what to profile. Useful options are `time` to profile the wall time and `alloc` for profiling the allocations.
* You may want to pass an additional filter to run a single test file - You may want to pass an additional filter to run a single test file

View File

@ -3,15 +3,11 @@ import argparse
import re import re
import shutil import shutil
import subprocess import subprocess
import sys
from pathlib import Path from pathlib import Path
from typing import NamedTuple from typing import NamedTuple
import yaml import yaml
if sys.version_info < (3, 9):
raise RuntimeError("You need at least python 3.9 to run this script")
class Section(NamedTuple): class Section(NamedTuple):
"""A section to include in the MkDocs documentation.""" """A section to include in the MkDocs documentation."""

View File

@ -2,6 +2,7 @@
name = "scripts" name = "scripts"
version = "0.0.1" version = "0.0.1"
dependencies = ["sphinx"] dependencies = ["sphinx"]
requires-python = ">=3.9"
[tool.black] [tool.black]
line-length = 88 line-length = 88
@ -11,7 +12,7 @@ line-length = 88
select = ["ALL"] select = ["ALL"]
ignore = [ ignore = [
"PL", # pylint "PL", # pylint
"S", # bandit "S", # bandit
] ]
[tool.ruff.pydocstyle] [tool.ruff.pydocstyle]