Hi there. We use `exclude` arg in Black to exclude...
# general
w
Hi there. We use
exclude
arg in Black to exclude some dirs from black. However, it seems the exclude flag is not working with
pants
by using he same config file pyproject.toml. Anyone having this issue as well?
h
This is probably because Pants tells Black to explicitly run on every file. I think there was a reason we had to do it that that way, but I can't remember why and it might be possible to stop doing so that this just works Have you seen the skip black field? https://www.pantsbuild.org/docs/python-linters-and-formatters#running-only-certain-formatters-or-linters
👍 1
w
oh thanks. I will try that field
❤️ 1
@hundreds-father-404 the skip files in python_sources seems work. But I am wondering if there is a quick way to skip an entire folder including sub-folders. Assuming the following structure, where I want to skip for everything under A and A/B
Copy code
— A
  BUILD
  a.py
  - B
    BUILD
    b.py
It seems I have to use skip fields in both BUILD files A and B. Am I right? is there a quick/ alliterative way?
i guess i can use pants_ignore?
h
Yeah, unfortunately this is not as easy to set on multiple directories as it should be. For now you have to set it in each build file. https://github.com/pantsbuild/pants/issues/13767 suggest some future improvements we are considering You should only use pants ignore if you do not want pants to work with the code at all. It will be like the code does not exist to pants
1