[build-system] requires = ["setuptools>=45", "wheel"] build-backend = "setuptools.build_meta" [project] name = "letzshop-product-import" version = "0.1.0" description = "Multi-tenant e-commerce marketplace platform" requires-python = ">=3.11" # ============================================================================= # RUFF - Modern All-in-One Linter & Formatter # ============================================================================= [tool.ruff] line-length = 88 target-version = "py311" # Exclude directories exclude = [ ".git", ".venv", "venv", "__pycache__", ".mypy_cache", ".pytest_cache", ".ruff_cache", "build", "dist", "alembic/versions", ] [tool.ruff.lint] # Enable comprehensive rule sets select = [ "E", # pycodestyle errors "W", # pycodestyle warnings "F", # pyflakes "I", # isort (import sorting) "N", # pep8-naming "UP", # pyupgrade (modern Python syntax) "B", # flake8-bugbear (common bugs) "C4", # flake8-comprehensions "SIM", # flake8-simplify "PIE", # flake8-pie "RET", # flake8-return "Q", # flake8-quotes ] # Ignore specific rules ignore = [ "E501", # line too long (handled by formatter) "B008", # do not perform function calls in argument defaults (FastAPI Depends) "RET504", # unnecessary variable assignment before return "SIM102", # use a single if statement instead of nested if (sometimes less readable) ] # Allow autofix for all rules fixable = ["ALL"] unfixable = [] # Per-file ignores [tool.ruff.lint.per-file-ignores] # Ignore import violations in __init__.py files (re-exports) "__init__.py" = ["F401", "F403"] # Base files that re-export (re-export Base from core.database) "models/database/base.py" = ["F401"] # Ignore specific rules in test files "tests/**/*.py" = ["S101", "PLR2004"] # Alembic migrations can have longer lines and specific patterns "alembic/versions/*.py" = ["E501", "F401"] # Import sorting configuration (replaces isort) [tool.ruff.lint.isort] known-first-party = ["app", "models", "middleware", "tasks", "storage", "scripts"] section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"] split-on-trailing-comma = true # Formatter configuration (replaces black) [tool.ruff.format] quote-style = "double" indent-style = "space" skip-magic-trailing-comma = false line-ending = "auto" # ============================================================================= # MYPY - Static Type Checker # ============================================================================= [tool.mypy] python_version = "3.11" warn_return_any = true warn_unused_configs = true disallow_untyped_defs = false ignore_missing_imports = true exclude = [ "^\\.venv/", "^venv/", "^build/", "^dist/", "^alembic/versions/", ] # Per-module options [[tool.mypy.overrides]] module = "tests.*" ignore_errors = true [[tool.mypy.overrides]] module = "alembic.*" ignore_errors = true # ============================================================================= # PYTEST - Testing # ============================================================================= [tool.pytest.ini_options] minversion = "7.0" testpaths = ["tests"] python_files = ["test_*.py", "*_test.py"] python_classes = ["Test*"] python_functions = ["test_*"] addopts = [ "-v", "--tb=short", "--strict-markers", "--strict-config", "--color=yes", "--durations=10", "--showlocals", "-ra", "--cov=app", "--cov=models", "--cov=middleware", "--cov-report=term-missing", "--cov-report=html:htmlcov", "--cov-fail-under=80", ] markers = [ "unit: marks tests as unit tests - fast, isolated components", "integration: marks tests as integration tests - multiple components working together", "system: marks tests as system tests - full application behavior", "e2e: marks tests as end-to-end tests - complete user workflows", "slow: marks tests as slow running tests (deselect with '-m \"not slow\"')", "performance: marks tests as performance and load tests", "auth: marks tests as authentication and authorization tests", "products: marks tests as product management functionality", "inventory: marks tests as inventory and stock management", "vendors: marks tests as vendor management (plural - admin context)", "vendor: marks tests as vendor API tests (singular - vendor context)", "admin: marks tests as admin functionality and permissions", "marketplace: marks tests as marketplace import functionality", "stats: marks tests as statistics and reporting", "database: marks tests as tests that require database operations", "external: marks tests as tests that require external services", "api: marks tests as API endpoint tests", "security: marks tests as security-related tests", "ci: marks tests as tests that should only run in CI", "dev: marks tests as development-specific tests", ] filterwarnings = [ "ignore::UserWarning", "ignore::DeprecationWarning", "ignore::PendingDeprecationWarning", "ignore::sqlalchemy.exc.SAWarning", ] timeout = 300 timeout_method = "thread" log_cli = true log_cli_level = "INFO" log_cli_format = "%(asctime)s [%(levelname)8s] %(name)s: %(message)s" log_cli_date_format = "%Y-%m-%d %H:%M:%S" # ============================================================================= # COVERAGE # ============================================================================= [tool.coverage.run] source = ["app", "models", "middleware", "tasks", "storage"] omit = [ "*/tests/*", "*/__pycache__/*", "*/venv/*", "*/.venv/*", "*/alembic/*", "*/scripts/*", ] [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:", "if typing.TYPE_CHECKING:", ]