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

Standalone ruff checks + Automatically detect requires-python #168

Closed
wants to merge 1 commit into from

Conversation

Avasam
Copy link
Contributor

@Avasam Avasam commented Mar 18, 2025

It recently crossed my mind that you don't need to run Ruff on every os and Python version. In fact, you don't even need to have Python installed to run Ruff !

Running it through pytest everytime seems not only wasteful, but has caused issues (between version desync, huge logs spam, and not as clear errors)

astral-sh/ruff-action@v3 automatically finds the version of Ruff to install and run from looking at a pyproject.toml's project.optional-dependencies and dependency-groups.

Since no other test uses Ruff, no need to install it, so I split it into its own extra.

This PR also bumps Ruff's lower bound to 0.11, where the detection of requires-python is automated.

@Avasam Avasam force-pushed the standalone-ruff-test branch 2 times, most recently from 5819122 to 24aa884 Compare March 18, 2025 21:53
@Avasam Avasam force-pushed the standalone-ruff-test branch from 24aa884 to 0a36142 Compare March 18, 2025 21:54
Comment on lines +46 to -48
ruff = [
# Get requires-python from pyproject.toml automatically astral-sh/ruff#16319
"ruff >= 0.11.0",
]

check = [
"pytest-checkdocs >= 2.4",
"pytest-ruff >= 0.2.1; sys_platform != 'cygwin'",
Copy link
Owner

Choose a reason for hiding this comment

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

Probably we want to revert the changes in this file. Ruff won't run on cygwin, and we definitely want pytest-ruff so that ruff runs under pytest. If ruff >= 0.11 is needed, we can just wait for that to become a de facto minimum.

Copy link
Contributor Author

@Avasam Avasam Mar 21, 2025

Choose a reason for hiding this comment

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

Part of the proposition here is to not run under pytest, nor use pytest-ruff.
And no cygwin should install this extra.

The version bump is to remove the explicit pyproject.toml reference in ruff.toml. That could be split off.

@jaraco
Copy link
Owner

jaraco commented Mar 21, 2025

Running it through pytest everytime seems not only wasteful, but has caused issues (between version desync, huge logs spam, and not as clear errors)

I don't want to run ruff separately. I really like being able to just run tox to validate that the code meets spec (including ruff). It's easy enough to avoid running it (tox -- -p no:ruff). But it's so fast, it's really fine to have it integrated.

The current design has the pytest plugins (coverage, mypy, ruff) all integrated and using a consistent interface. See #48 for more details.

@jaraco jaraco closed this Mar 21, 2025
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