rapid-bird-79300
08/16/2021, 11:47 PMskip_isort=False
by default on our project BUILD fileshundreds-father-404
08/16/2021, 11:57 PM{"python_library": "custom_python_library"}
But also, we should add this feature anyways. @proud-dentist-22844 recommended it toorapid-bird-79300
08/17/2021, 12:13 AMproud-dentist-22844
08/17/2021, 12:30 AMproud-dentist-22844
08/17/2021, 12:30 AMhundreds-father-404
08/17/2021, 2:42 AMhundreds-father-404
08/17/2021, 2:45 AM[tailor]
default_field_values = """
{
"python_library": {
"skip_mypy": True,
},
"python_tests": {
"skip_tests": True,
}
}"""
note that ./pants tailor
is generic to all languages, e.g. Shell. Ideally we have something flexible and don't hardcode the skip_x
fields as the only things you can change
cc @happy-kitchen-89482proud-dentist-22844
08/17/2021, 5:32 AM[tailor]
...
[tailor.target_field_defaults]
python_library = { skip_mypy = true }
python_tests = { skip_tests = true }
Or something like this
[tailor.targets.python_library.field_defaults]
skip_mypy = true
skip_pylint = false
[tailor.targets.python_tests]
field_defaults = { skip_tests = true }
[tailor.targets.python_tests.per_directory]
lib/python/fizzbuzz = { skip_tests = false }
I tried to account for what gradually changing the defaults might look like. In one directory, where tests have already been enabled, I would want any new BUILD files under that directory to run tests, but new directories under other libs should stick with the default of disabling tests.hundreds-father-404
08/17/2021, 5:35 AMUse toml, not a triple quoted string.We considered doing that when changing from
pants.ini
to pants.toml
and it ended making it really difficult to (performantly) disambiguate between options vs subsystems. Might be easier to do now that we don't have subscopes like [foo.subscope]
though
Dict options are really rare, so we went with ithundreds-father-404
08/17/2021, 5:36 AM./pants tailor
generates. I do have some concerns w/ it, like how your repo's defaults might diverge from <http://pantsbuild.org|pantsbuild.org>
, which could be really confusing. But I see the appealproud-dentist-22844
08/17/2021, 3:29 PMtailor
, so I would only want to affect tailor (when you add this target to BUILD files, use these default settings to write the target into the BUILD file), not override the target defaults across the board.proud-dentist-22844
08/17/2021, 3:30 PMproud-dentist-22844
08/17/2021, 3:31 PMpants.tailor.toml
file to help signal that “this is different”proud-dentist-22844
08/17/2021, 3:35 PMpants.tailor.toml
# Use this file to customize how ./pants tailor creates/updates BUILD files
[field_defaults]
# Keys are targets, values are a hash of keyword args to use when tailor adds that target to a BUILD file.
python_library = { skip_mypy = true }
python_tests = { skip_tests = true }
[dirs."lib/python/fizzbuzz"]
# This directory has already been migrated so that tests can run successfully.
# So, tailor will use these field values instead of the the field_defaults above
# for all BUILD files that are in the tree of directories under lib/python/fizzbuzz
python_tests = { skip_tests = false }