1
Fork 0
mirror of https://github.com/allthingslinux/tux.git synced 2024-10-03 09:03:12 +00:00
tux/pyproject.toml
kaizen e64781ad1b [Refactor][Update] pre-commit hook versions and refactor error handling
Pyright type checking has been set to basic for now.

The pre-commit hooks for `ruff-pre-commit` and `pyright-python` have been updated to their latest versions for code quality improvements. The `pre-commit-config` and `pyproject.toml` files were modified to reflect these changes.

Also, the error handler has been completely rewritten in a more flexible and scalable manner, addressing various error scenarios in a cleaner and clearer way. Individual error handling methods for common cases are now in place, making it easier to extend with more exception types in the future.

Removed some unused references to the old error handler in the main application file, simplifying the logic there. The `pyright` type checking configuration in `pyproject.toml` was also adjusted for less strict checking, better suited to our current project requirements.

Lastly, the lockfile `poetry.lock` was updated and unnecessarily tagged "dev" packages were removed.

In the wake of these changes, be mindful that the behaviour of error prompts to the user and of type checks may slightly differ.

Additional notes include punctuation and formatting adjustments to improve readability throughout the files changed.
2024-01-09 22:58:09 -05:00

191 lines
4.2 KiB
TOML

################################################################
# Poetry Configuration
################################################################
[tool.poetry]
authors = ["kaizen <admin@kaizen.wtf>"]
description = "All Things Linux Discord Bot"
name = "tux"
readme = "README.md"
version = "0.1.0"
[tool.poetry.dependencies]
python = "^3.11"
[tool.poetry.group.dev.dependencies]
aiohttp = "3.9.1"
colorlog = ">=6.8.0"
discord-py = "^2.3.2"
pre-commit = "^3.6.0"
pyright = "^1.1.343"
python-dotenv = ">=1.0.0"
ruff = "^0.1.9"
[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core"]
################################################################
# Black Configuration
# https://docs.astral.sh/ruff/configuration/
################################################################
[tool.black]
include = '\.pyi?$'
line-length = 88
target-version = ['py311']
################################################################
# Ruff Configuration
# https://docs.astral.sh/ruff/configuration/
################################################################
[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]
# Same as Black.
indent-width = 4
line-length = 88
# Assume Python 3.11
target-version = "py311"
################################################################
# Ruff Linting Configuration
################################################################
[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
ignore = ["E501"]
select = [
# pycodestyle
"E", # Pyflakes
"F", # pyupgrade
"UP", # flake8-bugbear
"B", # flake8-simplify
"SIM", # isort
"I",
]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
################################################################
# Ruff Formatting Configuration
################################################################
[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = false
# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"
################################################################
# Pyright Configuration
# https://microsoft.github.io/pyright/#/configuration
################################################################
[tool.pyright]
defineConstant = {DEBUG = true}
exclude = [
".direnv",
".eggs",
".git",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
"examples",
"tests",
]
include = ["tux"]
typeCheckingMode = "basic"
# Rules
# https://microsoft.github.io/pyright/#/configuration?id=diagnostic-rule-defaults
reportMissingImports = true
reportMissingParameterType = false
reportMissingTypeStubs = false
reportUnknownArgumentType = false
reportUnknownMemberType = false
reportUnknownParameterType = false
pythonPlatform = "Linux"
pythonVersion = "3.11"
venv = ".venv"
venvPath = "."