First time here? Check out the FAQ!

Revision history  [back]

Auto-reformatting using Black doesn't use config in pyproject.toml

Hi!

I have configured the line-length for Black in a pyproject.toml:

[tool.black]
line-length = 120

When I manually run python -m black some/project/file.py this is respected. However when I turn on auto reformatting using Black (set to "Whole Files Before Save") the specified line-length doesn't seem to be respected, and that results in a different output that what is produced by running python -m black some/project/file.py manually.

I suspect that Black might be invoked using the -c or --code flag with the whole file source being passed into it. That could explain why the issue happens, since Black won't know where to look for the config file.

Is this possible to fix somehow, or is it possible to add custom command line flags to the black command that WingPro executes (that I could use to manually add a --config flag)?

Auto-reformatting using Black doesn't use config in pyproject.toml

Hi!

I have configured the line-length for Black in a pyproject.toml:

[tool.black]
line-length = 120

When I manually run python -m black some/project/file.py this is respected. However when I turn on auto reformatting using Black (set to "Whole Files Before Save") the specified line-length doesn't seem to be respected, and that results in a different output that what is produced by running python -m black some/project/file.py manually.

I suspect that Black might be invoked using the -c or --code flag with the whole file source being passed into it. That could explain why the issue happens, since Black won't know where to look for the config file.

Is this possible to fix somehow, or is it possible to add custom command line flags to the black command that WingPro executes (that I could use to manually add a --config flag)?

Auto-reformatting using Black doesn't use config in pyproject.toml

Hi!

I have configured the line-length for Black in a pyproject.toml:

[tool.black]
line-length = 120

When I manually run python -m black some/project/file.py this is respected. However when I turn on auto reformatting using Black (set to "Whole Files Before Save") the specified line-length doesn't seem to be respected, and that results in a different output that what is produced by running python -m black some/project/file.py manually.

I suspect that Black might be invoked using the -c or --code flag with the whole file source being passed into it. That could explain why the issue happens, since Black won't know where to look for the config file.

Is this possible to fix somehow, or is it possible to add custom command line flags to the black command that WingPro executes (that I could use to manually add a --config flag)?

Auto-reformatting using Black doesn't use config in pyproject.toml

Hi!

I have configured the line-length for Black in a pyproject.toml:

[tool.black]
line-length = 120

When I manually run python -m black some/project/file.py this is respected. However when I turn on auto reformatting using Black (set to "Whole Files Before Save") the specified line-length doesn't seem to be respected, and that results in a different output that what is produced by running python -m black some/project/file.py manually.

I suspect that Black might be invoked using the -c or --code flag with the whole file source being passed into it. That could explain why the issue happens, since Black won't know where to look for the config file.

Is this possible to fix somehow, or is it possible to add custom command line flags to the black command that WingPro executes (that I could use to manually add a --config flag)?