You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to disable a specific rule for a specific subfolder/package/module? I tried to look at the configuration options for pyright itself and I couldn't see it.
For my current project, I am using Typer/Click to make it easier to have explicit entrypoints. For one of the function args, I have annotated it to be int | None and defaulting to None. Here's an example:
Currently, basedpyright flags this as reportDeprecated, which is definitely true. But to do what I need, I don't have a choice.
I don't mind throwing a # noqa at it, but I have a bunch of entrypoint functions where this occurs and adding the ignore every single time is quite cumbersome. I know it's technically wrong, but as it's localised to this very specific situation/aspect of my codebase, I just let it be and got on with it.
I don't want to disable the rule project-wide (I like strict), but that's what I've needed to do. Do you have any thoughts on how I could handle this?
<3 this project.
The text was updated successfully, but these errors were encountered:
Ah right! I thought that was only for literal environments like Linux vs Mac etc! I didn't realise it did this too!!! I just tried it and it doesn't seem to work? I added the following to my TOML. (Sorry I misread!)
This is totally top of my "basedmpy features" list!
in the mean time a workaround that should work in your case is using ruff to report deprecated type annotations instead using the pyupgrade rules, since ruff supports per-file ignores
Is it possible to disable a specific rule for a specific subfolder/package/module? I tried to look at the configuration options for pyright itself and I couldn't see it.
For my current project, I am using Typer/Click to make it easier to have explicit entrypoints. For one of the function args, I have annotated it to be
int | None
and defaulting to None. Here's an example:Notably, I used
Optional[int]
instead ofint | None
because Typer/Click don't support union types and I'm guessing it's not a priority to support.Currently, basedpyright flags this as
reportDeprecated
, which is definitely true. But to do what I need, I don't have a choice.I don't mind throwing a
# noqa
at it, but I have a bunch of entrypoint functions where this occurs and adding the ignore every single time is quite cumbersome. I know it's technically wrong, but as it's localised to this very specific situation/aspect of my codebase, I just let it be and got on with it.I don't want to disable the rule project-wide (I like strict), but that's what I've needed to do. Do you have any thoughts on how I could handle this?
<3 this project.
The text was updated successfully, but these errors were encountered: