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

Implement configuration options runtime-evaluated-decorators and runtime-evaluated-baseclasses for flake8-type-checking #3292

Conversation

sasanjac
Copy link
Contributor

@sasanjac sasanjac commented Mar 1, 2023

see #2195

@sasanjac
Copy link
Contributor Author

sasanjac commented Mar 1, 2023

This is my first time developing in Rust, so I hope I did everything correctly and not implement stuff inefficiently 🙈

@sasanjac
Copy link
Contributor Author

sasanjac commented Mar 2, 2023

Maybe I need to understand the default behavior first:

import datetime

import pydantic

class Meta(pedantic.BaseModel):
    date: datetime.date

does not report any violations.

from __future__ import annotations

import datetime

import pydantic

class Meta(pedantic.BaseModel):
    date: datetime.date

reports TCH003. To my understanding, the annotations are already treated as runtime annotations when futures aren't enabled, so we only have to treat runtime evaluated annotations as runtime annotations when futures are enabled. Am I missing something here?

@charliermarsh
Copy link
Member

Your understanding is correct! And it mirrors Python's own behavior. Type annotations in class definitions are evaluated at runtime if you don't use __future__ annotations.

As an example, this code throws a runtime error (note that I've omitted the datetime.date import)

import pydantic

class Meta(pydantic.BaseModel):
    date: datetime.date

However, this code does not:

from __future__ import annotations

import pydantic

class Meta(pydantic.BaseModel):
    date: datetime.date

@sasanjac
Copy link
Contributor Author

sasanjac commented Mar 2, 2023

Ok great, thank you!

@sasanjac
Copy link
Contributor Author

sasanjac commented Mar 2, 2023

We might want to report this back to flake8-type-checking because I think it suggests moving type annotations in class definitions into a TYPE_CHECKING block even when __future__ annotations are not used.

@sasanjac sasanjac force-pushed the sasanjac/2195-Implement-configuration-options-from-`flake8-type-checking` branch from 78e842f to 13f6307 Compare March 3, 2023 08:08
@charliermarsh
Copy link
Member

charliermarsh commented Mar 5, 2023

For reasons I can't quite figure out, I'm unable to push to the branch 😬

ERROR: Permission to sasanjac-lab/ruff.git denied to charliermarsh.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

@charliermarsh
Copy link
Member

I pushed some changes to a branch here, any way you could pull them in?

@charliermarsh
Copy link
Member

The changes are: removing the pydantic.BaseModel default (I'd like to avoid library-specific defaults but curious to hear your reaction), changing the helpers to take Context instead of Checker (a new pattern to decouple some stuff internally), and tweaking the docs a bit. I think that's it.

As a nit: should it be runtime-evaluated-base-classes? Since it'd typically be stylized as "base classes"?

Separately: should the decorators apply to functions too? (flake8-type-checking seems to support FastAPI by omitting annotated functions, so wondering if we should support that too.)

And then as a higher-level question: how does this compare to the choices that flake8-type-checking made? We should probably document the differences in this PR -- the advantages and the disadvantages. Will this be useful in Pydantic contexts? Or too limited? Do we need to do something like flake8-type-checking's option to enforce for all classes?

@andersk
Copy link
Contributor

andersk commented Mar 5, 2023

(The author of a PR from a fork has an option to Allow edits from maintainers. @sasanjac must have unchecked it for this PR. Either @sasanjac you can turn that back on in the right sidebar, or @charliermarsh you could open a PR to the PR.)

@charliermarsh
Copy link
Member

That's what I thought, but I see this.

Screen Shot 2023-03-05 at 6 38 23 PM

I'll open a PR to the PR.

@andersk
Copy link
Contributor

andersk commented Mar 5, 2023

Maybe you didn’t sufficiently escape the ` characters in this unusual branch name for your shell?

@charliermarsh
Copy link
Member

Oh something like that is definitely possible. (I just use gh pr checkout 3292 then git push, but it is possible.)

…iguration-options-from-`flake8-type-checking`

Apply PR edits to 3292
@sasanjac
Copy link
Contributor Author

sasanjac commented Mar 6, 2023

For reasons I can't quite figure out, I'm unable to push to the branch 😬


ERROR: Permission to sasanjac-lab/ruff.git denied to charliermarsh.

fatal: Could not read from remote repository.



Please make sure you have the correct access rights

and the repository exists.

Strange, I didn't know you had to explicitly allow this.

@sasanjac
Copy link
Contributor Author

sasanjac commented Mar 6, 2023

The changes are: removing the pydantic.BaseModel default (I'd like to avoid library-specific defaults but curious to hear your reaction), changing the helpers to take Context instead of Checker (a new pattern to decouple some stuff internally), and tweaking the docs a bit. I think that's it.

Yeah, that sounds reasonable.

As a nit: should it be runtime-evaluated-base-classes? Since it'd typically be stylized as "base classes"?

True.

Separately: should the decorators apply to functions too? (flake8-type-checking seems to support FastAPI by omitting annotated functions, so wondering if we should support that too.)

Interesting, I haven't used FastAPI yet but this feature sounds very reasonable and I could look into that.

And then as a higher-level question: how does this compare to the choices that flake8-type-checking made? We should probably document the differences in this PR -- the advantages and the disadvantages. Will this be useful in Pydantic contexts? Or too limited? Do we need to do something like flake8-type-checking's option to enforce for all classes?

Yeah, maybe we should document it but I think the new approach is more precise than a blank ignore of imports when a class inherits from another. Also, @sondrelg is very active, even here and open to discussions. I thought we could maybe backport the same behavior to flake8-type-checking.

@sondrelg
Copy link

sondrelg commented Mar 6, 2023

The decisions made in flake8-type-checking were originally made because I was using FastAPI and pydantic myself at the time, and I wanted to use the plugin in those projects. I didn't know about any other prominent libraries that evaluated type hints at runtime at the time (but there are several, including attrs with cattrs). I wouldn't have added library specific options again I don't think.

In retrospect I also think supporting FastAPI is a little bit of a waste of time. This is a subjective evaluation of course, but the concept of dependencies makes it unreasonably hard to support properly. FastAPI can include arbitrary functions in a type signature like this (from the docs):

@app.get("/items/")
async def read_items(commons: dict = Depends(common_parameters)):
    return commons

And the type hints of the function common_parameters here are evaluated at runtime. That means you need to keep track of project-wide state and figure out how to follow nested imports in several files etc., as the dependency functions could live in a separate file, and may even be imported via another file, and so on. All type hints in FastAPI endpoints are also evaluated.

Basically I think if you're doing a FastAPI project, there are too many places where type hints are evaluated to consider a plugin like flake8-type-checking to be particularly useful. At least it would need to become a much larger, more complex project.

Is it really true that all class annotations are evaluated on Python 3.10+? I have several projects without __future__ imports where I've never run into issues with this - but I think those may all use pydantic 😅

@sasanjac
Copy link
Contributor Author

sasanjac commented Mar 6, 2023

@app.get("/items/")
async def read_items(commons: dict = Depends(common_parameters)):
    return commons

And the type hints of the function common_parameters here are evaluated at runtime. That means you need to keep track of project-wide state and figure out how to follow nested imports in several files etc., as the dependency functions could live in a separate file, and may even be imported via another file, and so on. All type hints in FastAPI endpoints are also evaluated.

I'm haven't really used FastAPI but couldn't you just specify app.get as a runtime-evaluated-decorator and be done?

@sasanjac
Copy link
Contributor Author

sasanjac commented Mar 6, 2023

The decisions made in flake8-type-checking were originally made because I was using FastAPI and pydantic myself at the time, and I wanted to use the plugin in those projects. I didn't know about any other prominent libraries that evaluated type hints at runtime at the time (but there are several, including attrs with cattrs). I wouldn't have added library specific options again I don't think.

Yeah, here it is up to you to decide if you want to deprecate config options, but I think the way of specifying base classes and decorators that lead to the corresponding type annotations not reported is a) a more generic way, no need to have library specific options and b) more precise because only the affected classes/functions are exempt from the rule. However, the user has to actively put the respective classes/decorators in the config.

@sondrelg
Copy link

sondrelg commented Mar 6, 2023

@app.get("/items/")
async def read_items(commons: dict = Depends(common_parameters)):
    return commons

And the type hints of the function common_parameters here are evaluated at runtime. That means you need to keep track of project-wide state and figure out how to follow nested imports in several files etc., as the dependency functions could live in a separate file, and may even be imported via another file, and so on. All type hints in FastAPI endpoints are also evaluated.

I'm haven't really used FastAPI but couldn't you just specify app.get as a runtime-evaluated-decorator and be done?

You could, if you were only using that decorator pattern. Unfortunately it's very common to use APIRouters to create aggregation of subpaths, like this:

# users.py

user_router = APIRouter(base='/users')

@user_router.get()
def list_users(): ...

@user_router.get('/{id}')
def retrieve_user(id: UUID): ...

# and so on

So one FastAPI project could have n decorator patterns in addition to m functions that act as "dependencies" where their types will be evaluated, but there is nothing that "marks" them as dependency in the file they are declared in.

@sondrelg
Copy link

sondrelg commented Mar 6, 2023

The decisions made in flake8-type-checking were originally made because I was using FastAPI and pydantic myself at the time, and I wanted to use the plugin in those projects. I didn't know about any other prominent libraries that evaluated type hints at runtime at the time (but there are several, including attrs with cattrs). I wouldn't have added library specific options again I don't think.

Yeah, here it is up to you to decide if you want to deprecate config options, but I think the way of specifying base classes and decorators that lead to the corresponding type annotations not reported is a) a more generic way, no need to have library specific options and b) more precise because only the affected classes/functions are exempt from the rule. However, the user has to actively put the respective classes/decorators in the config.

Decorators for classes might make it possible to whitelist attrs classes from type checking in a reliable way, but if the intention for this feature was to add FastAPI support by whitelisting functions decorated with certain patterns you should probably also have another feature for adding dependencies. I don't think this is a great idea though, because:

  • It's hard to do correctly
  • you end up checking very few elements, so the benefit of the plugin is low
  • the consequence of messing up is high (potentially runtime errors in prod, if your test coverage isn't good enough)

This is why I personally think you should focus on adding the features you need to support Pydantic usage for now, and think about remaining patterns later if it comes up 👍

@charliermarsh
Copy link
Member

Ok cool -- thank you for all the discussion here too, very clarifying for me! I'm happy with what's happening here, let's rock. Thanks for diving into Rust :)

@charliermarsh charliermarsh merged commit 4dead75 into astral-sh:main Mar 7, 2023
@charliermarsh charliermarsh added the configuration Related to settings and configuration label Mar 7, 2023
@sasanjac sasanjac deleted the sasanjac/2195-Implement-configuration-options-from-`flake8-type-checking` branch March 7, 2023 07:53
@Cielquan
Copy link

Does this implementation also work on subclasses?

E.g. I have an application with different configs and one base config

import pydantic
import utils

class BaseConfig(pydantic.BaseModel):
    debug = False
    database_url: str

class ProdConfig(BaseConfig):
    database_url ="production"
    prod_only: utils.Type

class DevConfig(BaseConfig):
    debug = True
    database_url = "dev"

@charliermarsh
Copy link
Member

No, it wouldn't work for subclasses in the same file like that. It could work if you exported BaseConfig from another file, then included my_file.BaseConfig in the list of runtime-evaluated base classes.

@Cielquan
Copy link

Thats a bummer but good to know. Thanks.

@charliermarsh
Copy link
Member

Yeah we can't do that level of type inference yet. We track imports, but we can't track arbitrary base class resolution yet.

renovate bot added a commit to ixm-one/pytest-cmake-presets that referenced this pull request Mar 14, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [ruff](https://togithub.com/charliermarsh/ruff) | `^0.0.254` ->
`^0.0.255` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.255/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.255/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.255/compatibility-slim/0.0.254)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.255/confidence-slim/0.0.254)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>charliermarsh/ruff</summary>

###
[`v0.0.255`](https://togithub.com/charliermarsh/ruff/releases/tag/v0.0.255)

[Compare
Source](https://togithub.com/charliermarsh/ruff/compare/v0.0.254...v0.0.255)

<!-- Release notes generated using configuration in .github/release.yml
at main -->

#### What's Changed

##### Rules

- \[`flake8-pie`] Fix PIE802 broken auto-fix with trailing comma by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[astral-sh/ruff#3402
- \[`flake8-pie`] Implement autofix for PIE810 by
[@&#8203;kyoto7250](https://togithub.com/kyoto7250) in
[astral-sh/ruff#3411
- \[`flake8-bugbear`] Add `flake8-bugbear`'s B030 rule by
[@&#8203;aacunningham](https://togithub.com/aacunningham) in
[astral-sh/ruff#3400
- \[`pycodestyle`] Add E231 by
[@&#8203;carlosmiei](https://togithub.com/carlosmiei) in
[astral-sh/ruff#3344
- \[`pyupgrade`] Flag deprecated (but renamed) imports in UP035 by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3448
- \[`pyupgrade`] Remap ChainMap, Counter, and OrderedDict imports to
collections by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3392
- \[`pylint`] C1901: compare-to-empty-string by
[@&#8203;AreamanM](https://togithub.com/AreamanM) in
[astral-sh/ruff#3405
- \[`pylint`] Implement W1508 invalid-envvar-default by
[@&#8203;latonis](https://togithub.com/latonis) in
[astral-sh/ruff#3449
- \[`pylint`] Implement E1507 invalid-envvar-value by
[@&#8203;latonis](https://togithub.com/latonis) in
[astral-sh/ruff#3467

##### Settings

- Infer `target-version` from project metadata by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[astral-sh/ruff#3470
- Implement configuration options `runtime-evaluated-decorators` and
`runtime-evaluated-base-classes` for `flake8-type-checking` by
[@&#8203;sasanjac](https://togithub.com/sasanjac) in
[astral-sh/ruff#3292
- Add Azure DevOps as a `--format` option. by
[@&#8203;StefanBRas](https://togithub.com/StefanBRas) in
[astral-sh/ruff#3335

##### Bug Fixes

- Re-enable the T and C linter prefix selectors by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3452
- Treat unary operations on constants as constant-like by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3348
- Skip byte-order-mark at start of file by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3343
- Don't enforce typing-import rules in .pyi files by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3362
- Include entire prefix when reporting rule selector errors by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3375
- Handle multi-line fixes for byte-string prefixing by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3391
- Catch RET504 usages via decorators by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3395
- Ignore multiply-assigned variables in RET504 by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3393
- \[FIX] PYI011: recognize `Bool` / `Float` / `Complex` numbers as
simple defaults by [@&#8203;XuehaiPan](https://togithub.com/XuehaiPan)
in
[astral-sh/ruff#3459
- Respect ignores for runtime-import-in-type-checking-block (TCH004) by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3474
- Avoid panicking in invalid_escape_sequence by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3338
- fix: Emit a more useful error if an `extend` points at a non-existent
ruff.toml file. by [@&#8203;DanCardin](https://togithub.com/DanCardin)
in
[astral-sh/ruff#3417
- Respect `--show-fixes` with `--fix-only` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3426
- When "Args" and "Parameters" are present, prefer NumPy style by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3430
- Remove empty line after RUF100 auto-fix by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[astral-sh/ruff#3414
- Avoid removing un-aliased exceptions in `OSError`-aliased handlers by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3451
- Use a hash to fingerprint GitLab CI output by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3456
- Avoid respecting noqa directives when RUF100 is enabled by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3469
- Output GitLab paths relative to `CI_PROJECT_DIR` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3475
- Implement an iterator for universal newlines by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3454

#### New Contributors

- [@&#8203;sasanjac](https://togithub.com/sasanjac) made their first
contribution in
[astral-sh/ruff#3292
- [@&#8203;aacunningham](https://togithub.com/aacunningham) made their
first contribution in
[astral-sh/ruff#3380
- [@&#8203;orf](https://togithub.com/orf) made their first contribution
in
[astral-sh/ruff#3389
- [@&#8203;DanCardin](https://togithub.com/DanCardin) made their first
contribution in
[astral-sh/ruff#3417
- [@&#8203;AreamanM](https://togithub.com/AreamanM) made their first
contribution in
[astral-sh/ruff#3405
- [@&#8203;kyoto7250](https://togithub.com/kyoto7250) made their first
contribution in
[astral-sh/ruff#3411
- [@&#8203;latonis](https://togithub.com/latonis) made their first
contribution in
[astral-sh/ruff#3449
- [@&#8203;XuehaiPan](https://togithub.com/XuehaiPan) made their first
contribution in
[astral-sh/ruff#3459
- [@&#8203;CalumY](https://togithub.com/CalumY) made their first
contribution in
[astral-sh/ruff#3461
- [@&#8203;YDX-2147483647](https://togithub.com/YDX-2147483647) made
their first contribution in
[astral-sh/ruff#3473

**Full Changelog**:
astral-sh/ruff@v0.0.254...v0.0.255

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/ixm-one/pytest-cmake-presets).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xNjAuMCIsInVwZGF0ZWRJblZlciI6IjM0LjE2MC4wIn0=-->

Signed-off-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate bot added a commit to allenporter/flux-local that referenced this pull request Mar 15, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [ruff](https://togithub.com/charliermarsh/ruff) | `==0.0.254` ->
`==0.0.256` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.256/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.256/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.256/compatibility-slim/0.0.254)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.256/confidence-slim/0.0.254)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>charliermarsh/ruff</summary>

###
[`v0.0.256`](https://togithub.com/charliermarsh/ruff/releases/tag/v0.0.256)

[Compare
Source](https://togithub.com/charliermarsh/ruff/compare/v0.0.255...v0.0.256)

<!-- Release notes generated using configuration in .github/release.yml
at main -->

#### What's Changed

##### Bug Fixes

- PYI011: allow `math` constants in defaults by
[@&#8203;XuehaiPan](https://togithub.com/XuehaiPan) in
[astral-sh/ruff#3484
- Remove erroneous C4-to-C40 redirect by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3488
- fix lack of `not` in error message by
[@&#8203;Czaki](https://togithub.com/Czaki) in
[astral-sh/ruff#3497
- Ensure that redirect warnings appear exactly once per code by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3500
- Allow f-strings and concatenations in os.getenv by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3516
- Allow string percent formatting in os.getenv by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3518
- Refine complexity rules for try-except-else-finally by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3519
- Replicate inline comments when splitting single-line imports by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3521
- Avoid PEP 604 isinstance errors for starred tuples by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3527
- Avoid tracking as-imports separately with force-single-line by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3530
- Fix PYI011 and add auto-fix by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[astral-sh/ruff#3492
- Avoid PEP 604 panic with empty tuple by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3526
- Add last remaining deprecated typing imports by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3529
- Avoid unused argument violations in .pyi files by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3533

##### Other Changes

- Include individual path checks in --verbose logging by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3489
- Allow `# ruff:` prefix for isort action comments by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3493

**Full Changelog**:
astral-sh/ruff@v0.0.255...v0.0.256

###
[`v0.0.255`](https://togithub.com/charliermarsh/ruff/releases/tag/v0.0.255)

[Compare
Source](https://togithub.com/charliermarsh/ruff/compare/v0.0.254...v0.0.255)

<!-- Release notes generated using configuration in .github/release.yml
at main -->

#### What's Changed

##### Rules

- \[`flake8-pie`] Fix PIE802 broken auto-fix with trailing comma by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[astral-sh/ruff#3402
- \[`flake8-pie`] Implement autofix for PIE810 by
[@&#8203;kyoto7250](https://togithub.com/kyoto7250) in
[astral-sh/ruff#3411
- \[`flake8-bugbear`] Add `flake8-bugbear`'s B030 rule by
[@&#8203;aacunningham](https://togithub.com/aacunningham) in
[astral-sh/ruff#3400
- \[`pycodestyle`] Add E231 by
[@&#8203;carlosmiei](https://togithub.com/carlosmiei) in
[astral-sh/ruff#3344
- \[`pyupgrade`] Flag deprecated (but renamed) imports in UP035 by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3448
- \[`pyupgrade`] Remap ChainMap, Counter, and OrderedDict imports to
collections by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3392
- \[`pylint`] C1901: compare-to-empty-string by
[@&#8203;AreamanM](https://togithub.com/AreamanM) in
[astral-sh/ruff#3405
- \[`pylint`] Implement W1508 invalid-envvar-default by
[@&#8203;latonis](https://togithub.com/latonis) in
[astral-sh/ruff#3449
- \[`pylint`] Implement E1507 invalid-envvar-value by
[@&#8203;latonis](https://togithub.com/latonis) in
[astral-sh/ruff#3467

##### Settings

- Infer `target-version` from project metadata by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[astral-sh/ruff#3470
- Implement configuration options `runtime-evaluated-decorators` and
`runtime-evaluated-base-classes` for `flake8-type-checking` by
[@&#8203;sasanjac](https://togithub.com/sasanjac) in
[astral-sh/ruff#3292
- Add Azure DevOps as a `--format` option. by
[@&#8203;StefanBRas](https://togithub.com/StefanBRas) in
[astral-sh/ruff#3335

##### Bug Fixes

- Re-enable the T and C linter prefix selectors by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3452
- Treat unary operations on constants as constant-like by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3348
- Skip byte-order-mark at start of file by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3343
- Don't enforce typing-import rules in .pyi files by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3362
- Include entire prefix when reporting rule selector errors by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3375
- Handle multi-line fixes for byte-string prefixing by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3391
- Catch RET504 usages via decorators by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3395
- Ignore multiply-assigned variables in RET504 by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3393
- \[FIX] PYI011: recognize `Bool` / `Float` / `Complex` numbers as
simple defaults by [@&#8203;XuehaiPan](https://togithub.com/XuehaiPan)
in
[astral-sh/ruff#3459
- Respect ignores for runtime-import-in-type-checking-block (TCH004) by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3474
- Avoid panicking in invalid_escape_sequence by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3338
- fix: Emit a more useful error if an `extend` points at a non-existent
ruff.toml file. by [@&#8203;DanCardin](https://togithub.com/DanCardin)
in
[astral-sh/ruff#3417
- Respect `--show-fixes` with `--fix-only` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3426
- When "Args" and "Parameters" are present, prefer NumPy style by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3430
- Remove empty line after RUF100 auto-fix by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[astral-sh/ruff#3414
- Avoid removing un-aliased exceptions in `OSError`-aliased handlers by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3451
- Use a hash to fingerprint GitLab CI output by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3456
- Avoid respecting noqa directives when RUF100 is enabled by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3469
- Output GitLab paths relative to `CI_PROJECT_DIR` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3475
- Implement an iterator for universal newlines by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#3454

#### New Contributors

- [@&#8203;sasanjac](https://togithub.com/sasanjac) made their first
contribution in
[astral-sh/ruff#3292
- [@&#8203;aacunningham](https://togithub.com/aacunningham) made their
first contribution in
[astral-sh/ruff#3380
- [@&#8203;orf](https://togithub.com/orf) made their first contribution
in
[astral-sh/ruff#3389
- [@&#8203;DanCardin](https://togithub.com/DanCardin) made their first
contribution in
[astral-sh/ruff#3417
- [@&#8203;AreamanM](https://togithub.com/AreamanM) made their first
contribution in
[astral-sh/ruff#3405
- [@&#8203;kyoto7250](https://togithub.com/kyoto7250) made their first
contribution in
[astral-sh/ruff#3411
- [@&#8203;latonis](https://togithub.com/latonis) made their first
contribution in
[astral-sh/ruff#3449
- [@&#8203;XuehaiPan](https://togithub.com/XuehaiPan) made their first
contribution in
[astral-sh/ruff#3459
- [@&#8203;CalumY](https://togithub.com/CalumY) made their first
contribution in
[astral-sh/ruff#3461
- [@&#8203;YDX-2147483647](https://togithub.com/YDX-2147483647) made
their first contribution in
[astral-sh/ruff#3473

**Full Changelog**:
astral-sh/ruff@v0.0.254...v0.0.255

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/allenporter/flux-local).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xNjAuMCIsInVwZGF0ZWRJblZlciI6IjM0LjE2MC4wIn0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Related to settings and configuration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants