[build-system]
requires = ["setuptools>=61.0", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"

[project]
name = "gp2040ce-binary-tools"
description = "Tools for working with GP2040-CE firmware and storage binaries."
readme = "README.md"
license = {text = "GPL-3.0-or-later"}
authors = [
    {name = "Brian S. Stephan", email = "bss@incorporeal.org"},
]
requires-python = ">=3.9"
dependencies = ["grpcio-tools", "pyusb", "textual"]
dynamic = ["version"]
classifiers = [
    "Environment :: Console",
    "Programming Language :: Python :: 3",
    "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
    "Operating System :: OS Independent",
    "Topic :: Utilities",
]

[project.urls]
"Homepage" = "https://github.com/OpenStickCommunity/gp2040ce-binary-tools"
"Changelog" = "https://github.com/OpenStickCommunity/gp2040ce-binary-tools/blob/main/CHANGELOG.md"
"Bug Tracker" = "https://github.com/OpenStickCommunity/gp2040ce-binary-tools/issues"


[project.optional-dependencies]
dev = ["bandit", "decorator", "flake8", "flake8-blind-except", "flake8-builtins", "flake8-docstrings",
       "flake8-executable", "flake8-fixme", "flake8-isort", "flake8-logging-format", "flake8-mutable",
       "flake8-pyproject", "mypy", "pip-tools", "pytest", "pytest-asyncio", "pytest-cov", "reuse",
       "setuptools-scm", "textual-dev", "tox", "twine"]

[project.scripts]
concatenate = "gp2040ce_bintools.builder:concatenate"
dump-config = "gp2040ce_bintools.storage:dump_config"
dump-gp2040ce = "gp2040ce_bintools.builder:dump_gp2040ce"
edit-config = "gp2040ce_bintools.gui:edit_config"
summarize-gp2040ce = "gp2040ce_bintools.builder:summarize_gp2040ce"
visualize-config = "gp2040ce_bintools.storage:visualize"

[tool.flake8]
enable-extensions = "G,M"
exclude = [".tox/", "venv/", "_version.py", "tests/test-files/", "config_pb2.py", "enums_pb2.py", "nanopb_pb2.py"]
extend-ignore = "T101"
max-complexity = 10
max-line-length = 120

[tool.isort]
line_length = 120

[tool.mypy]
exclude = [
    "config_pb2.py",
    "enums_pb2.py",
    "nanopb_pb2.py",
]
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "google.protobuf.*"
ignore_missing_imports = true

# there's a lot of class inheritance and so on going on in textual that I haven't figured out
# e.g. assigning Select or Input to the same variable is valid but not type-safe, bindings
# can just exit but mypy thinks they should return coroutines... better just to disable it for
# now until I can figure things out and learn more about doing proper type checking
[[tool.mypy.overrides]]
module = "gp2040ce_bintools.gui"
ignore_errors = true

[tool.pytest]
python_files = ["*_tests.py", "tests.py", "test_*.py"]

[tool.pytest.ini_options]
log_cli = 0
log_cli_level = "WARNING"

[tool.setuptools]
packages = [
    "gp2040ce_bintools",
    "gp2040ce_bintools.proto_snapshot",
]

[tool.setuptools_scm]
write_to = "gp2040ce_bintools/_version.py"