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

Add pyproject.toml #690

Merged
merged 3 commits into from
Sep 1, 2023
Merged
Changes from 1 commit
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
37 changes: 37 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[tool.black]
line-length = 119
target-version = ['py37']
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this should be py38 as we recently dropped 3.7 support #441

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! Thanks for catching that


[tool.ruff]
ignore = ["C901", "E501", "E741", "W605"]
Copy link
Contributor

Choose a reason for hiding this comment

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

At least in Accelerate, we never enforce E501. If we want to keep it consistent across frameworks, adding suggestions for doing so

Suggested change
ignore = ["C901", "E501", "E741", "W605"]
# Never enforce `E501` (line length violations).
ignore = ["C901", "E741", "W605"]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm a bit confused. You're suggesting to remove "E501" from the ignore list, so wouldn't it then be enforced? Accelerate includes it in the ignore list.

Copy link
Contributor

Choose a reason for hiding this comment

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

You're right! I misread, thanks

select = ["C", "E", "F", "I", "W"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
select = ["C", "E", "F", "I", "W"]
select = ["E", "F", "I", "W"]

line-length = 119

[tool.ruff.isort]
lines-after-imports = 2
known-first-party = ["trl"]

[isort]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer isort to be just left in the setup.cfg

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I assumed that it wouldn't sort work correctly with the line length without this block, but it seems to be fine! Removing

default_section = "FIRSTPARTY"
known_first_party = "trl"
known_third_party = [
"numpy",
"torch",
"accelerate",
"transformers",
"peft",
]
line_length = 119
lines_after_imports = 2
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true

[tool.pytest]
doctest_optionflags = [
"NORMALIZE_WHITESPACE",
"ELLIPSIS",
"NUMBER",
]
Copy link
Contributor

Choose a reason for hiding this comment

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

Does trl do docstring as part of their testing suite? In accelerate we do not, it only makes sense here if trl does this cc @younesbelkada

Copy link
Contributor

@younesbelkada younesbelkada Aug 28, 2023

Choose a reason for hiding this comment

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

thanks a lot @muellerzr , indeed we do not test docstrings in our testing suite, so we can maybe safely remove that section