[build-system]
requires = [
  "setuptools >= 60.0.0",
  "wheel",
  "pip",
] # `pip` is required to install in editable mode
build-backend = "setuptools.build_meta"

[project]
name = "mode-ng"
version = "0.5.0"
description = "AsyncIO Service-based programming."
readme = "README.rst"
requires-python = ">=3.10"
license = { text = "BSD 3-Clause License" }
authors = [{ name = "Ask Solem", email = "ask@celeryproject.org" }]
maintainers = [{ name = "Lanqing Huang", email = "lqhuang@outlook.com" }]
keywords = ["asyncio", "service", "bootsteps", "graph", "coroutine", "actor"]
classifiers = [
  "Development Status :: 4 - Beta",
  "License :: OSI Approved :: BSD License",
  "Programming Language :: Python :: 3 :: Only",
  "Programming Language :: Python :: 3.10",
  "Programming Language :: Python :: 3.11",
  "Programming Language :: Python :: Implementation :: CPython",
  "Operating System :: POSIX",
  "Operating System :: Microsoft :: Windows",
  "Operating System :: MacOS :: MacOS X",
  "Operating System :: Unix",
  "Environment :: No Input/Output (Daemon)",
  "Framework :: AsyncIO",
  "Intended Audience :: Developers",
]
urls = { homepage = "https://github.com/lqhuang/mode-ng" }
dynamic = ["dependencies", "optional-dependencies"]

[tool.setuptools.packages.find]
where = ["src"]
exclude = ["tests", "docs", "scripts", "examples"]
namespaces = false

[tool.setuptools.package-data]
mode = ["py.typed"]

# ========================
#          MYPY
# ========================

[tool.mypy]
# doc: https://mypy.readthedocs.io/en/stable/config_file.html
# --strict but not --no-implicit-optional
# Import discovery
ignore_missing_imports = true
follow_imports = "normal"
# Platform configuration
# python_version = "3.10"
# Disallow dynamic typing
disallow_any_unimported = true
disallow_any_expr = false
disallow_any_decorated = false
disallow_any_generics = false
disallow_subclassing_any = true
# Untyped definitions and calls
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
# None and Optional handling
no_implicit_optional = false
strict_optional = true
# Configuring warnings
warn_redundant_casts = true
warn_unused_ignores = true
warn_return_any = true
warn_unreachable = true
# Miscellaneous strictness flags
implicit_reexport = false
strict_equality = true
# Configuring error messages
show_column_numbers = true
show_error_context = true
show_error_codes = true
# pretty = true  # disable for IDE parser; try add cli option in Makefile
# Incremental mode
cache_fine_grained = true
# Advanced options
warn_incomplete_stub = true
# Miscellaneous
warn_unused_configs = true

[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
disallow_incomplete_defs = false
check_untyped_defs = true
disallow_untyped_calls = false

# ========================
#          BLACK
# ========================

# NOTE: you have to use single-quoted strings in TOML for regular expressions.
# It's the equivalent of r-strings in Python. Multiline strings are treated as
# verbose regular expressions by Black. Use [ ] to denote a significant space
# character.
[tool.black]
line-length = 79
include = '\.pyi?$'
extend-exclude = '''
/(
  # exclude a few common directories in the root of the project
  | \.eggs
  | \.git
  | \.tox
  | \.venv
  | \.env
  | env
  | _build
  | build
  | dist
)/
'''

[tool.isort]
profile = "black"
line_length = 79
known_typing = "typing"
known_first_party = "mode"
sections = "FUTURE,TYPING,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER"

# [tool.bandit]
# # B101: assert_used
# # B104: hardcoded_bind_all_interfaces
# skips = ["B101", "B104"]

# ========================
#     Pyright (pylance)
# ========================

[tool.pyright]
# https://github.com/microsoft/pyright/blob/main/docs/configuration.md#main-pyright-config-options
typeCheckingMode = "basic"
reportGeneralTypeIssues = false
# reportPrivateUsage = false

# ========================
#          Pytest
# ========================

[tool.pytest.ini_options]
python_classes = "test_*"
testpaths = ["tests"]
asyncio_mode = "strict"   # for `pytest-asyncio`
