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 ruff support #1700

Merged
merged 4 commits into from
Dec 22, 2023
Merged

Add ruff support #1700

merged 4 commits into from
Dec 22, 2023

Conversation

juanitorduz
Copy link
Contributor

@juanitorduz juanitorduz commented Dec 19, 2023

This PR proposes adding ruff as a linter and formater. See pyro-ppl/pyro#3231

pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated
indent-width = 4

# Assume Python 3.8
target-version = "py38"
Copy link
Member

Choose a reason for hiding this comment

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

Would this cause any trouble? I think the version depends on user's system.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to astral-sh/ruff#2519 (comment), is ok to indicate the minimum version, which according to setup.py is 3.9, so I added it in b2292ee

Copy link
Member

@fehiepsi fehiepsi Dec 20, 2023

Choose a reason for hiding this comment

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

In https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md#015 it's recommended to use project.requires-python. It's used in ruff here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed in 442353e

combine_as_imports = true
multi_line_output = 3
skip=docs

[tool:pytest]
Copy link
Member

Choose a reason for hiding this comment

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

Do you think that we can also move pytest config to the pyproject file. I saw it is supported here. (not necessary in this PR though)

Copy link
Contributor Author

@juanitorduz juanitorduz Dec 20, 2023

Choose a reason for hiding this comment

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

Indeed! I want to do this in another PR. In addition, I wanna add pre-commit hooks :) (also in a different PR). I want to work on batches of small changes.

Copy link
Member

@fehiepsi fehiepsi left a comment

Choose a reason for hiding this comment

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

This is super helpful! Thanks @juanitorduz!

@fehiepsi fehiepsi merged commit 03030c2 into pyro-ppl:master Dec 22, 2023
1 check failed
@juanitorduz juanitorduz deleted the add_ruff branch December 22, 2023 12:06
@juanitorduz
Copy link
Contributor Author

I will continue with other PRs to remove setup.cfg and add pre-commit hooks :)

@fehiepsi
Copy link
Member

The change seems to cause the master branch to fail. Could you take a look?

@juanitorduz
Copy link
Contributor Author

juanitorduz commented Dec 22, 2023

@fehiepsi This should fix it #1703 . Sorry for that 🙈 !

@juanitorduz juanitorduz mentioned this pull request Dec 22, 2023
charliermarsh pushed a commit to astral-sh/ruff that referenced this pull request Jan 11, 2024
OlaRonning pushed a commit to aleatory-science/numpyro that referenced this pull request May 6, 2024
* add ruff

* fix line-length

* min python version

* add requires-python section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants