-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Synced docs and docstring for sysconfig.get_platform
#135530
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
base: main
Are you sure you want to change the base?
Conversation
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Thanks for the catch! It seems that still there are some possible return values of Moreover, improving On the other hand, general rewording can be more useful. Some links to related previous PRs and commits: |
This comment was marked as duplicate.
This comment was marked as duplicate.
a6537bc
to
7ab7580
Compare
This comment was marked as duplicate.
This comment was marked as duplicate.
@efimov-mikhail thanks for your swift response, I also thought that the phrasing "macOs can return" as well as "Examples of returned values" was implicitly assuming that an exhaustive list is not necessary. But did not know if this was intentional or not. I agree that exhaustive is better. I've added what I think is an exhaustive list + the tests for the >=11 macOS releases. Maybe this is a redundancy. I lack expertise on many aspects of the platform and sysconfig logic, so I may be missing something here. |
Thanks for the changes. IMO, now it looks better. But I'm also not an expert here. We probably should wait for someone with greater expertise. |
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.
Thanks for the PR. But I don't think it is a good idea to attempt to provide an exhaustive list here. As already noted in the paragraph above in sysconfig.rst
:
This is used mainly to distinguish platform-specific build directories and platform-specific built distributions
By implication, the exact values are not intended to be parsed. They are just configuration-unique values.
I would support changing the wording for macOS and to replace the macOS list with a few more modern examples, like:
Examples of macOS returned values:
- macosx-10.13-x86_64
- macosx-11-universal2
- macosx-15.5-arm64
Perhaps @zooba has an opinion on updates to the list of Windows values.
Also note that reST markup requires a blank line before the start of a list. The changes here disturb that. (See the doc preview)
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
This comment was marked as duplicate.
This comment was marked as duplicate.
Thanks @ned-deily I have made the requested changes; please review again |
Thanks for making the requested changes! @ned-deily: please review the changes made to this pull request. |
Doc/library/sysconfig.rst
Outdated
Examples of returned values: | ||
Returned values: | ||
|
||
Examples of Linux returned values: |
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.
Repeating "returned values" doesn't look very nice, IMO.
Doc/library/sysconfig.rst
Outdated
- win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T) | ||
- win-arm64 (64-bit Windows on ARM64, aka AArch64) | ||
- win32 (all others - specifically, sys.platform is returned) | ||
- win-arm32 (32-bit Windows on ARM) |
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.
Maybe it's better to have examples for each platform, and remove win-arm32
here.
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.
What do you mean by examples for each platform here? you mean 1 example per architecture, and not adressing arm32? something like
Examples of Windows platforms:
- win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)
- win-arm64 (64-bit Windows on ARM64, aka AArch64)
I feel like it can be repetitive as well to have a title preceding each OS: "Examples of {OS} platforms:", but at least is consistent. I have no preference between this or a general
Example of returned values:
Windows
...
linux
...
macOs
...
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.
Yes, I mean "Examples of returned values" for each platform. And win-arm32
value seems to be little redundant here in list of examples. I suggest to revert Windows platform examples list. Examples on Linux and macOS on current PR state looks fine, IMO
|
||
- win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T) | ||
- win-arm64 (64-bit Windows on ARM64, aka AArch64) | ||
- win32 (all others - specifically, sys.platform is returned) |
This comment was marked as duplicate.
This comment was marked as duplicate.
Sorry, something went wrong.
Doc/library/sysconfig.rst
Outdated
- linux-i586 | ||
- linux-i686 | ||
- linux-alpha (?) |
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.
- linux-alpha (?) | |
- android-9-arm64_v8a |
Lib/sysconfig/__init__.py
Outdated
For other non-POSIX platforms, currently just returns 'sys.platform'. | ||
- linux-i586 | ||
- linux-i686 | ||
- linux-alpha (?) |
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.
- linux-alpha (?) | |
- android-24-arm64_v8a |
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 know you probably got the Android example from the unit test, but this isn't actually a possible value because Android didn't add 64-bit support until API level 21. Also, this could mislead the reader into thinking it's the user-visible Android version rather than the API level. Suggest android-24-arm64_v8a
, which is the version we're compiling against for Python 3.14.
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.
Thanks for catch! I've had a little feeling that something is wrong.
Doc/library/sysconfig.rst
Outdated
@@ -382,22 +382,24 @@ Other functions | |||
|
|||
Examples of returned values: | |||
|
|||
Linux |
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.
Linux | |
POSIX based OS: |
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.
macOS is also POSIX-based, so this would be confusing. How about reordering it as follows:
- macOS
- Other POSIX platforms
- Windows
- Other non-POSIX platforms
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.
macOS is also POSIX-based, so this would be confusing
Of course, you're right.
Maybe this list would be better?
- Windows
- POSIX platfroms
- Other non-POSIX platforms
And include just one line for macOS at the POSIX section (macosx-15.5-arm64
) after linux-x86_64
line and before android-9-arm64_v8a
line.
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.
Yes, that would be reasonable.
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.
@mhsmith @efimov-mikhail thanks a lot for your suggestions and comments
As far as this conversation goes I understand that this is the desired
Windows:
- win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)
- win-arm64 (64-bit Windows on ARM64, aka AArch64)
POSIX based OS:
- linux-x86_64
- macosx-15.5-arm64
- android-9-arm64_v8a
Other non-POSIX platforms
...
I don't understand what will be the best option under non POSIX OS ? Is it reasonable is to remove the section and just leave the last sentence "For other non-POSIX platforms, currently just returns :data:sys.platform
."?
Lib/sysconfig/__init__.py
Outdated
win-amd64 (64-bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) | ||
win-arm64 (64-bit Windows on ARM64 (aka AArch64) | ||
win32 (all others - specifically, sys.platform is returned) | ||
Linux |
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.
Linux | |
POSIX based OS: |
I've digged into code and observed some important platforms such as Android. Speaking about text organization I'm not exactly sure that subsection with colons under section with colon is the best way, but I don't like raw "Windows" / "macOS" text before platform list. |
Doc/library/sysconfig.rst
Outdated
@@ -382,22 +382,24 @@ Other functions | |||
|
|||
Examples of returned values: | |||
|
|||
Linux |
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.
macOS is also POSIX-based, so this would be confusing. How about reordering it as follows:
- macOS
- Other POSIX platforms
- Windows
- Other non-POSIX platforms
Doc/library/sysconfig.rst
Outdated
- linux-i586 | ||
- linux-i686 |
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.
linux-i586 and linux-i686 are both obsolete. linux-x86_64 would be a better example.
1fbd476
to
f159723
Compare
Ivan, you don't have to force push something, all commits will be squashed into one at merging stage. |
I've added some changes that I thought will be useful after all discussions. |
Co-authored-by: Mikhail Efimov <[email protected]>
Co-authored-by: Mikhail Efimov <[email protected]>
Co-authored-by: Mikhail Efimov <[email protected]>
Co-authored-by: Mikhail Efimov <[email protected]>
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.
LGTM
CC @zooba @ned-deily |
arm64
macos return tosysconfig.get_platform
get_platform
📚 Documentation preview 📚: https://cpython-previews--135530.org.readthedocs.build/