-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add pyproject.toml #690
Conversation
The documentation is not available anymore as the PR was closed or merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pyproject.toml
Outdated
@@ -0,0 +1,37 @@ | |||
[tool.black] | |||
line-length = 119 | |||
target-version = ['py37'] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
This change makes sense to me! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Left some comments and suggestions to keep us aligned with other libraries (namely accelerate as an example)
pyproject.toml
Outdated
target-version = ['py38'] | ||
|
||
[tool.ruff] | ||
ignore = ["C901", "E501", "E741", "W605"] |
There was a problem hiding this comment.
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
ignore = ["C901", "E501", "E741", "W605"] | |
# Never enforce `E501` (line length violations). | |
ignore = ["C901", "E741", "W605"] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
pyproject.toml
Outdated
|
||
[tool.ruff] | ||
ignore = ["C901", "E501", "E741", "W605"] | ||
select = ["C", "E", "F", "I", "W"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
select = ["C", "E", "F", "I", "W"] | |
select = ["E", "F", "I", "W"] |
pyproject.toml
Outdated
lines-after-imports = 2 | ||
known-first-party = ["trl"] | ||
|
||
[isort] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
pyproject.toml
Outdated
[tool.pytest] | ||
doctest_optionflags = [ | ||
"NORMALIZE_WHITESPACE", | ||
"ELLIPSIS", | ||
"NUMBER", | ||
] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
After suggestions, I made the file equivalent to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks a bunch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
* example pyproject.toml * update target to py38 * make pyproject.toml equivalent to accelerate
* example pyproject.toml * update target to py38 * make pyproject.toml equivalent to accelerate
Other huggingface projects such as transformers, peft, and accelerate all have
pyproject.toml
files that allow different editors to standardize formatting during editing. Although there is already a pre-commitsetup.cfg
it becomes a bit annoying when the style is overridden during editing.I've added a simple default
pyproject.toml
mostly mimicking peft's and keeping the same parameters as thesetup.cfg
. Happy to add / remove any parameters.