-
Notifications
You must be signed in to change notification settings - Fork 462
Add import linters #5134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add import linters #5134
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds import linting to enforce architectural boundaries and dependency rules in the backend codebase using import-linter. It establishes five contracts that prevent circular dependencies and maintain proper layering between modules.
Key Changes:
- Added import-linter as a dev dependency and configured five architectural contracts
- Integrated import-linter into pre-commit hooks and CI/CD pipeline
- Added cache file to .gitignore
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| application/backend/pyproject.toml | Added import-linter dependency and configured five architectural contracts (main_app, api, core_module, schema_model, service_utils) |
| application/backend/.pre-commit-config.yaml | Added import-linter pre-commit hook with --no-cache flag |
| application/backend/.gitignore | Added .import_linter_cache to ignored files |
| .github/workflows/backend-lint-and-test.yaml | Added import-linter check step to CI pipeline |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📊 Test coverage report
|
Docker Image SizesCPU
GPU
XPU
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
leoll2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice setup, only one suggestion
Summary
Added contracts:
App Main Vertical (main_app) - Enforces layered architecture:
api → services → repositories → db. Ensures proper dependency flow from presentation to data layer.Internal API (api) - Controls API module structure:
routers → serializers → schemas → dependencies. Keeps API concerns properly separated.Core Module (core_module) - Layers within core:
jobs → run → models → logging. Ensures core utilities don't have circular dependencies.Schema-Model (schema_model) - Ensures
app.schemassits above bothapp.core.modelsandapp.models. Prevents schema layer from being imported by model layers.Service-Utils (service_utils) -
services → utils. Utilities should be lower-level, imported by services but not vice versa.How to test
uv run lint-importsChecklist