Skip to content

Commit

Permalink
Add tooling configs to pyproject.toml
Browse files Browse the repository at this point in the history
In particular, set line length 80 for all Python files.
  • Loading branch information
nicholasjng committed Oct 27, 2023
1 parent 678f9fd commit 738cd7f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run Python and Bazel google-benchmark pre-commit checks
name: python + Bazel pre-commit checks

on:
push:
Expand Down Expand Up @@ -37,7 +37,3 @@ jobs:
- name: Run pre-commit checks
run: |
pre-commit run --all-files --verbose --show-diff-on-failure
- name: Run pylint
run: |
pylint `find . -name '*.py'|xargs` || pylint-exit $?
34 changes: 34 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,37 @@ where = ["bindings/python"]
[tool.setuptools.dynamic]
version = { attr = "google_benchmark.__version__" }
readme = { file = "README.md", content-type = "text/markdown" }

[tool.black]
# Source https://github.com/psf/black#configuration-format
include = "\\.pyi?$"
line-length = 80
target-version = ["py311"]

# Black-compatible settings for isort
# See https://black.readthedocs.io/en/stable/
[tool.isort]
line_length = "80"
profile = "black"

[tool.mypy]
check_untyped_defs = true
disallow_incomplete_defs = true
pretty = true
python_version = "3.11"
strict_optional = false
warn_unreachable = true

[[tool.mypy.overrides]]
module = ["yaml"]
ignore_missing_imports = true

[tool.ruff]
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
select = ["E", "F", "W"]
ignore = [
# whitespace before colon (:), rely on black for formatting (in particular, allow spaces before ":" in list/array slices)
"E203",
# line too long, rely on black for reformatting of these, since sometimes URLs or comments can be longer
"E501",
]

0 comments on commit 738cd7f

Please sign in to comment.