https://pantsbuild.org/ logo
#general
Title
# general
l

lemon-rocket-34449

06/26/2022, 1:54 PM
Hi everyone I have a problem with pants. In the part of my Python code there is the following phrase "import pkg_resources" As we know, this module is in the "setuptools" package, so I put this package in the "requirments.txt" file, but when I run the "./pants check" command, I get the following error: "[ERROR] The following imports in *: ../ python_sources have no owners: * pkg_resources "
n

narrow-vegetable-37489

06/26/2022, 2:17 PM
Take a look at the section in the docs about requirements with undeclared dependencies, it has your exact issue with
pkg_resources
as an example 🙂
If that fails, there's also module_mapping that would solve it, e.g.
module_mapping={"setuptools": ["pkg_resources"]},
I'm fairly certain Pants already does the latter for you though.
l

lemon-rocket-34449

06/26/2022, 2:23 PM
thanks the module_mapping worked.
My another question is, can we get a version of a requirement by executing a Python command or Bash? for example: python_requirement( name="django", requirements=["Django==3.2.1"], ) can set "3.2.1" runtime?
3 Views