pyright and django-stubs ======================== WHY --- Emacs is configured to use pyright as the Python LSP server (via lsp-pyright) instead of pylsp. Pyright has significantly better type inference, especially for Django's dynamic attributes (model fields, querysets, managers). With django-stubs, pyright understands the Django ORM well enough to provide accurate completions and type checking on QuerySets, Model.objects, request objects, etc. PYRIGHT (language server - system-wide tool) -------------------------------------------- Install via pacman, NOT pip: sudo pacman -S pyright Pyright is already in the Arch extra repo. Do not use pip or pipx for this — pacman keeps it updated with the rest of the system. DJANGO-STUBS (per-project, in the project venv) ------------------------------------------------ django-stubs provides type stubs for Django so pyright understands Django's dynamic attributes. Install inside each Django project's virtual environment: pip install django-stubs This must be installed per-project (not globally) because it needs to match the Django version in use. Also add to requirements-dev.txt or pyproject.toml so other developers get it automatically. Also requires a pyrightconfig.json at the project root with: { "plugins": ["django-stubs"] } Or if using pyright's djangoStubs setting directly: { "djangoStubs": true } SUMMARY ------- - pyright: pacman (system tool, installed once) - django-stubs: pip in venv (per Django project)