-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Pyright Configuration for CI Pipeline #2267
base: main
Are you sure you want to change the base?
Conversation
Feel free to comment on the Pyright issue if you feel I misrepresented anything. I will add a CI test if you think it is worthwhile, but wasn't sure if we can even run that in the branch before it is merged in a PR |
@pokey do you have opinions on this? microsoft/pyright#7513 (comment) I am frankly not sure. Adding |
huh not sure why that never occurred to me; I've forwarded the question to Slack |
I think this PR is missing the github action; can you not just copy the one from ai-tools verbatim? |
Added, not sure exactly where we want it in the Pipeline, but I put it at the end after the other tests. I don't have as sophisticated a pipeline of course so I had it as its own workflow but probably doesn't make sense here |
Seems like the general type feedback is going to be out of scope for pyright support. Mypy is an option that may support ignoring the first argument and not treating it as self, but I believe that requires converting the python folders into modules with |
Ok so adding a new feature to Pyright to support this is out of scope. However, microsoft/pyright#7513 (comment) made a good comment, namely that you can inherit from I feel like this is a bit of a hack and perhaps not worth it, but it is an option # pyright: reportSelfClsParameterName=false
from typing import Any, TYPE_CHECKING
if TYPE_CHECKING:
Base = Any
else:
Base = object
class Actions(Base):
def vscode_get_setting(key: str, default_value: Any = None):
|
If mypy handles action classes the way we want, shouldn't we try running mypy in CI instead? |
I might be missing something but I am not finding it handles the action classes either. I think the best way is just adding mypy output
|
Dropping this here to include reasons for picking one over the other: https://microsoft.github.io/pyright/#/mypy-comparison |
Hmm it does seem like there would be a lot of compromises to get this one to work. Tbh one of the biggest issues from my perspective is the lack of Talon type stubs in CI. If I'm understanding correctly, we'd need to add flags to our pyright config to make CI happy without these stubs, but that would in effect weaken our type checking locally, where we do have the stubs. If that's the case, I'd be inclined to just close for now and revisit if the typing story in Talon changes in the future. @lunixbochs: long shot, but I'm assuming there's no chance of getting Talon stubs published as a pip package for use in CI? I'm guessing it would be too much overhead for you, but figured I'd check. Even if we got those, tho, we'd still have microsoft/pyright#7513, so I'm not sure we'd be comfortable switching on these CI checks anyway |
I’m inclined to agree. If we can’t do anything with Talon in CI and we just
have to ignore it, the only benefit here would be that it adds some
baseline sanity checks to make sure nothing is egregiously wrong when
committed.
…On Mon, Apr 15, 2024 at 11:15 AM Pokey Rule ***@***.***> wrote:
Hmm it does seem like there would be a lot of compromises to get this one
to work. Tbh one of the biggest issues from my perspective is the lack of
Talon type stubs in CI. If I'm understanding correctly, we'd need to add
flags to our pyright config to make CI happy without these stubs, but that
would in effect weaken our type checking locally, where we do have the
stubs. If that's the case, I'd be inclined to just close for now and
revisit if the typing story in Talon changes in the future. @lunixbochs
<https://github.com/lunixbochs>: long shot, but I'm assuming there's no
chance of getting Talon stubs published as a pip package for use in CI? I'm
guessing it would be too much overhead for you, but figured I'd check. Even
if we got those, tho, we'd still have microsoft/pyright#7513
<microsoft/pyright#7513>, so I'm not sure we'd
be comfortable switching on these CI checks anyway
—
Reply to this email directly, view it on GitHub
<#2267 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQ2T6Z4LOD7GWJ4LAMFBQ4DY5PVGJAVCNFSM6AAAAABE4BEMTCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJXGEYDKMZRGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Yes but I think it actually has downsides, because we'd have to add extra ignore flags to our pyright config that would weaken type-checking locally, where we do have the stubs. If it were just weakly useful in CI and neutral locally, I might go for it, but it seems like it's weakly useful in CI and detrimental locally, so I think that tips the balance in favour of closing |
- Depends on #2306 - Supercedes #2267 This does add a lot of noise, and it can't be enforced in CI because Talon doesn't publish type stubs (that I know of), so I wonder whether it's worth it 🤔 ## Checklist - [x] I have run Talon spoken form tests - [-] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [-] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [x] I have not broken the cheatsheet
- Depends on cursorless-dev/cursorless#2306 - Supercedes cursorless-dev/cursorless#2267 This does add a lot of noise, and it can't be enforced in CI because Talon doesn't publish type stubs (that I know of), so I wonder whether it's worth it 🤔 ## Checklist - [x] I have run Talon spoken form tests - [-] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [-] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [x] I have not broken the cheatsheet
- Depends on #2306 - Supercedes #2267 This does add a lot of noise, and it can't be enforced in CI because Talon doesn't publish type stubs (that I know of), so I wonder whether it's worth it 🤔 ## Checklist - [x] I have run Talon spoken form tests - [-] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [-] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [x] I have not broken the cheatsheet
Maybe I'm missing something, but why not just install talon in CI? You could should be able to install it with nix package manager. |
Talon's license doesn't allow us to install it in CI |
Discussed with Pokey at Cursorless meetup last weekend about Pyright CI. Posting this here as a discussion to evaluate if Pyright is useful for Cursorless in its CI pipeline.
Downside for Pyright integration
reportGeneralTypeIssues
to get rid of it.Current Config
May or may not want the following