sparse-lifeguard-95737
07/05/2022, 2:25 PMapps.py
files, to replicate the dependency rules that Django uses for pulling in models/migrations/templates etc. Our apps.py
files are mostly lightweight, but a few import some 3rd-party libraries. wondering if I could implement a dependency-inference rule for MyCustomDjangoAppsTarget
, and within the rule do something like cast(PythonSourceTarget, my_custom_target)
, use that to run the “default” dependency inference for python code, then tack on the extra django-specific dependenciesfast-nail-55400
07/05/2022, 2:26 PMfast-nail-55400
07/05/2022, 2:29 PMInferDependenciesRequest
) or the Dependencies
field (if using InjectDependenciesRequest
)
2. Have your custom target use the same fields as the original target except use your subclassed field instead of the original field. The “target API” intentionally knows about the subclass relationship. Any request in other code for the base class will pick up your subclassed field.
3. Implement your dependency inference rule and use your subclass as what to inject/infer for.sparse-lifeguard-95737
07/05/2022, 2:31 PMfast-nail-55400
07/05/2022, 2:31 PMPythonTestsDependenciesField
fast-nail-55400
07/05/2022, 2:32 PM