Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move black parameters to pyproject.toml #6647

Merged
merged 1 commit into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,4 @@ repos:
hooks:
- id: black
name: Format code
args: [--skip-string-normalization, --line-length=119]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm can we keep this here as well as in toml?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I don't think that such duplication is useful

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isort options are also used from pyproject.toml here

additional_dependencies: ['click==8.0.2']
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ default_section = "THIRDPARTY"
extend_skip = ["setup.py", "docs/source/conf.py"]


[tool.black]
line_length = 119
skip_string_normalization = true
required_version = "19.10b0" # recongized by future versions, disallows to reformat code with incompatible versions


[tool.pytest.ini_options]
# durations=0 will display all tests execution time, sorted in ascending order starting from from the slowest one.
# -vv will also display tests with durration = 0.00s
Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@ def req_file(filename, folder="requirements"):


class StyleCommand(distutils_cmd.Command):
__LINE_WIDTH = 119
__ISORT_BASE = 'isort '
__BLACK_BASE = f'black --skip-string-normalization --line-length={__LINE_WIDTH}'
__ISORT_BASE = 'isort'
__BLACK_BASE = 'black'
description = 'Checks overall project code style.'
user_options = [
('scope=', None, 'Folder of file to operate within.'),
Expand Down
Loading