curved-television-6568
09/22/2022, 2:34 PMimport django.contrib.postgres
and that module in turn uses psycopg2
but it isn’t inferred nor provided as a dependency of Django itself as it’s optional.
You can use the module mapping feature in Pants to your advantage in this case, with a snippet like this:
python_requirements(
module_mapping={
"psycopg2": [
"psycopg2",
# This is for dependency inference only, when we see an import for
# `django.contrib.postgres` we should infer a dependency on `psycopg2`.
"django.contrib.postgres",
],
},
...
Pants will properly infer the dependency for you correctly. 🎉bitter-ability-32190
09/22/2022, 2:36 PMhappy-kitchen-89482
09/22/2022, 3:15 PMbusy-vase-39202
09/22/2022, 4:21 PMbusy-vase-39202
09/22/2022, 4:21 PMbitter-ability-32190
09/22/2022, 4:27 PMbusy-vase-39202
09/22/2022, 4:29 PMbitter-ability-32190
09/22/2022, 4:30 PMbusy-vase-39202
09/22/2022, 4:33 PMcurved-television-6568
09/22/2022, 4:45 PMbusy-vase-39202
09/22/2022, 5:34 PMcurved-television-6568
09/22/2022, 5:42 PMbusy-vase-39202
09/22/2022, 5:58 PMrough-vase-83553
09/23/2022, 11:01 PMbusy-vase-39202
09/23/2022, 11:10 PMrough-vase-83553
09/23/2022, 11:11 PMrough-vase-83553
09/23/2022, 11:30 PM