odoo_mqtt/iot_bridge/pyproject.toml

226 lines
5.6 KiB
TOML

[project]
name = "iot-bridge"
version = "1.0.0"
description = "IoT MQTT Bridge for Odoo - Autonomous MQTT-to-Odoo Integration Service"
requires-python = ">=3.10"
readme = "README.md"
license = {text = "MIT"}
dependencies = [
"pyyaml>=6.0",
"paho-mqtt>=2.0.0",
"requests>=2.31.0",
"fastapi>=0.110.0",
"uvicorn>=0.28.0",
"pydantic>=2.6.0",
"pydantic-settings>=2.2.0",
"python-dotenv>=1.0.0",
"structlog>=24.1.0",
]
[project.optional-dependencies]
dev = [
"pytest>=8.0.0",
"pytest-cov>=4.1.0",
"pytest-asyncio>=0.23.0",
"black>=24.0.0",
"isort>=5.13.0",
"mypy>=1.8.0",
"ruff>=0.2.0",
"pre-commit>=3.6.0",
"types-pyyaml>=6.0.0",
"types-requests>=2.31.0",
]
# ============================================================================
# Black - Code Formatter
# ============================================================================
[tool.black]
line-length = 100
target-version = ["py310", "py311", "py312"]
include = '\.pyi?$'
extend-exclude = '''
/(
# Directories
\.eggs
| \.git
| \.mypy_cache
| \.pytest_cache
| \.venv
| venv
| __pycache__
| build
| dist
)/
'''
# ============================================================================
# isort - Import Sorter
# ============================================================================
[tool.isort]
profile = "black"
line_length = 100
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
skip_glob = ["__pycache__", "*.pyc", ".venv", "venv"]
# Known package groups for better sorting
known_first_party = ["core", "clients", "parsers", "api", "config", "utils"]
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
# ============================================================================
# mypy - Static Type Checker
# ============================================================================
[tool.mypy]
python_version = "3.10"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = false # Start lenient, tighten in Phase 3
disallow_any_generics = false
disallow_subclassing_any = false
disallow_untyped_calls = false
disallow_incomplete_defs = false
check_untyped_defs = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_unreachable = true
strict_equality = true
show_error_codes = true
# Exclude generated files and virtual environments
exclude = [
"^venv/",
"^build/",
"^dist/",
"__pycache__",
]
# Per-module options (can be tightened later)
[[tool.mypy.overrides]]
module = "paho.mqtt.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "structlog.*"
ignore_missing_imports = true
# ============================================================================
# pytest - Test Runner
# ============================================================================
[tool.pytest.ini_options]
minversion = "8.0"
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = [
"-v",
"--strict-markers",
"--strict-config",
"--cov=.",
"--cov-report=term-missing:skip-covered",
"--cov-report=html",
"--cov-report=xml",
]
markers = [
"unit: Unit tests (fast, no external dependencies)",
"integration: Integration tests (may require MQTT broker, Odoo)",
"e2e: End-to-end tests (full system test)",
"slow: Slow running tests",
]
# ============================================================================
# coverage - Code Coverage
# ============================================================================
[tool.coverage.run]
source = ["."]
omit = [
"*/tests/*",
"*/test_*.py",
"*/__pycache__/*",
"*/venv/*",
"*/build/*",
"*/dist/*",
".venv/*",
]
branch = true
[tool.coverage.report]
precision = 2
show_missing = true
skip_covered = false
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"@abstractmethod",
]
[tool.coverage.html]
directory = "htmlcov"
# ============================================================================
# ruff - Modern Python Linter (replaces flake8, pylint, etc.)
# ============================================================================
[tool.ruff]
line-length = 100
target-version = "py310"
exclude = [
".git",
".mypy_cache",
".pytest_cache",
".venv",
"venv",
"__pycache__",
"build",
"dist",
]
[tool.ruff.lint]
# Enable specific rule sets
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
"ARG", # flake8-unused-arguments
"SIM", # flake8-simplify
]
ignore = [
"E501", # line too long (handled by black)
"B008", # do not perform function calls in argument defaults
"B905", # zip() without explicit strict parameter
]
# Allow autofix for all enabled rules
fixable = ["ALL"]
unfixable = []
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"] # Unused imports in __init__.py are OK (exports)
"tests/*" = ["ARG"] # Unused arguments in tests are OK (fixtures)
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
line-ending = "auto"
# ============================================================================
# Build System
# ============================================================================
[build-system]
requires = ["setuptools>=68.0", "wheel"]
build-backend = "setuptools.build_meta"