Can one disable a goal on a BUILD file basis? We h...
# general
a
Can one disable a goal on a BUILD file basis? We have a directory
exp
which is for experimental code. Our ML engineers perform hideous acts in there that upset the linter and typechecker. There's a
skip_mypy
field on python source, but I'm gonna guess that's not respected by pyright. Would it be worth having a general
skip_check
and
skip_lint
field?
1
c
There is a
skip_pyright
field as well (not sure from which version) that doesn’t seem to be in the docs yet. And you can set them for an entire subtree using
__defaults__({(python_source, python_sources): dict(skip_pyright=True)})
https://github.com/pantsbuild/pants/blob/5a3dddfb73c7ff8e4b8940dd5a6cae970c0c408b/[…]src/python/pants/backend/python/typecheck/pyright/skip_field.py
a
Groovy. I'll go check for a skip_ruff, too. That's helpful, thanks.
👍 1
a
I don't deserve you, Andreas.
😇 2
c
tip:
pants python_source --help-advanced
will give you up-to-date info for your version
👍 1
b
Glad to know I'm not alone in having a team of naughty naughty engineers doing naughty naughty things in an
experimental
directory
😂 3
b
For pyright specifically, you can exclude ignored files in
pyrightconfig.json
and handle this at the tool level:
Copy code
{
  "exclude": [
    "**/node_modules",
    "**/__pycache__",
    "experimental",
    ...
a
Aye, but I wanted to do it through the BUILD so it's easier to opt back in. I've now got
/exp/BUILD
that skips black, ruff, pyright, then I can override that again in
/exp/users/bob
because I'm not a savage
😂 1
I'm delighted to see your PR for pyright cache btw, Krishnan. ❤️
❤️ 2
b
I’ve had a hard time testing that one, but to use the dreaded phrase…it works on my machine 😂
🫠 1
a
We can fire it up on our
build-test
fork and see how it goes, I'll just open a bunch of PRs and see if they all work