Skip to content

Instantly share code, notes, and snippets.

@SXHRYU
Last active July 10, 2023 06:40
Show Gist options
  • Save SXHRYU/18c68ce9a76cef360eb455e54f24b548 to your computer and use it in GitHub Desktop.
Save SXHRYU/18c68ce9a76cef360eb455e54f24b548 to your computer and use it in GitHub Desktop.
Boiler settings for pyproject
[tool.mypy]
strict = true
[tool.isort] # pyproject.toml, .isort.cfg = [settings]
profile = "black"
multi_line_output = 3
lines_after_imports = 2
lines_between_sections = 0 # novk
force_alphabetical_sort_within_sections = true # vk
include_trailing_comma = true # vk
combine_as_imports = true # vk
[tool.autoflake]
remove-all-unused-imports = true
ignore-init-module-imports = true
recursive = true
in-place = true
[tool.black]
line-length = 79
extend-exclude = '''
(
make_tiles/openmaptiles/.*
| make_tiles/openmaptiles-tools/.*
| subway_generation/metrostroy/.*
| migrations/*
)
'''
target-version = ['py311']
[tool.ruff]
target-version = "py311"
extend-exclude = [
"*/migrations/*",
"make_tiles/openmaptiles/*",
"make_tiles/openmaptiles-tools/*",
"subway_generation/metrostroy/*",
]
ignore = [
"COM812", # Trailing comma missing
"PLR0912", # Too many branches
"ANN002", # Missing type annotation for `*args`
"ANN003", # Missing type annotation for `**kwargs`
"ANN101", # Missing type annotation for `self` in method
"ANN102", # Missing type annotation for `cls` in classmethod
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
# Within an `except` clause, raise exceptions with
# `raise ... from err` or `raise ... from None`
# to distinguish them from errors in exception handling
"B904",
]
line-length = 79
force-exclude = true
ignore-init-module-imports = true
extend-select = [
"F",
"I",
"N",
"ARG",
"PLR",
"W",
"UP",
"COM",
"Q",
"ANN",
"B"
]
[tool.ruff.isort]
combine-as-imports = true
lines-after-imports = 2
order-by-type = false
no-lines-before = ["local-folder"]
[tool.ruff.flake8-unused-arguments]
ignore-variadic-names = true
[tool.ruff.flake8-annotations]
suppress-dummy-args = true
@SXHRYU
Copy link
Author

SXHRYU commented Mar 19, 2023

rev. 2
added [tool.mypy], [tool.black]

Extra comment:
made it basically a boilerplate for whole pyproject.toml

@SXHRYU
Copy link
Author

SXHRYU commented Apr 17, 2023

rev. 3
added work specific options

Extra comment:
Basically a generic for work and personal projects

@SXHRYU
Copy link
Author

SXHRYU commented Apr 17, 2023

rev. 4
added [tool.autoflake]

@SXHRYU
Copy link
Author

SXHRYU commented Jul 10, 2023

rev. 5
added settings for ruff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment