mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Add pyproject.toml for black configuration (#79399)
Motivation - Ensure black configuration consistency with other tools (flake8, isort) Currently linter and formatter tools (flake8, isort and black) configuration about line length are inconsistent. flake8 is 120, isort is 79 (default), black is 88 (default).ba27ee9e8f/.flake8 (L3)isort.cfg does not specify line length.ba27ee9e8f/.isort.cfg (L1-L6)black supports only `pyproject.toml` as a configuration file. However `pyproject.toml` was previously removed #61367 since it had some build issues. I also resolved them by - Use `setuptools.build_meta:__legacy__` as a build-backend to import local packages (e.g. tools) in setup.py (related https://github.com/pytorch/pytorch/pull/60408#issuecomment-873979383) - Add build time dependencies to requires for PEP 517 isolation build environment. This PR does not change line length of black and isort since they will cause a lot of file changes. We should apply in the future if `pyproject.toml` worked fine. Pull Request resolved: https://github.com/pytorch/pytorch/pull/79399 Approved by: https://github.com/suo
This commit is contained in:
parent
9aad40e8eb
commit
e85dfb6203
25
pyproject.toml
Normal file
25
pyproject.toml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
[build-system]
|
||||
requires = [
|
||||
"setuptools",
|
||||
"wheel",
|
||||
"astunparse",
|
||||
"numpy",
|
||||
"ninja",
|
||||
"pyyaml",
|
||||
"setuptools",
|
||||
"cmake",
|
||||
"cffi",
|
||||
"typing_extensions",
|
||||
"future",
|
||||
"six",
|
||||
"requests",
|
||||
"dataclasses",
|
||||
]
|
||||
# Use legacy backend to import local packages in setup.py
|
||||
build-backend = "setuptools.build_meta:__legacy__"
|
||||
|
||||
|
||||
[tool.black]
|
||||
# Uncomment if pyproject.toml worked fine to ensure consistency with flake8
|
||||
# line-length = 120
|
||||
target-version = ["py37", "py38", "py39", "py310"]
|
||||
|
|
@ -3106,7 +3106,7 @@ def make_test(
|
|||
initial_state,
|
||||
variable_length,
|
||||
dropout,
|
||||
**extra_kwargs
|
||||
**extra_kwargs,
|
||||
):
|
||||
test_name = str(
|
||||
"_".join(
|
||||
|
|
@ -3133,7 +3133,7 @@ def make_test(
|
|||
initial_state=initial_state[0],
|
||||
packed_sequence=variable_length[0],
|
||||
dropout=dropout[0],
|
||||
**extra_kwargs
|
||||
**extra_kwargs,
|
||||
)
|
||||
|
||||
f.__name__ = test_name
|
||||
|
|
@ -3179,7 +3179,7 @@ def setup_rnn_tests():
|
|||
initial_state,
|
||||
variable_length,
|
||||
dropout,
|
||||
**extra_kwargs
|
||||
**extra_kwargs,
|
||||
)
|
||||
test_count += 1
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user