-
Notifications
You must be signed in to change notification settings - Fork 1
Add pyrefly type checker & lsp support (and fix defects) #23
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
989ecf5
Add pyrefly type checker & lsp support (and fix defects)
posborne 8502f7a
Model stubs generation in Makefile
posborne 929f1bc
Fix type checking in bottle example
posborne e0938c2
Remove extraneous list() call on list type
posborne 79eda45
Model stubs directory as order-only
posborne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -152,7 +152,7 @@ def start_response( | |
| error_response.set_status(500) | ||
| error_response.append_header("content-type", b"text/plain") | ||
| error_message = f"Internal Server Error: {e}" | ||
| http_body.write(error_body, error_message.encode(), http_body.WriteEnd.BACK) | ||
| http_body.write(error_body, error_message.encode()) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a pretty good example of an error caught by the type checker. |
||
| send_downstream(error_response, error_body) | ||
|
|
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might I venture to suggest we instead use
stubs/wit_world/__init__.pyas the target? Using a dir as a target tends toward fragility, as adding or removing anything from the dir updates its modification date. That includes OS detritus like.DS_Storeand things I lack the foresight to enumerate.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, I'll do that in some way. I recall similar problems now that you mention it (and never really having a solution I'm entirely happy with).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used to use Make targets to create virtualenvs. One strategy I'd use is to make the venv, then immediately
touchsome pointless little file inside it as a sentinel. The target would then be that sentinel. Avoids the dir modtime problem and doesn't assume anything about the eventual population of the folder.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like another option, which we employ for BUILD_DIR is a https://www.gnu.org/software/make/manual/make.html#Prerequisite-Types
I will go ahead and use that as it seems to be designed and documented for this sort of case specifically.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though BUILD_DIR's only care is to create an empty dir. Stubs, OTOH, can go out of date, and we want them rebuilt if compute.wit changes. (I guess what I'm saying is that I wonder if
|is transitive.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a change using
|now, though I just saw the updates here concurrently.Doing a test, I think the behavior is what we want:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to merge; if we see cases where it isn't working as we want, we can revisit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet! Looks great!