Hi, sorry if my mistake is so obvious, but I’m hav...
# general
l
Hi, sorry if my mistake is so obvious, but I’m having a lot of trouble to skip mypy on test files using defaults. I was looking at this solution https://pantsbuild.slack.com/archives/C046T6T9U/p1671206395059209?thread_ts=1671196289.409119&cid=C046T6T9U but on my test project I’m not able to make it work: https://github.com/anler/pants-playground
c
Try with
Copy code
__defaults__({python_tests: dict(skip_mypy=True)})
more details here https://www.pantsbuild.org/docs/targets#field-default-values sorry for the trouble
l
oh darn so that was it, thanks a lot @curved-television-6568 I guess is time for me to take a break out from the computer 😅 🤦
c
the suggestion from Benjy did have a typo in it, so not that easy to see the mistake when it wasn’t yours I’d say 😅
😓 1
l
Nah I was reading the docs too but my brain just skipped the part when it mentions the dict and just assumed keywords for everything
🙃 1
c
if there’s any tweak we can do to make it clearer also for the end-of-the-day head that would be great 🙂
l
maybe a special reference page for
__defaults__
just as there is for targets would be useful for people with my weakness 😜
👍 1
I kind of think more in type signatures and tend to deal better with api references rather than other kinds of documentation
👀 1
c
the reference pages are generated, but we could at least as a first step include a block with the type signature for it. come to think of it, we do have an help endpoint now (
pants symbols --help
) that we could perhaps incorporate into the generated references section.. 🤔
l
well, that’s something new I’ve learnt! I’m going to be using it more
e
Was something like
python_tests.defaults(<has same signature as constructor>)
in a baseclass considered?
c
This is the main enhancement issue for the design doc for the
__defaults__
feature. In there, the
target.defaults(…)
was not surfaced as an alternative from what I recall. That syntax is appealing, however it lacks in it’s inability to apply to multiple target types at once.
e
That lack seems like a feature to me! Easy to grok.
c
I’d prefer correctness over easy to grok if having to chose one over the other (ideally I wouldn’t have to). Correctness being for example, I want to set
skip_mypy=True
for all supported target types in some subtree. With
__defaults__(all=dict(skip_mypy=True)
I don’t need to make sure I’ve provided it for all applicable targets (and also don’t have to go back to it in case there’s new target types added in the future be it by enabling another backend or as new features etc nor the other way in case a backend is disabled) that is done for me.
There are some nastyness with it though wrgt generated targets (as is called out in the docs)
e
Sounds good. I don't grok Pants as I've said before.
c
But for single target type defaults I find your suggestion superior.