-
Notifications
You must be signed in to change notification settings - Fork 1
feat: return runtime versions used by the application with a doctor hook #35
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
6 commits
Select commit
Hold shift + click to select a range
6690c82
feat: return runtime versions used by the application with a doctor hook
zimeg ebd088d
feat: include the doctor hook in the initial get-hooks response
zimeg 4adb832
docs: document the doctor hook as a supported hook
zimeg 2a87bd3
test(style): compare strings using string comparison operators
zimeg 2c666ad
feat: prefer the numeric python version in the doctor outputs
zimeg a554b1b
test: update the python version check to check the python version
zimeg 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #!/usr/bin/env python | ||
| import json | ||
| import platform | ||
|
|
||
| from slack_cli_hooks.protocol import ( | ||
| Protocol, | ||
| build_protocol, | ||
| ) | ||
|
|
||
| PROTOCOL: Protocol | ||
|
|
||
|
|
||
| doctor_payload = { | ||
| "versions": [ | ||
| { | ||
| "name": "python", | ||
| "current": platform.python_version(), | ||
| }, | ||
| { | ||
| "name": "implementation", | ||
| "current": platform.python_implementation(), | ||
| }, | ||
| { | ||
| "name": "compiler", | ||
| "current": platform.python_compiler(), | ||
| }, | ||
| ], | ||
| } | ||
|
|
||
| if __name__ == "__main__": | ||
| PROTOCOL = build_protocol() | ||
| PROTOCOL.respond(json.dumps(doctor_payload)) | ||
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 |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import platform | ||
|
|
||
| from slack_cli_hooks.hooks.doctor import doctor_payload | ||
|
|
||
|
|
||
| class TestDoctor: | ||
| def test_versions(self): | ||
| versions = doctor_payload.get("versions") | ||
| assert versions is not None | ||
|
|
||
| assert versions[0].get("name") == "python" | ||
| assert versions[0].get("current") == platform.python_version() | ||
| assert versions[1].get("name") == "implementation" | ||
| assert versions[1].get("current") == platform.python_implementation() | ||
| assert versions[2].get("name") == "compiler" | ||
| assert versions[2].get("current") == platform.python_compiler() |
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
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.
The python_compiler() is said to identify the compiler used for compiling Python. I don't think this will be very informative, unless a developer is compiling their own version of python (if they are, not sure how we could help them)
Providing the system information with platform.system() may be more informative for maintainers try to and help a developer, let me know what you think
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.
Open to removing this if you don't think it'd be useful. I was honestly looking to make a group of three and the compiler seemed interesting 👀
The system OS and architecture is also included a bit early in the
doctoroutput and I think would be the same for theplatform.system()? I really hope at least 😳 So this base might be covered already 🙌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.
Just saw it now 👍 alternatively
platform.platform()yields a string similar to this on my machinemacOS-14.4-arm64-arm-64bitif this information if not outputted by the CLI already I think it would be more useful then python_compiler()But if it is python_compiler() can fill the 3rd item
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 think the GOOS / GOARCH covers the platform well enough for debugging purposes! Going to keep the compiler here for the time being