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

Replace nbqa-ruff with ruff #3476

Closed
Saransh-cpp opened this issue Oct 26, 2023 · 10 comments · Fixed by #3483
Closed

Replace nbqa-ruff with ruff #3476

Saransh-cpp opened this issue Oct 26, 2023 · 10 comments · Fixed by #3483
Assignees
Labels
difficulty: easy A good issue for someone new. Can be done in a few hours hacktoberfest priority: low No existing plans to resolve

Comments

@Saransh-cpp
Copy link
Member

Saransh-cpp commented Oct 26, 2023

ruff can now lint jupyter notebooks!

Would mostly require changes in pyproject.toml and .pre-commit-config.yaml

@Saransh-cpp Saransh-cpp added difficulty: easy A good issue for someone new. Can be done in a few hours priority: low No existing plans to resolve hacktoberfest labels Oct 26, 2023
@Rjchauhan18
Copy link
Contributor

Rjchauhan18 commented Oct 27, 2023

Hello @Saransh-cpp
Can you please assign this issue to me if my solution is correct ?

According to this repo which is already use in pre-commit-config.yaml file. But then also we need add new repo in pre-commit-config.yaml file then it is able to do changes in jupyter notebook i have tryed it locally and we only need to remove repo which nbqa_ruff uses so that no conflict happen.

image

image

@Saransh-cpp
Copy link
Member Author

We don't need to add the formatter for this issue. We just have to extend the linter to jupyter notebooks. The link attached by you explains how to do that - types_or: [python, pyi, jupyter].

We can then check if it is raising any weird errors and ignore them.

@Rjchauhan18
Copy link
Contributor

Rjchauhan18 commented Oct 27, 2023

Hey , I have implemented this one types_or: [python, pyi, jupyter]. first then i tryed to solve another issue created by you which didn't work.

  • so when i implement types_or: [python, pyi, jupyter]. . It automatic solve and formate the jupyter notebook
  • It Just add changes to git status .
  • It did not push the changes directly to repositery.

@Saransh-cpp
Copy link
Member Author

Yes, it isn't supposed to push changes to the repository. The changes should be pushed to a new branch of your fork manually by you.

It would be better to keep both of these issues separate as this is more about lining and the other one is more about formatting.

I'll be able to help better once you open a PR for this issue!

@Rjchauhan18
Copy link
Contributor

I have stop E402 to change by itself but i am still not unable stop the ; to be removed.

@agriyakhetarpal
Copy link
Member

astral-sh/ruff#7300 and astral-sh/ruff#8254 should be related, we might want to hold off on this issue until some patches make it upstream

@Saransh-cpp
Copy link
Member Author

We can just make useless-semicolon (E703) unfixable like @Rjchauhan18 did for E402

@agriyakhetarpal
Copy link
Member

We can just make useless-semicolon (E703) unfixable like @Rjchauhan18 did for E402

Oh yes, that is much better.

@Rjchauhan18
Copy link
Contributor

Rjchauhan18 commented Oct 28, 2023

Hello @agriyakhetarpal and @Saransh-cpp
Thank you for helping me, I have done some changes according to your suggestion and run them locally which run fine 👍 .
Can you please review it?

@Rjchauhan18
Copy link
Contributor

If this #3478 is the case then we don't need ruff.toml so, better to wait and then change according to pyproject.toml

[tool.ruff]
extend-include = ["*.ipynb"]

[tool.ruff.lint.per-file-ignores]
"**.ipynb" = ["E402", "E703"]

@Saransh-cpp Saransh-cpp linked a pull request Oct 31, 2023 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: easy A good issue for someone new. Can be done in a few hours hacktoberfest priority: low No existing plans to resolve
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants