Decouple component imports from server (#4150)

This commit is contained in:
Jeremiah Lowin 2026-05-15 11:49:08 -04:00 committed by GitHub
commit d8dcc273ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 325 additions and 375 deletions

View file

@ -136,6 +136,7 @@ gh api -X POST repos/PrefectHQ/fastmcp/releases/generate-notes \
### Module Exports
- **Do not create overeager `__init__.py` files.** Package initializers should not import heavy submodules, provider stacks, optional integrations, or modules that can point back into the package. Overeager re-exports make the framework sprawl and create circular imports that only appear in fresh interpreters or clean installs.
- **Be intentional about re-exports** - don't blindly re-export everything to parent namespaces
- Core types that define a module's purpose should be exported (e.g., `Middleware` from `fastmcp.server.middleware`)
- Specialized features can live in submodules (e.g., `fastmcp.server.middleware.dynamic`)