hikari-py/hikari

View on GitHub
pyproject.toml

Summary

Maintainability
Test Coverage
# Copyright (c) 2020 Nekokatt
# Copyright (c) 2021-present davfsa
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
[build-system]
requires = ["wheel", "setuptools"]
build-backend = "setuptools.build_meta"

[tool.black]
line-length = 120
include = ".*pyi?$"
skip-magic-trailing-comma = true
target-version = ["py38"]

[tool.coverage.run]
relative_files = true
parallel = true
branch = true
timid = false
source = ["hikari"]
omit = [
    "hikari/__main__.py",
    "hikari/cli.py",
]

[tool.coverage.report]
precision = 2
show_missing = true
skip_covered = false
sort = "cover"
exclude_lines = [
    "\\#\\s*pragma: no cover$",
    "^\\s*raise AssertionError$",
    "^\\s*raise NotImplementedError$",
    "^\\s*return NotImplemented$",
    "^\\s*raise$",
    "^\\s*pass$",
    "^if __name__ == ['\"]__main__['\"]:$",
    "^\\s*\\.\\.\\.$",
    "^\\s*@abc.abstractmethod$",
    "^\\s*if typing.TYPE_CHECKING:$",
    # Whatever is in inside `if not typing.TYPE_CHECKING:` is expected to be tested, but the branch will always run, making
    # coverage think that its only partial
    "^\\s*if not typing.TYPE_CHECKING:$",
]

[tool.pyright]
include = ["hikari", "examples"]
exclude = ["examples/simple_dashboard.py", "**/__init__.py", "hikari/internal/enums.py", "hikari/internal/fast_protocol.py"]
pythonVersion = "3.8"
typeCheckingMode = "strict"

reportUnnecessaryTypeIgnoreComment = "error"
reportMissingTypeStubs = "none"
reportImportCycles = "none" # Doesn't account for TYPE_CHECKING
reportIncompatibleMethodOverride = "none"  # This relies on ordering for keyword-only arguments
reportOverlappingOverload = "none" # Type-Vars in last overloads may interfere
reportIncompatibleVariableOverride = "none" # Cannot overwrite abstract properties using attrs

# Attrs validators will always be unknown
# https://github.com/python-attrs/attrs/issues/795
reportUnknownMemberType = "warning"
reportUntypedFunctionDecorator = "warning"
reportOptionalMemberAccess = "warning"

[tool.pytest.ini_options]
asyncio_mode = "strict"
xfail_strict = true
norecursedirs = [
    "docs",
    "*.egg-info",
    ".git",
    "tasks",
    ".nox",
    ".pytest_cache",
    ".venv",
    "venv",
    "public",
    "ci",
]
filterwarnings = [
    "error", # Treat warnings as errors
    "ignore:.*assertions not in test modules or plugins will be ignored .*:pytest.PytestConfigWarning",
]
required_plugins = ["pytest-asyncio"]

[tool.towncrier]
package = "hikari"
package_dir = "hikari"
directory = "changes"
template = "changes/.template.rst"
filename = "CHANGELOG.md"
issue_format = "[#{issue}](https://github.com/hikari-py/hikari/issues/{issue})"
# We use this differently in the template
underlines = [2, 3]
type = [
    { name = "Breaking Changes",            directory = "breaking",      showcontent = true },
    { name = "Deprecation",                 directory = "deprecation",   showcontent = true },
    { name = "Features",                    directory = "feature",       showcontent = true },
    { name = "Bugfixes",                    directory = "bugfix",        showcontent = true },
    { name = "Documentation Improvements",  directory = "documentation", showcontent = true },
]

[tool.isort]
profile = "black"
force_single_line = true
skip_glob = "**/__init__.pyi"

[tool.mypy]
# general settings
strict = true
check_untyped_defs = true
incremental = true
namespace_packages = true
no_implicit_optional = true
pretty = true
python_version = 3.8
show_column_numbers = true
show_error_codes = true
show_error_context = true

# stuff to allow
allow_untyped_globals = false
allow_redefinition = true

# stuff to disallow
disallow_untyped_decorators = true
disallow_incomplete_defs = true
disallow_untyped_defs = true

# warnings
warn_no_return = true
warn_redundant_casts = true
warn_return_any = true
warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true

[[tool.mypy.overrides]]
module = 'rillrate.*'
ignore_missing_imports = true

[tool.slotscheck]
strict-imports = true
require-superclass = true
require-subclass = true
exclude-classes = """
(
    ^hikari\\.internal\\.enums:(Enum|Flag|_EnumMeta|_FlagMeta)$
)
"""