hi, when using `black` as the python formatter, it...
# general
f
hi, when using
black
as the python formatter, it's hard to know which version of black
pants fmt
uses. IIUC the requirement is here: https://github.com/pantsbuild/pants/blob/2505e54f2d8dde4f509caa7749de5ab8ae1de450/src/python/pants/backend/python/lint/black/subsystem.py#L43 , but it spans 2 major versions, 22 and 23. for tooling outside of pants (e.g. IDEs), it's important to fix the black (major) version to the same version as pants' to avoid incompatibilities. could pants be more specific about the black version it uses?
b
Yeah, it’s annoying to see what the default versions built-in to pants. Finding the right line of the adjacent lockfile in pants’ source is the (high-effort!) way to confirm it: https://github.com/pantsbuild/pants/blob/2505e54f2d8dde4f509caa7749de5ab8ae1de450/src/python/pants/backend/python/lint/black/black.lock#L151 (Note: you’ll need to make sure you’re looking at the source for the pants version you use.) There’s https://github.com/pantsbuild/pants/issues/20722 for improving the docs to list the version You can control and customise the exact version following: https://www.pantsbuild.org/2.20/docs/python/overview/lockfiles#lockfiles-for-tools