Implementation of dependency injection for Python 3
Overall
score
92%
{
"context": "This evaluation criteria assesses how well the engineer uses the rodi dependency injection library to implement a user profile management system. The focus is specifically on using type hints in constructor parameters for automatic dependency resolution, proper service registration, and correct provider usage.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Container instantiation",
"description": "Creates a rodi.Container instance using the Container class from the rodi package",
"max_score": 10
},
{
"name": "Service registration",
"description": "Registers all services (DatabaseContext, EmailService, UserRepository, UserProfileService) with the container using registration methods like container.register(), container.add_singleton(), container.add_transient(), or container.add_scoped()",
"max_score": 20
},
{
"name": "Type hints in constructors",
"description": "Uses proper type hints in the __init__ methods of UserRepository (context: DatabaseContext) and UserProfileService (repository: UserRepository, email_service: EmailService) to enable automatic dependency resolution",
"max_score": 25
},
{
"name": "Provider building",
"description": "Calls container.build_provider() to create a Services provider instance that validates and compiles the dependency graph",
"max_score": 15
},
{
"name": "Service resolution",
"description": "Resolves the UserProfileService from the provider using provider.get(UserProfileService) or container.resolve(UserProfileService) to retrieve a fully-injected instance",
"max_score": 15
},
{
"name": "Dependency chain",
"description": "Implements the complete dependency chain where UserProfileService depends on UserRepository and EmailService, and UserRepository depends on DatabaseContext, all resolved automatically through type hints",
"max_score": 15
}
]
}Install with Tessl CLI
npx tessl i tessl/pypi-rodidocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10