-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
FA102 errors eventhough requires-python in pyproject.toml is ">=3.12" #10299
Comments
I think it's possible that if we find a [project]
name = "packagename"
requires-python = ">=3.12"
[tool.ruff]
src = ["src"]
[tool.ruff.format]
skip-magic-trailing-comma = true
line-ending = "lf"
[tool.ruff.lint]
select = ["ALL"]
ignore = ["ANN101", "D203", "D213", "S320"] But, we should probably also be respecting the |
(If possible, can you give that a try to confirm my suspicion?) |
That does indeed work, but I would prefer to have a separate |
@charliermarsh considering that you marked this as a bug. What would the desired resolution order be? The documentation mentions
which seems like Or is the fix that we should disregard any |
We already do this IIRC. |
Yeah fixing this requires that we merge configuration in some way, because the user is inherently asking for information to come from two different files. So we either do something like "when we see a |
If I may add my 2 cents: if the precedence is |
Reproduced in sphinx-doc/sphinx#12250. Removing I think ruff should take into account ruff/crates/ruff_workspace/src/options.rs Lines 314 to 317 in 42d52eb
|
Same issue in jaraco/skeleton#119. The situation is even worse here, as The rationale for a |
In the documentation, Config file discovery reads:
I was thinking about adding |
My suggestion would be to:
|
If `ruff.toml` exists, the `requires-python` key is currently not taken into account - not in `pyproject.toml` and even less in `setup.cfg`. See: astral-sh/ruff#10299
If `ruff.toml` exists, the `requires-python` key is currently not taken into account - not in `pyproject.toml` and even less in `setup.cfg`. See: astral-sh/ruff#10299
Hi, I encountered the same issue and I found this solution.
However, I tried writing |
I'd like to make the case that ruff should not be relying on declared configuration and should instead rely on the core metadata for the package. Although For this reason, the supported/required Python versions for a Coherent project or any other build system that dynamically or programmatically generates that metadata field won't have a declaration in the There are other build backends that produce "dynamic" values for various metadata fields, so addressing just the Requires-Python field will leave those fields unaddressed. There's clear value for projects in not having to statically manifest all of their metadata in source code (and maintain that state, possibly shared across or even diverging within many projects). My recommendation would be for Ruff to generate the package metadata through the PEP 517 I know this approach can be potentially expensive (and for Coherent projects is currently very expensive, but that's largely the backend's problem), so it may be necessary to cache the value (or the metadata) for extended periods. This approach would have added benefits that other core metadata can be resolved by ruff, even when it's dynamic. Such an approach would sidestep workarounds like |
Closes #119. Workaround for astral-sh/ruff#10299.
Edit: because it should be |
Closes #152 Workaround for astral-sh/ruff#10299
Closes #152 Workaround for astral-sh/ruff#10299
I have the following (standard) directory layout:
Part from my
pyproject.toml
:My complete
ruff.toml
:Ruff version: 0.3.0, run with the command
ruff check
in the directory ofpyproject.toml
.In the rule FA102, it is mentioned:
In the documentation of
target-version
it is mentioned thatrequires-python
inpyproject.toml
is preferred over thetarget-version
option inruff.toml
.If I add
target-version = "py312"
to myruff.toml
, then there are no FA102 errors.The text was updated successfully, but these errors were encountered: