-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
Show the version of Python Launcher for Windows #100829
Comments
GH-100831 is a backport of this pull request to the 3.11 branch. |
This will break any tool that depends on parsing the known output format of |
The new "--version-launcher" option will show the version info and exit or pass extra arguments to the Python py launcher finded ? |
@eryksun thanks for the feedback i make the changes ➜ $env:PY_PYTHON='3.10'
➜ .\PCbuild\amd64\py_d.exe -V
Python 3.10.9
➜ .\PCbuild\amd64\py_d.exe -V:3.10 --version
Python 3.10.9
➜ .\PCbuild\amd64\py_d.exe -0v
Python Launcher for Windows Version 3.12.0a3+
➜ .\PCbuild\amd64\py_d.exe --version-launcher
Python Launcher for Windows Version 3.12.0a3+ |
You may be better off using >>> py_path = win32api.SearchPath(None, 'py.exe')[0]
>>> info = win32api.GetFileVersionInfo(py_path, '\\')
>>> info['ProductVersionMS'] >> 16
3
>>> info['ProductVersionMS'] & 0xFFFF
11
>>> info['ProductVersionLS'] >> 16
1150
>>> info['ProductVersionLS'] & 0xFFFF
1013 The final value, 1013, is the Python API version, which isn't relevant to the launcher. The third value, 1150, is the micro version number times 1000, plus the release level times 10, plus the release serial number. In this case, the micro version number is 1 (i.e. it's version 3.11.1), the release level is 15, and the release serial is 0. The release levels are defined in Include/patchlevel.h: Lines 10 to 15 in 951303f
|
The launcher have the Version defined as string: |
What I meant is that if you're only concerned with the py launcher on Windows, then using |
I make the changes for using the new launcher ("launcher2.c") on Python 3.11+ |
I'd recommend not to add variance with the Python launcher for Unix. Ideally these two launchers should converge. Adding changes that apply to only one because they happen to be separate implementations at the moment will only decrease the ability to converge these implementations. Can you explain more about the motivation for the version? The current launcher already reports the version:
How is |
How recommended @eryksun adding the output to the version of the Python will break tool depending that behaviour. Other point is if the argument for Version action will be redirected to the same Version argument option to the Python found The Python Launcher for Unix until today don't have Version option for the launcher. Here the discussion Open to the ideas 💡 |
The feature request is to know the version of the Launcher itself, not the version of Python that the Launcher will run on your behalf. But one thing that isn't clear to me is what's the use case for knowing the version of the Launcher (which in the Windows case is the version of Python it was installed with)? And is the use case important enough to complicate the API for the Launcher to add another flag that's explicit to the Launcher and something it has to capture instead of launching Python? |
Thinking in the future, using only the Python Launcher (new version can install other Python) for integration with others tools like Visual Studio Code, DevContainer Features, (python-launcher feature) will easy to check what version of the Python-Launcher is available in the system |
I'm not opposed to the change (I'd mildly prefer |
I leave as a reference the fork the |
Repeating my concerns:
|
How I say before in the comment , one scenario is if I want to check the version of the Python Launcher installed in the system without check the Other scenario for example using Devcontainer features . Here a use case but using Python Launcher for Unix |
You need to explain why you need to do it "without checking the |
Also, you need a scenario that isn't equally satisfied by "just run the command you want and see if it fails". Since |
Here was when I see the only way to check the version I using for the setting the feature . Other side effects is using |
For a human reading it, I agree. But for programmatically parsing the output, it's still the first line, which is much easier to read than any of the ones that come after it. We also already document the I'm still not convinced we need a third way to get the version of the launcher. |
I'm not convinced either, so I'm going to close this issue so I haven't seen a core dev be +1 on this idea. |
Feature or enhancement
Ability to return the version of Python Launcher for Windows running through the argument -V or --version
Pitch
Motivation
Starting with Python 3.11, Python Launcher for Windows has been included
One way to know the version of the
py
launcher that is running is through the argument '--help' and read the first line of the help contentThe following behavior is desired if the argument '--version' is added
Previous discussion
Linked PRs
The text was updated successfully, but these errors were encountered: