Skip to content

Commit

Permalink
move settings back to python-package/pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb committed Feb 14, 2024
1 parent 4f1a3d3 commit 6247f46
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 86 deletions.
3 changes: 3 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ repos:
hooks:
# Run the linter.
- id: ruff
args: ["--config", "python-package/pyproject.toml"]
# Run the formatter.
- id: ruff-format
args: ["--config", "python-package/pyproject.toml"]
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
args: ["--settings-path", "python-package/pyproject.toml"]
86 changes: 0 additions & 86 deletions pyproject.toml

This file was deleted.

84 changes: 84 additions & 0 deletions python-package/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,90 @@ minimum-version = "0.4.4"

# end:build-system

[tool.isort]
line_length = 120
skip_glob = [
"*/external_libs/*",
"*/lightgbm-python/*"
]

[tool.mypy]
exclude = 'build/*|compile/*|docs/*|examples/*|external_libs/*|lightgbm-python/*|tests/*'
ignore_missing_imports = true

[tool.ruff]
exclude = [
"build",
"compile",
"external_libs",
"lightgbm-python",
]
line-length = 120

# this should be set to the oldest version of python LightGBM supports
target-version = "py37"

[tool.ruff.format]
docstring-code-format = false
exclude = [
"build/*.py",
"compile/*.py",
"examples/*.py",
"external_libs/*.py",
"lightgbm-python/*.py",
"python-package/*.py",
"tests/*.py"
]
indent-style = "space"
quote-style = "double"

[tool.ruff.lint]
ignore = [
# (pydocstyle) Missing docstring in magic method
"D105",
# (pycodestyle) Line too long
"E501"
]
select = [
# flake8-bugbear
"B",
# flake8-comprehensions
"C4",
# pydocstyle
"D",
# pycodestyle
"E",
# pyflakes
"F",
# flake8-return: unnecessary assignment before return
"RET504",
# flake8-simplify: use dict.get() instead of an if-else block
"SIM401",
# flake8-print
"T",
]

[tool.ruff.lint.per-file-ignores]
"docs/conf.py" = [
# (flake8-bugbear) raise exceptions with "raise ... from errr"
"B904",
# (flake8-print) flake8-print
"T"
]
"examples/*" = [
# pydocstyle
"D",
# flake8-print
"T"
]
"tests/*" = [
# (flake8-bugbear) Found useless expression
"B018",
# pydocstyle
"D",
# flake8-print
"T"
]

[tool.ruff.lint.pydocstyle]
convention = "numpy"

0 comments on commit 6247f46

Please sign in to comment.