Hi all, I have a dependency in my requirements.txt...
# general
l
Hi all, I have a dependency in my requirements.txt file like this
<git+ssh://git@github.com/rollbar/sqlalchemy.git@bc5c5b21f956a953a8b68523b3092487e7e63bea#egg=sqlalchemy>
and Pants is saying it’s not able to infer the dependency owner for
sqlalchemy
. Do you know how could I fix? 🙏
1
1
The concrete message from Pants is this:
Copy code
./pants dependencies my-project/model/orm/project.py
10:41:59.97 [WARN] Pants cannot infer owners for the following imports in the target my-project/model/orm/project.py:
  * sqlalchemy (line: 7)
  * sqlalchemy.Column (line: 10)
  * sqlalchemy.ForeignKey (line: 10)
  * sqlalchemy.Integer (line: 10)
  * sqlalchemy.exc.IntegrityError (line: 11)
  * sqlalchemy.ext.hybrid.hybrid_property (line: 12)
  * sqlalchemy.orm.relationship (line: 13)
  * sqlalchemy_json.NestedMutableJson (line: 14)
I just found the issue, just read diagonally the docs and copied
target@
verbatim 🙈 instead of using the name of my target
😄 1
Well, I’m still having an issue with this particular lib
pycryptodomex==3.6.6
which installs the package
Cryptodome
but Pants cannot infer it. I’m trying to tell Pants to not infer it:
Copy code
# in my project.py file

import Cryptodome.Random # pants: no-infer-dep
and then adding the dependency explicitly to my root BUILD
Copy code
# top BUILD file

python_sources(
  requirements=["//myproject:reqs#pycryptodomex"]
)

python_requirements(name="reqs")
But seems to have no effect (the dep is ignored but I can’t see it in the output of
./pants dependencies myproject/model/orm/project.py
r
Use
--transitive
i.e.
./pants dependencies --transitive
If the name of the package isn’t same as what you use when importing the package you need to use something called module mapping https://www.pantsbuild.org/docs/python-third-party-dependencies#use-modules-and-module_mapping-when-the-module-name-is-not-standard
l
Oh I think that’s why I was looking for, going to try, thanks!
thanks @refined-addition-53644 that worked!
🙌 1