-
Notifications
You must be signed in to change notification settings - Fork 30
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
Apply different typing rules to particular (external) packages #701
Comments
execution environments allow you to use different diagnostic settings on different parts of your project. however i'm not quite sure what you mean by applying different rules to third party packages. are you type checking 3rd party code or your own stubs for third party code? or are you saying that you want for example the or is the problem just that you want the strict type checking but don't want to have to fix thousands of errors in old code? if so, you may be interested in the baseline feature that i just released |
Sorry for not being clear in the original post.
Execution environments are a great feature that we'll definitely make use of (for example, to relax typing on our test code where I've seen, for example, some aspects of
Yeah, that's kind of what I'm getting at. I'd like to be able to apply strict rules to my own code (and compatible 3rd party libraries), but apply a different set of rules to In most cases, this isn't necessary as if the inline typing or stubs for a 3rd party package are insufficient, we can make our own. However, |
interesting idea. i'm not famiar with pandas though so i'm curious to see some examples of why it can't be fully typed |
i've seen similar scenarios, some things are the ability to ignore certain |
i guess |
I don't completely understand the ins and outs of it but I think it's just that the way data types can be changed/defined in series/dataframes would be difficult to type out explicitly. For example, if I have a dataframe with a
Now imagine you have multiple projects with their own subset of strict compliance - you're currently effectively bound to either an intersection of their compliance, or to use a lot of |
Just my couple thoughts here: It is, unfortunately, somewhat common that many libraries don't satisfy not just basedpyright's strict mode, but actually don't satisfy any mode that you can reasonably run with. I've run into multiple examples recently after adopting basedpyright. Some examples:
These libraries are pretty strongly typed by the way (especially Beanie since it relies on pydantic and stuff) The issue is that these "problems" usually don't even mean anything, you often have to suppress them, and then suppress real problems with your code etc. TL;DR I would really want to see an option to disable the upstream problems 😊 |
here are some things you can try that may help depending on your use case:
|
First, thanks for the work on
basedpyright
. We are adopting it in our organization.This is more of a question than a request - is it going to be possible to allow
basedpyright
to apply a different ruleset to particular 3rd party packages?We would like to lock down to very strict typing, but we also use a lot of, for example,
pandas
. So this creates a conflict the sectionpandas
enters the picture. Right now we are going to attempt to just applypandas
rulesets but I'm sure we'll hit some edge cases in other 3rd party packages where we won't be able to make it work - and if usage of that package is extensive, we'd like to not litter our code with too many# pyright: ignore[***]
directives.My guess is that this is something specific to the way
pyright
parses the types and so this may be out of scope of this project, but I wanted to check, and I didn't see any related issues in my search.The text was updated successfully, but these errors were encountered: