content: [project]
  name = "modular"
  version = "0"
  requires-python = ">= 3.10"
  
  [tool.black]
  include = '\.mojo$'
  line-length = 80
  preview = true
  fast = true
  force-exclude = '''
  (
    /(
        third-party/llvm-project
      | third-party/vllm-benchmarks
      | \.derived
      | venv
      | utils/mblack
      | KGEN/test/mojo-parser
      | KGEN/test/mojo-isolated
      | SDK/lib/API/python/max/serve/schemas
    )/
  )
  '''
  
  [tool.ruff]
  line-length = 80  # Must match above
  src = ["something-that-doesnt-exist"] # Stop ruff from assuming any root directory is a python module
  extend-exclude = [
    "**/lit.cfg.py", # Globals that aren't imported
    "*.ipynb",
    "*max/serve/schemas/openai.py", # Generated file
    "third-party",
    "bazel/internal/llvm-lit/lit.common.cfg.py", # Globals that aren't imported
    "utils/mblack",
  ]
  
  [tool.ruff.lint]
  ignore = [
    "ANN002", # TODO: Missing type annotation for *args
    "ANN003", # TODO: Missing type annotation for **kwargs
    "ANN204", # TODO: Missing return type annotation for special method
    "ANN401", # TODO: Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
    "B008", # Do not perform function call in argument defaults
    "B017", # Do not assert blind exception: `Exception`
    "B028", # No explicit `stacklevel` keyword argument found
    "D100", # TODO: Enable missing docstrings in public modules
    "D101", # TODO: Enable missing docstrings in public classes
    "D103", # TODO: Enable missing docstrings in public functions
    "D104", # TODO: Enable missing docstrings in public packages
    "D105", # undocumented-magic-method
    "E402", # TODO: import top of file
    "E712", # TODO: Unnecessary comparison to bool
    "E722", # bare except
    "E731", # TODO: Don't assign lambda
    "E741", # TODO: Ambiguous variable name
    "F403", # glob imports
    "F405", # TODO: glob imports undefined
    "F821", # TODO: Undefined names, means script is invalid
    "F841", # TODO: unused variables
    "RUF005", # Consider iterable unpacking instead of concatenation
    "RUF009", # Do not perform function call in dataclass defaults
    "RUF010", # Use explicit conversion flag
    "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
    "RUF015", # Prefer `next(iter(iterable))` over single element slice
    "SIM101", # Duplicate isinstance
    "SIM102", # Collapsible if
    "SIM105", # Suppressible exception
    "SIM108", # Use ternary operator
    "SIM114", # Combine arms with or
    "SIM115", # Use context manager for opening files
    "SIM117", # Merge with statements
    "SIM300", # YODA conditions
    "SIM905", # Use a list literal instead of str.split
  ]
  extend-select = [
    "ANN", # Require function type annotations
    "B", # Bugbear lints
    "D", # Pydocstyle lints
    "FURB", # Refurb lints for modernization
    "I", # Import sorting lints
    "RUF", # Ruff specific lints
    "SIM", # Simplify lints
    "T10", # Checks for the presence of debugger calls and imports.
    "UP", # Type annotations should not use Union, Optional, etc
  ]
  
  [tool.ruff.lint.pydocstyle]
  convention = "google"
  
  [tool.ruff.lint.per-file-ignores]
  "__init__.py" = ["F401"] # Ignore unused imports being re-exported
  # Slow rollout of pydocstyle lint:
  # Enable docstring checks only for SDK modules in SDK/lib/API/python/ that currently pass all D rules.
  # To add more modules to this list, test them with:
  #   ./bazelw run //open-source/max/bazel/lint:ruff.check -- --select=D --no-cache <file>
  # and verify no errors are reported for that specific file.
  "!SDK/lib/API/python/max/{driver/__init__.py,driver/driver.py,driver/tensor.py,dtype/__init__.py,engine/__init__.py,engine/api.py,experimental/__init__.py,experimental/random.py,graph/__init__.py,graph/quantization.py,graph/weight.py,interfaces/context.py,interfaces/status.py,nn/embedding.py,nn/float8_config.py,nn/linear.py}" = ["D"]
  # Ignore ANN001 (function argument missing type annotation) for auto-generated
  # stubfiles
  "*.pyi" = ["ANN001", "ANN201", "ANN202", "ANN205", "ANN206"]
  # Disable lints which complain about weird unicode characters in files that include
  # a large number of LLM test prompts.
  "SDK/integration-test/pipelines/python/test_common/test_data.py" = ["RUF001", "RUF003"]
  
  [tool.pyright]
  # TODO: Upgrade to strict mode
  typeCheckingMode = "basic"
  include = ["GenericML/tools/model/"]
  exclude = [
    "**/node_modules",
    "**/__pycache__",
    "GenericML/tools/model/tests",
    "utils/mblack",
  ]
  force-exclude = ["GenericML/tools/model/tests", "utils/mblack"]
  reportMissingImports = false
  