-
Notifications
You must be signed in to change notification settings - Fork 246
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
Improve current ruff rules #1720
Conversation
The tests are not failing because of make -C docs html
make[1]: Entering directory '/home/runner/work/numpyro/numpyro/docs'
Running Sphinx v4.5.0
/opt/hostedtoolcache/Python/3.9.1[8](https://github.com/pyro-ppl/numpyro/actions/runs/7531465780/job/20500091407?pr=1720#step:6:9)/x64/lib/python3.[9](https://github.com/pyro-ppl/numpyro/actions/runs/7531465780/job/20500091407?pr=1720#step:6:10)/site-packages/nbsphinx.py:1450: RuntimeWarning: You are using an unsupported version of pandoc (2.9.2.1).
Your version must be at least (2.14.2) but less than (4.0.0).
Refer to https://pandoc.org/installing.html.
Continuing with doubts...
nbconvert.utils.pandoc.check_pandoc_version()
loading translations [en]... done
Sphinx version error:
The sphinxcontrib.applehelp extension used by this project needs at least Sphinx v5.0; it therefore cannot be built with this version.
make[1]: *** [Makefile:20: html] Error 2
make[1]: Leaving directory '/home/runner/work/numpyro/numpyro/docs'
make: *** [Makefile:26: docs] Error 2
Error: Process completed with exit code 2. |
A suggested fix for the docs: #1721 Once this one is merged (or any other solution). I will rebase this one, and it should be 🟢! |
6d7b2c5
to
dbf5916
Compare
pyproject.toml
Outdated
@@ -31,13 +31,11 @@ exclude = [ | |||
] | |||
|
|||
# Same as Black. | |||
line-length = 88 | |||
line-length = 120 |
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 guess we prefer 88 here
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 think before we started the migration to ruff we had 120 (see original PR).
I can of course change it to 88. I might need to format some code a bit if I remember correctly. Is that ok?
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.
If I set 88
I get Found 821 errors
(this comes from the 120 rule I mentioned). I could either keep 120
or set it to 88
and ignore the E501
rule as it is very hard to fix 821 errors :)
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.
Previously, we allowed doc length 120 and code length 88. Do you think that we can maintain that behavior? If we set 120 here, will long code be formatted?
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.
If we set 120 there is not refactor needed at all. I guess we can simply add 88 and ignore the rule for docstrings
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.
Seems like
[tool.ruff.lint.pycodestyle]
max-line-length = 120
does the job
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.
Indeed! Thanks 💪 ! See 493da8e
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, @juanitorduz!
* improve current ruff rules * rm comments * fix lengths * trim
I keep improving the changes introduced in #1700. Note that in the
setup.cfg
file we hadmax-line-length = 120
. This PR updates this condition and adds all the remainingpyflake
rules. Note this is very similar topyro
's config https://github.com/pyro-ppl/pyro/blob/dev/pyproject.toml