Conversation
99ed77e to
b79d0ad
Compare
pda
reviewed
Jul 21, 2025
| "collector": f"python-{COLLECTOR_NAME}", | ||
| "version": VERSION | ||
| "version": VERSION, | ||
| "language_version": ( |
Member
There was a problem hiding this comment.
ChatGPT suggests this…
>>> import platform
>>> platform.python_version()
'3.13.2'
Contributor
Author
There was a problem hiding this comment.
Claude is saying the current implementation is better?
Both sys.version_info and platform.python_version() are compatible with Python 3.9 and newer (and
much older versions too). Here's the comparison:
sys.version_info:
- Returns a sys.version_info named tuple with attributes: major, minor, micro, releaselevel, serial
- Direct access to version components
- More efficient (no function call overhead)
- Available since Python 2.0
platform.python_version():
- Returns a string in "major.minor.patchlevel" format
- Requires importing platform module
- Already formatted as a string
- Available since Python 2.3
Recommendation: Keep sys.version_info
For your use case, sys.version_info is better because:
1. More efficient - No function call or additional import needed
2. More flexible - You can access individual components if needed later
3. Lighter weight - sys is always imported, platform adds overhead
4. More explicit - Shows exactly which version components you're using
Your current implementation is optimal:
f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"
If you wanted to use platform.python_version(), you'd need:
import platform
# ...
"language_version": platform.python_version()
Member
There was a problem hiding this comment.
My money is on platform.python_version() 😁
Contributor
Author
There was a problem hiding this comment.
I agree with ChatGPT and have updated the code to use 'system'. I've left the test as is to use platform so I'm not repeating the same expression in the test.
b79d0ad to
b8f4010
Compare
To collect Python language version usage and help us to better plan deprecation support of end-of-life Python versions.
b8f4010 to
92e8097
Compare
Contributor
Author
|
The linter started to complain about a missing docstring for a new method recently added so I've added another commit to address that. I have the incorrect branch name but I'm going to continue to roll with that and deal with Linear admin. |
pda
approved these changes
Jul 21, 2025
Merged
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
To collect Python language version usage and help us to better
plan deprecation support of end-of-life Python versions.