quick-iron-62162
11/17/2022, 3:10 PMpyproject.toml
the following:
exclude = '''
/(
| \.git
| \.mypy_cache
| \.venv
| migrations
| protos
)/
'''
but running ./pants lint ::
it does not skip them (while running black .
it does).
We also tried writing the following in the root BUILD file:
python_sources(
name="migrations",
skip_black=True,
sources=["**/migrations/*.py"]
)
but it didn’t work.
We know we can put the skip_black=True
in each of the BUILD
files inside all migrations
folders but this would require us to add it every time we have a new migrations
folder, which is a bit of a pain.
Can you help us?bitter-ability-32190
11/17/2022, 3:13 PMexclude
if you provide filenames to the cmd. I think they added a force-exclude
option for this?sparse-lifeguard-95737
11/17/2022, 3:14 PM__defaults__
to set skip_black=True
for all of your migrations# In migrations/BUILD.pants
__defaults__(
{(python_sources, python_source): dict(skip_black=True)}
)
quick-iron-62162
11/17/2022, 3:17 PMmigrations
sub_foldersparse-lifeguard-95737
11/17/2022, 3:17 PMquick-iron-62162
11/17/2022, 3:18 PMbitter-ability-32190
11/17/2022, 3:21 PMquick-iron-62162
11/17/2022, 3:22 PMbitter-ability-32190
11/17/2022, 3:26 PMquick-iron-62162
11/17/2022, 3:27 PMcurved-television-6568
11/17/2022, 3:34 PM# pants.toml
[cli.alias]
exclude-migrations = "!src/apps/foo/migrations:: !src/apps/bar/migrations::"
Then when formatting:
./pants fmt exclude-migrations src/apps::
happy-kitchen-89482
11/17/2022, 5:18 PMpython_sources(
name="migrations",
skip_black=True,
sources=["**/migrations/*.py"]
)
but I’m guessing that you also have another python_sources
that also globs over the migrations?quick-iron-62162
11/17/2022, 6:03 PM./pants tailor
in all of the migrations
folders and all of them contains a python_sources()
so I guess they all override it, am I correct?**/migrations/BUILD
or am I taking a wrong conclusion?happy-kitchen-89482
11/17/2022, 8:06 PMmigrations
target would cover new migration dirs as well, tailor wouldn’t generate new BUILD files for those new migrationsquick-iron-62162
11/17/2022, 8:16 PM