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

cold-vr-15232

09/27/2022, 2:24 PM
I have one more question for today. I had my project working with all goals and all looked nice. I then added a dependency to a library (pydantic, but I don't think it matters) and the apps still run nicely, but the linting throws an error (No name 'BaseModel' in module 'pydantic'). I don't understand why would that happen, nor what to change to make it work again. Unfortunately, thins kind of issues are what make people anxious about trying a new tool, so I'd like to be prepared when I try to sell the idea to my team.
1
r

refined-addition-53644

09/27/2022, 2:27 PM
Have you added pydantic as 3rd party dependency so that pants can use it? I am using pydantic also and it works fine with pants.
c

cold-vr-15232

09/27/2022, 2:35 PM
yes, and I can the app just fine. Searching the net gives that it's a problem with pylint, so I guess it's all good for Pants.
r

refined-addition-53644

09/27/2022, 2:35 PM
ah ok. I use flake8 and hence hasn’t seen this issue.
b

bitter-ability-32190

09/27/2022, 2:56 PM
Pylint FWIW existed pre type hints and so parses source code to try reeeeally hard to make type inferences. Sometimes it misses the mark 🙂 but for the time it actually did a great job. Nowadays I feel like mypy and other tools cover a large area, and would love to see a type-hint aware tool fill in the rest
c

cold-vr-15232

09/27/2022, 2:58 PM
For reference, this fixes the issue: (in pyproject.toml)
[tool.pylint.'MESSAGES CONTROL']
extension-pkg-whitelist = "pydantic"
👍 1
b

bitter-ability-32190

09/27/2022, 2:59 PM
Ah yeah. Hard to parse source code when there is no source code 😂
h

hundreds-father-404

09/27/2022, 5:41 PM
huh, thanks for the update Vlad!
8 Views