fix(sage-monorepo): format on save Python files with black
#2262
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #2261
Description
Configure Format On Save for Python files.
Changelog
flake8
from running when saving Python filesms-python.black-formatter
to the dev containerNotes
Also, the Black extension for VS Code says:
Your Python project must still have
black
as a dev dependencies in your project poetry file. The above feature of the Black extension means that the output of formatting withblack
programmatically (e.g. in the CI workflow) and in VS Code (Format On Save) should be the same.Here is the version of Black bundle with the extension used when a Python project does not provide black itself.
After preparing the Python environment for
schematic-api
and activating it in VS Code, we can see that Format On Save use the version of Black specified by theschematic-api
project. It is this version that will be executed by the CI workflow.In
pyproject.toml
:Preview
Format On Save