1:"$Sreact.fragment" 2:I[3361,["619","static/chunks/619-ba102abea3e3d0e4.js","558","static/chunks/app/layout-8ed3165a2efc4aed.js"],"default"] 3:I[8320,["619","static/chunks/619-ba102abea3e3d0e4.js","558","static/chunks/app/layout-8ed3165a2efc4aed.js"],"default"] 4:I[9766,[],""] 5:I[8924,[],""] 6:I[2619,["619","static/chunks/619-ba102abea3e3d0e4.js","432","static/chunks/app/guides/stemcode-python-developers/page-0aa623f29d826b1a.js"],""] 7:I[9526,["619","static/chunks/619-ba102abea3e3d0e4.js","558","static/chunks/app/layout-8ed3165a2efc4aed.js"],"default"] 8:I[1503,["619","static/chunks/619-ba102abea3e3d0e4.js","558","static/chunks/app/layout-8ed3165a2efc4aed.js"],"default"] 9:I[2067,["619","static/chunks/619-ba102abea3e3d0e4.js","558","static/chunks/app/layout-8ed3165a2efc4aed.js"],"default"] a:I[271,["619","static/chunks/619-ba102abea3e3d0e4.js","558","static/chunks/app/layout-8ed3165a2efc4aed.js"],"default"] 10:I[7150,[],""] :HL["/_next/static/css/a106fc8500d469f6.css","style"] b:T47a,{"@context":"https://schema.org","@type":"BlogPosting","headline":"StemCode for Python Developers: AI Coding with FastAPI, Django, Pytest, Pyright, and Pylsp","description":"Learn how Python developers can use StemCode with FastAPI, Django, pytest, BasedPyright, Pyright, Pylsp, virtual environments, refactoring, static analysis, and AI-assisted code review.","datePublished":"2026-09-21","dateModified":"2026-09-21","author":{"@type":"Organization","name":"GrowBitLabs","url":"https://growbitlabs.com"},"publisher":{"@type":"Organization","name":"GrowBitLabs","url":"https://growbitlabs.com"},"mainEntityOfPage":"https://growbitlabs.com/guides/stemcode-python-developers","url":"https://growbitlabs.com/guides/stemcode-python-developers","keywords":"StemCode Python, AI coding agent for Python, Python AI coding assistant, FastAPI AI coding, Django AI coding, pytest AI, Pyright AI coding, BasedPyright AI, Python code review AI, repository aware AI coding","about":{"@type":"SoftwareApplication","name":"StemCode","applicationCategory":"DeveloperApplication","operatingSystem":"Windows, macOS, Linux","url":"https://growbitlabs.com/stemcode"}}0:{"P":null,"b":"52mZGPOTbZG1yQUVMfwha","p":"","c":["","guides","stemcode-python-developers"],"i":false,"f":[[["",{"children":["guides",{"children":["stemcode-python-developers",{"children":["__PAGE__",{}]}]}]},"$undefined","$undefined",true],["",["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/a106fc8500d469f6.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"children":[["$","div",null,{"className":"scroll-progress","id":"scrollProgress"}],["$","$L3",null,{}],["$","main",null,{"id":"top","children":["$","$L4",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","section",null,{"className":"inner-hero","children":["$","div",null,{"className":"container","children":[["$","div",null,{"className":"inner-eyebrow reveal","children":[["$","span",null,{"children":"404"}],["$","i",null,{}],["$","span",null,{"children":"PAGE NOT FOUND"}]]}],["$","div",null,{"className":"inner-hero-copy reveal","children":[["$","h1",null,{"children":["This page took a wrong ",["$","em",null,{"children":"turn."}]]}],["$","p",null,{"children":"The address may have changed, or the page may no longer be available."}],["$","div",null,{"className":"inner-hero-actions","children":[["$","$L6",null,{"className":"btn primary","href":"/","children":"GO HOME"}],["$","$L6",null,{"className":"btn text","href":"/stemcode","children":"VIEW STEMCODE →"}]]}]]}]]}]}],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}],["$","$L7",null,{}],["$","footer",null,{"className":"site-footer","children":["$","div",null,{"className":"container footer-shell","children":[["$","div",null,{"className":"footer-brand-block","children":[["$","$L6",null,{"className":"brand brand-footer","href":"/","aria-label":"GrowBitLabs home","children":["$","img",null,{"className":"brand-logo","src":"/assets/logo.png","alt":"GrowBitLabs logo"}]}],["$","p",null,{"children":"Home of StemCode and GrowBit Convo. Local-first AI development, private AI infrastructure, and agent engineering."}]]}],["$","div",null,{"className":"footer-columns","children":[["$","nav",null,{"aria-label":"Solutions links","children":[["$","strong",null,{"children":"SOLUTIONS"}],["$","$L6",null,{"href":"/stemcode","children":"StemCode"}],["$","$L6",null,{"href":"/stemcode-survey","children":"StemCode Survey"}],["$","$L6",null,{"href":"/compare","children":"StemCode Comparisons"}],["$","$L6",null,{"href":"/growbit-convo","children":"GrowBit Convo"}],["$","$L6",null,{"href":"/open-models","children":"Open Models"}],["$","$L6",null,{"href":"/pricing","children":"Pricing"}],["$","$L6",null,{"href":"/enterprise","children":"Enterprise"}],["$","$L6",null,{"href":"/docs","children":"StemCode Docs"}],["$","$L6",null,{"href":"/guides","children":"Developer Guides"}]]}],["$","nav",null,{"aria-label":"Company links","children":[["$","strong",null,{"children":"COMPANY"}],["$","$L6",null,{"href":"/about","children":"About"}],["$","$L6",null,{"href":"/services","children":"Services"}],["$","$L6",null,{"href":"/contact","children":"Contact"}],["$","$L6",null,{"href":"/careers","children":"Careers"}],["$","$L6",null,{"href":"/press","children":"Press"}]]}],["$","nav",null,{"aria-label":"Legal links","children":[["$","strong",null,{"children":"LEGAL"}],["$","$L6",null,{"href":"/privacy","children":"Privacy Policy"}],["$","$L6",null,{"href":"/terms","children":"Terms of Service"}],["$","$L8",null,{}]]}],["$","nav",null,{"aria-label":"Social links","children":[["$","strong",null,{"children":"SOCIAL"}],["$","a",null,{"href":"https://www.linkedin.com/company/growbitlabs","target":"_blank","rel":"noopener noreferrer","children":"LinkedIn"}],["$","a",null,{"href":"https://www.facebook.com/growbitlabs/","target":"_blank","rel":"noopener noreferrer","children":"Facebook"}]]}]]}],["$","div",null,{"className":"footer-bottom","children":[["$","span",null,{"children":["(c) ",["$","span",null,{"id":"year"}]," GrowBitLabs"]}],["$","span",null,{"children":"StemCode + GrowBit Convo"}]]}]]}]}],["$","$L9",null,{}],["$","$La",null,{}]]}]}]}]]}],{"children":["guides",["$","$1","c",{"children":[null,["$","$L4",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":["stemcode-python-developers",["$","$1","c",{"children":[null,["$","$L4",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":["__PAGE__",["$","$1","c",{"children":[[["$","script",null,{"type":"application/ld+json","dangerouslySetInnerHTML":{"__html":"$b"}}],"$Lc","$Ld"],null,"$Le"]}],{},null,false]},null,false]},null,false]},null,false],"$Lf",false]],"m":"$undefined","G":["$10",[]],"s":false,"S":true} 1e:I[4431,[],"OutletBoundary"] 20:I[5278,[],"AsyncMetadataOutlet"] 22:I[4431,[],"ViewportBoundary"] 24:I[4431,[],"MetadataBoundary"] 25:"$Sreact.suspense" c:["$","section",null,{"className":"inner-hero docs-hero","children":["$","div",null,{"className":"container","children":[["$","div",null,{"className":"inner-eyebrow reveal","children":[["$","$L6",null,{"href":"/guides","children":"RESOURCES / GUIDES"}],["$","i",null,{}],["$","span",null,{"children":"PYTHON"}]]}],["$","div",null,{"className":"inner-hero-copy reveal","children":[["$","h1",null,{"children":["StemCode for Python Developers: AI Coding with ",["$","em",null,{"children":"FastAPI, Django, and pytest."}]]}],["$","p",null,{"children":"Learn how Python developers can use StemCode with FastAPI, Django, pytest, BasedPyright, Pyright, Pylsp, virtual environments, refactoring, static analysis, and AI-assisted code review."}],["$","div",null,{"className":"inner-hero-actions docs-hero-actions","children":[["$","a",null,{"className":"btn primary","href":"#setup","children":"START SETUP"}],["$","$L6",null,{"className":"btn text","href":"/stemcode","children":"EXPLORE STEMCODE →"}]]}],["$","div",null,{"className":"docs-meta-strip","aria-label":"Guide metadata","children":[["$","span",null,{"children":["PUBLISHED ","2026-09-21"]}],["$","span",null,{"children":"STEMCODE DEVELOPER GUIDE"}],["$","span",null,{"children":"LOCAL-FIRST AI CODING"}]]}]]}]]}]}] d:["$","section",null,{"className":"docs-layout section","children":["$","div",null,{"className":"container docs-shell docs-shell-wide","children":[["$","aside",null,{"className":"docs-sidebar","aria-label":"Guide table of contents","children":[["$","span",null,{"className":"toc-label","children":"GUIDE"}],["$","$L6",null,{"href":"/guides","children":"All developer guides"}],["$","$L6",null,{"href":"/stemcode","children":"StemCode overview"}],["$","$L6",null,{"href":"/docs","children":"StemCode docs"}],["$","span",null,{"className":"toc-label","children":"ON THIS PAGE"}],["$","a",null,{"href":"#agents-md","children":"AGENTS.md project instructions"}],[["$","a","#why",{"href":"#why","children":"Why StemCode for Python"}],["$","a","#setup",{"href":"#setup","children":"Install and set up"}],["$","a","#python-lsp",{"href":"#python-lsp","children":"Python code intelligence"}],["$","a","#fastapi",{"href":"#fastapi","children":"FastAPI workflow"}],["$","a","#django",{"href":"#django","children":"Django workflow"}],["$","a","#testing",{"href":"#testing","children":"pytest and validation"}],["$","a","#typing",{"href":"#typing","children":"Typing and static analysis"}],["$","a","#refactoring",{"href":"#refactoring","children":"Refactoring"}],["$","a","#memory",{"href":"#memory","children":"Project memory"}],["$","a","#review",{"href":"#review","children":"Git and code review"}],["$","a","#faq",{"href":"#faq","children":"FAQ"}]]]}],["$","article",null,{"className":"docs-content","children":[["$","section",null,{"id":"agents-md","className":"docs-section reveal","children":[["$","span",null,{"children":"PROJECT INSTRUCTIONS / AGENTS.MD"}],["$","h2",null,{"children":"Give StemCode durable repository instructions before asking it to edit."}],["$","p",null,{"children":["Add an ",["$","code",null,{"children":"AGENTS.md"}]," file at the repository root for persistent project instructions. StemCode loads",["$","code",null,{"children":" AGENTS.md"}]," or ",["$","code",null,{"children":".agent/AGENTS.md"}]," from the workspace into the model context, so this is the right place for architecture boundaries, generated-file rules, coding conventions, validation expectations, and manual setup notes that should apply across sessions."]}],["$","div",null,{"className":"docs-note","children":[["$","b",null,{"children":"Keep AGENTS.md practical and repository-specific"}],["$","p",null,{"children":"Prefer concrete rules the agent can act on: where important source lives, what it must not edit, which patterns it should preserve, and which checks it should run after a change."}]]}],["$","pre",null,{"children":["$","code",null,{"children":"# Python Project Instructions\n\nThis is a Python project.\n\nImportant source and configuration:\n- pyproject.toml, requirements files, or the repository's package configuration\n- src/, app/, or the project's main package\n- tests/\n- migrations and framework configuration when present\n\nFollow these rules:\n- Follow the repository's existing typing, formatting, linting, and import conventions.\n- Do not modify .venv/, __pycache__/, .pytest_cache/, build output, or generated files.\n- Preserve sync/async boundaries and existing FastAPI, Django, or service-layer patterns.\n- Reuse existing dependencies before adding new packages.\n- Keep validation, permissions, ORM behavior, and migrations in view when changing data flows.\n- Run focused pytest, type-check, and lint commands before broader validation."}]}],["$","p",null,{"children":"Commit the file with the project so the same instructions are reviewable and shared by everyone using StemCode in the repository."}]]}],[["$","section",null,{"id":"why","className":"docs-section reveal","children":[["$","span",null,{"children":"01 / WHY STEMCODE FOR PYTHON"}],["$","h2",null,{"children":"Use AI across modules, frameworks, tests, and tooling."}],["$","p",null,{"children":"Python projects can look simple at first and become complex quickly. A production application may combine API routes, dependency injection, ORM models, background jobs, validation, data pipelines, async code, notebooks, CLI tools, tests, type checking, and deployment scripts."}],"$L11","$L12"]}],"$L13","$L14","$L15","$L16","$L17","$L18","$L19","$L1a","$L1b","$L1c"],"$L1d"]}]]}]}] e:["$","$L1e",null,{"children":["$L1f",["$","$L20",null,{"promise":"$@21"}]]}] f:["$","$1","h",{"children":[null,[["$","$L22",null,{"children":"$L23"}],null],["$","$L24",null,{"children":["$","div",null,{"hidden":true,"children":["$","$25",null,{"fallback":null,"children":"$L26"}]}]}]]}] 11:["$","p",null,{"children":"StemCode works against the whole repository instead of only the file currently open in an editor. It can search the codebase, use language-server information, make tracked edits, run approved project commands, investigate failures, and review Git changes."}] 12:["$","div",null,{"className":"docs-callout docs-callout-strong","children":[["$","strong",null,{"children":"GOOD FIT FOR PYTHON TEAMS"}],["$","p",null,{"children":"FastAPI, Django, Flask, pytest, SQLAlchemy, Pydantic, Celery, BasedPyright, Pyright, Pylsp, Ruff, mypy, Poetry, uv, pip, virtual environments, and normal Git workflows can all stay part of the same engineering loop."}]]}] 13:["$","section",null,{"id":"setup","className":"docs-section reveal","children":[["$","span",null,{"children":"02 / SETUP"}],["$","h2",null,{"children":"Install StemCode and open your existing Python repository."}],["$","p",null,{"children":"Install the StemCode CLI with an npm-family package manager or the official shell installers. The packaged CLI is self-contained and does not require the .NET SDK."}],["$","div",null,{"className":"doc-command","children":[["$","b",null,{"children":"npm"}],["$","code",null,{"children":"npm install -g stemcode"}]]}],["$","div",null,{"className":"doc-command","children":[["$","b",null,{"children":"pnpm"}],["$","code",null,{"children":"pnpm add -g stemcode"}]]}],["$","p",null,{"children":"Start StemCode from the repository root:"}],["$","pre",null,{"children":["$","code",null,{"children":["cd my-python-project","\n","stemcode"]}]}],["$","p",null,{"children":"Initialize repository-specific StemCode files:"}],["$","pre",null,{"children":["$","code",null,{"children":"/init"}]}],["$","p",null,{"children":"Use those files for architecture notes, test strategy, reusable commands, framework conventions, and project-specific constraints."}],["$","div",null,{"className":"docs-note","children":[["$","b",null,{"children":"Virtual environments"}],["$","p",null,{"children":["StemCode's language-server discovery checks common workspace virtual-environment locations such as ",["$","code",null,{"children":".venv"}]," and",["$","code",null,{"children":"venv"}]," before falling back to PATH, which fits common Python repository layouts."]}]]}]]}] 14:["$","section",null,{"id":"python-lsp","className":"docs-section reveal","children":[["$","span",null,{"children":"03 / PYTHON CODE INTELLIGENCE"}],["$","h2",null,{"children":"Use BasedPyright, Pyright, or Pylsp for semantic navigation."}],["$","p",null,{"children":"StemCode supports LSP-powered code intelligence and includes built-in Python server definitions. The documented options include BasedPyright, Pyright, and Python LSP Server."}],["$","h3",null,{"children":"Install BasedPyright"}],["$","pre",null,{"children":["$","code",null,{"children":"pip install basedpyright"}]}],["$","h3",null,{"children":"Or install Pylsp"}],["$","pre",null,{"children":["$","code",null,{"children":"pip install python-lsp-server"}]}],["$","p",null,{"children":"Then refresh server detection inside StemCode:"}],["$","pre",null,{"children":["$","code",null,{"children":"/lsp refresh"}]}],["$","p",null,{"children":"Inspect detected servers:"}],["$","pre",null,{"children":["$","code",null,{"children":"/lsp"}]}],["$","p",null,{"children":"Or inspect one Python source file:"}],["$","pre",null,{"children":["$","code",null,{"children":"/lsp file app/services/order_service.py"}]}],["$","p",null,{"children":"Semantic information about definitions, references, diagnostics, and symbols is especially useful in Python codebases that rely on protocols, abstract base classes, decorators, dependency injection, or dynamic framework registration."}]]}] 15:["$","section",null,{"id":"fastapi","className":"docs-section reveal","children":[["$","span",null,{"children":"04 / FASTAPI"}],["$","h2",null,{"children":"Trace an API feature from route to persistence and side effects."}],["$","p",null,{"children":"FastAPI projects often distribute a feature across routers, dependencies, Pydantic models, services, SQLAlchemy repositories, background tasks, and external integrations."}],["$","div",null,{"className":"docs-feature-card","children":[["$","span",null,{"children":"EXAMPLE PROMPT"}],["$","h3",null,{"children":"Trace order creation."}],["$","p",null,{"children":"Trace POST /orders from the FastAPI router through request models, dependencies, authorization, services, database access, transactions, background tasks, and external integrations. Identify the most important functions, classes, and tests."}]]}],["$","p",null,{"children":"Then narrow the investigation:"}],["$","pre",null,{"children":["$","code",null,{"children":"Find every place OrderStatus changes and explain which transitions are allowed."}]}],["$","pre",null,{"children":["$","code",null,{"children":"Find all dependencies used by this endpoint and explain which ones perform I/O or authorization."}]}],["$","p",null,{"children":"When implementing a feature, make discovery part of the request:"}],["$","pre",null,{"children":["$","code",null,{"children":"Add support for cancelling an order before fulfillment.\n\nBefore editing:\n- inspect similar FastAPI endpoints\n- identify authorization dependencies\n- find the service and persistence flow\n- inspect transaction handling\n- identify background tasks or events\n- find relevant tests\n\nThen implement the feature, run targeted tests, and review the Git diff."}]}]]}] 16:["$","section",null,{"id":"django","className":"docs-section reveal","children":[["$","span",null,{"children":"05 / DJANGO"}],["$","h2",null,{"children":"Use repository context across views, models, forms, signals, and tasks."}],["$","p",null,{"children":"Django applications often hide important behavior in model methods, managers, middleware, signals, forms, DRF serializers, permissions, Celery tasks, and settings. StemCode can inspect those pieces together."}],["$","div",null,{"className":"docs-grid-2","children":[["$","div",null,{"className":"docs-feature-card","children":[["$","span",null,{"children":"DJANGO REST FRAMEWORK"}],["$","h3",null,{"children":"Trace request behavior."}],["$","p",null,{"children":"Trace this endpoint through the view or viewset, serializer, permission classes, model manager, ORM queries, signals, and background tasks."}]]}],["$","div",null,{"className":"docs-feature-card","children":[["$","span",null,{"children":"MODEL BEHAVIOR"}],["$","h3",null,{"children":"Find hidden side effects."}],["$","p",null,{"children":"Find every place this model is saved or updated and identify signals, overridden save methods, managers, tasks, or audit logic that can run as a side effect."}]]}]]}],["$","p",null,{"children":"For security-sensitive Django work, ask StemCode to review permission classes, queryset scoping, object ownership, and administrative paths rather than checking only the visible view code."}]]}] 17:["$","section",null,{"id":"testing","className":"docs-section reveal","children":[["$","span",null,{"children":"06 / PYTEST AND VALIDATION"}],["$","h2",null,{"children":"Keep the real Python test suite in the loop."}],["$","p",null,{"children":"AI-generated changes become more trustworthy when they are validated by the repository's real test runner and configuration."}],["$","div",null,{"className":"docs-grid-2","children":[["$","div",null,{"className":"docs-feature-card","children":[["$","span",null,{"children":"PYTEST"}],["$","h3",null,{"children":"Run focused tests first."}],["$","pre",null,{"children":["$","code",null,{"children":["pytest","\n","pytest tests/test_orders.py","\n","pytest -k cancel_order"]}]}]]}],["$","div",null,{"className":"docs-feature-card","children":[["$","span",null,{"children":"DJANGO"}],["$","h3",null,{"children":"Use project-specific commands."}],["$","pre",null,{"children":["$","code",null,{"children":"python manage.py test"}]}]]}]]}],["$","p",null,{"children":"A useful instruction for a large suite is:"}],["$","pre",null,{"children":["$","code",null,{"children":"Run the smallest relevant test scope first. If it passes, run the broader affected suite."}]}],["$","h3",null,{"children":"Debug failures before editing again"}],["$","pre",null,{"children":["$","code",null,{"children":"Run the failing test and explain whether the root cause is production code, fixtures, dependency overrides, database state, async behavior, or environment configuration before changing anything."}]}],["$","h3",null,{"children":"Add a reusable Python validation command"}],["$","p",null,{"children":["Teams can turn the normal test, type-check, and lint loop into a project command under ",["$","code",null,{"children":".stemcode/commands"}],". After this file is committed, developers can run it in StemCode as",["$","code",null,{"children":" /python-validate"}],"."]}],["$","pre",null,{"children":["$","code",null,{"children":"---\nname: python-validate\ndescription: Run Python tests, type checks, and linting\nargs: [\"testScope\"]\n---\n\nValidate the Python workspace using the repository's real tools.\n\nRun these commands in order:\n\n1. pytest $testScope\n2. pyright\n3. ruff check .\n\nIf a command fails, stop, summarize the failure, identify the most\nrelevant module or test, and explain the next fix before editing."}]}],["$","h3",null,{"children":"Important allow-list checks"}],["$","p",null,{"children":"Python validation may read virtual environments, write test caches, and inspect package metadata, so check the active rules before running a validation-heavy task:"}],["$","pre",null,{"children":["$","code",null,{"children":"/permissions\n/rules\n/allow shell \"pytest *\"\n/allow shell \"pyright *\"\n/allow shell \"ruff check *\""}]}],["$","p",null,{"children":"The important tool categories are repository file read/search, Python language-server inspection, shell execution for pytest and static checks, and file writes only when you ask StemCode to implement a fix."}]]}] 18:["$","section",null,{"id":"typing","className":"docs-section reveal","children":[["$","span",null,{"children":"07 / TYPING AND STATIC ANALYSIS"}],["$","h2",null,{"children":"Use type checking and linting as AI guardrails."}],["$","p",null,{"children":"Python's flexibility is productive, but it also means a change can look correct while violating assumptions only expressed through types, lint rules, or tests."}],["$","div",null,{"className":"docs-grid-2","children":[["$","div",null,{"className":"docs-feature-card","children":[["$","span",null,{"children":"PYRIGHT / BASEDPYRIGHT"}],["$","h3",null,{"children":"Check type contracts."}],["$","pre",null,{"children":["$","code",null,{"children":"pyright"}]}],["$","p",null,{"children":"Ask StemCode to fix only type errors introduced by the current change unless you explicitly want broader cleanup."}]]}],["$","div",null,{"className":"docs-feature-card","children":[["$","span",null,{"children":"RUFF / MYPY"}],["$","h3",null,{"children":"Use existing project standards."}],["$","pre",null,{"children":["$","code",null,{"children":["ruff check .","\n","mypy ."]}]}],["$","p",null,{"children":"Keep the repository's existing configuration authoritative instead of inventing a new formatting or typing policy."}]]}]]}]]}] 19:["$","section",null,{"id":"refactoring","className":"docs-section reveal","children":[["$","span",null,{"children":"08 / REFACTORING"}],["$","h2",null,{"children":"Map dynamic call paths before restructuring Python code."}],["$","p",null,{"children":"Refactoring Python can be deceptively risky when decorators, runtime registration, dependency injection, dynamic imports, or framework conventions obscure callers."}],["$","pre",null,{"children":["$","code",null,{"children":"Find every caller and implementation related to PaymentService. Explain how splitting authorization and capture would affect API handlers, background jobs, tests, and dependency wiring."}]}],["$","p",null,{"children":"For a risky change, switch to planning mode:"}],["$","pre",null,{"children":["$","code",null,{"children":"/profile plan"}]}],["$","p",null,{"children":"Then request a staged migration:"}],["$","pre",null,{"children":["$","code",null,{"children":"Create a step-by-step refactoring plan that keeps the application runnable and testable between steps. Do not modify files yet."}]}],["$","p",null,{"children":"After reviewing the plan, implement incrementally and run the relevant tests and static checks after each meaningful step."}]]}] 1a:["$","section",null,{"id":"memory","className":"docs-section reveal","children":[["$","span",null,{"children":"09 / PROJECT MEMORY"}],["$","h2",null,{"children":"Store Python conventions where the team can review them."}],["$","p",null,{"children":"StemCode workspace memory can capture project-specific expectations so you do not have to restate them in every prompt."}],["$","h3",null,{"children":"Example architecture notes"}],["$","pre",null,{"children":["$","code",null,{"children":"FastAPI routers contain HTTP orchestration only.\nBusiness logic belongs in service modules.\nDatabase access is isolated behind repository functions.\nBackground tasks must be idempotent.\nExternal API clients use explicit timeout and retry policies."}]}],["$","h3",null,{"children":"Example test strategy"}],["$","pre",null,{"children":["$","code",null,{"children":"Focused tests: pytest tests/unit\nAPI tests: pytest tests/api\nType check: pyright\nLint: ruff check ."}]}]]}] 1b:["$","section",null,{"id":"review","className":"docs-section reveal","children":[["$","span",null,{"children":"10 / GIT AND CODE REVIEW"}],["$","h2",null,{"children":"Add a Python-specific review pass before the pull request."}],["$","pre",null,{"children":["$","code",null,{"children":"Review the current Git diff as a senior Python reviewer.\n\nFocus on:\n- correctness and regressions\n- async and await mistakes\n- mutable defaults and shared state\n- typing and API contracts\n- database query behavior\n- authorization and input validation\n- background-task reliability\n- error handling and logging\n- missing tests"}]}],["$","p",null,{"children":"Or pipe the diff directly:"}],["$","pre",null,{"children":["$","code",null,{"children":"git diff | stemcode --stdin --profile review"}]}],["$","div",null,{"className":"docs-callout","children":[["$","strong",null,{"children":"THE PRACTICAL LOOP"}],["$","p",null,{"children":"Understand → plan → implement → test → type-check → lint → review. StemCode adds repository context and automation while your framework, test runner, type checker, linter, Git diff, and human review remain the verification layers."}]]}]]}] 1c:["$","section",null,{"id":"faq","className":"docs-section reveal","children":[["$","span",null,{"children":"11 / FAQ"}],["$","h2",null,{"children":"StemCode for Python developers: common questions."}],["$","h3",null,{"children":"Does StemCode work with FastAPI?"}],["$","p",null,{"children":"Yes. StemCode works against the repository, so it can inspect routers, dependencies, Pydantic models, services, database code, background tasks, tests, and surrounding project configuration."}],["$","h3",null,{"children":"Does StemCode work with Django?"}],["$","p",null,{"children":"Yes. It can analyze Django and Django REST Framework projects alongside models, managers, serializers, permission classes, signals, settings, Celery tasks, and tests."}],["$","h3",null,{"children":"Can StemCode run pytest?"}],["$","p",null,{"children":"Yes. StemCode can run approved shell commands, including pytest, project-specific test scripts, and targeted test selections."}],["$","h3",null,{"children":"Which Python language servers does StemCode support?"}],["$","p",null,{"children":"StemCode's built-in language-server definitions include BasedPyright, Pyright, and Pylsp options for Python code intelligence."}],["$","h3",null,{"children":"Can StemCode use Ruff, mypy, or Pyright?"}],["$","p",null,{"children":"Yes. You can include your existing linting and type-checking commands in the validation steps for a task so the agent works with your repository's current quality gates."}]]}] 1d:["$","section",null,{"className":"docs-section reveal","children":[["$","span",null,{"children":"NEXT STEP"}],["$","h2",null,{"children":"Put StemCode to work in a real repository."}],["$","p",null,{"children":"Install StemCode, open the project you already work in, and begin with a repository-understanding task before asking the agent to change code. That gives the model better context and keeps the workflow reviewable."}],["$","div",null,{"className":"docs-grid-2 docs-spaced","children":[["$","div",null,{"className":"docs-feature-card","children":[["$","span",null,{"children":"INSTALL"}],["$","h3",null,{"children":"Start with the CLI."}],["$","pre",null,{"children":["$","code",null,{"children":["npm install -g stemcode","\n","cd your-project","\n","stemcode"]}]}]]}],["$","div",null,{"className":"docs-feature-card","children":[["$","span",null,{"children":"LEARN"}],["$","h3",null,{"children":"Go deeper."}],["$","p",null,{"children":"Read the full StemCode documentation for providers, permissions, LSP integrations, memory, MCP, CI review, and advanced workspace configuration."}],["$","$L6",null,{"className":"inline-arrow","href":"/docs","children":"READ THE DOCS →"}]]}]]}]]}] 23:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","2",{"name":"theme-color","content":"#f4f5f0"}]] 1f:null 27:I[622,[],"IconMark"] 21:{"metadata":[["$","title","0",{"children":"StemCode for Python Developers: AI Coding with FastAPI, Django, Pytest, Pyright, and Pylsp | GrowBitLabs"}],["$","meta","1",{"name":"description","content":"Learn how Python developers can use StemCode with FastAPI, Django, pytest, BasedPyright, Pyright, Pylsp, virtual environments, refactoring, static analysis, and AI-assisted code review."}],["$","meta","2",{"name":"keywords","content":"StemCode Python,AI coding agent for Python,Python AI coding assistant,FastAPI AI coding,Django AI coding,pytest AI,Pyright AI coding,BasedPyright AI,Python code review AI,repository aware AI coding"}],["$","meta","3",{"name":"robots","content":"index, follow"}],["$","meta","4",{"name":"googlebot","content":"index, follow"}],["$","link","5",{"rel":"canonical","href":"https://growbitlabs.com/guides/stemcode-python-developers"}],["$","meta","6",{"property":"og:title","content":"StemCode for Python Developers: AI Coding with FastAPI, Django, Pytest, Pyright, and Pylsp"}],["$","meta","7",{"property":"og:description","content":"Learn how Python developers can use StemCode with FastAPI, Django, pytest, BasedPyright, Pyright, Pylsp, virtual environments, refactoring, static analysis, and AI-assisted code review."}],["$","meta","8",{"property":"og:url","content":"https://growbitlabs.com/guides/stemcode-python-developers"}],["$","meta","9",{"property":"og:type","content":"article"}],["$","meta","10",{"property":"article:published_time","content":"2026-09-21"}],["$","meta","11",{"name":"twitter:card","content":"summary_large_image"}],["$","meta","12",{"name":"twitter:title","content":"StemCode for Python Developers: AI Coding with FastAPI, Django, Pytest, Pyright, and Pylsp"}],["$","meta","13",{"name":"twitter:description","content":"Learn how Python developers can use StemCode with FastAPI, Django, pytest, BasedPyright, Pyright, Pylsp, virtual environments, refactoring, static analysis, and AI-assisted code review."}],["$","link","14",{"rel":"icon","href":"/assets/fav.png","sizes":"196x186","type":"image/png"}],["$","link","15",{"rel":"apple-touch-icon","href":"/assets/fav.png","sizes":"196x186","type":"image/png"}],["$","$L27","16",{}]],"error":null,"digest":"$undefined"} 26:"$21:metadata"