gh-76303: Improve -x option documentation#144857
Open
RoryGlenn wants to merge 1 commit intopython:mainfrom
Open
gh-76303: Improve -x option documentation#144857RoryGlenn wants to merge 1 commit intopython:mainfrom
RoryGlenn wants to merge 1 commit intopython:mainfrom
Conversation
Expand the documentation for the -x command-line option to explain its purpose and usage for turning Python scripts into Windows batch files, with examples of batch file header lines. Closes python#76303.
Contributor
There was a problem hiding this comment.
News entries are not needed for docs changes - this can be deleted. See Changes that require NEWS entries for more on what changes do/do not require a new entry
Comment on lines
+527
to
+529
| following line can be added at the start of the script:: | ||
|
|
||
| @py -x "%~f0" %* & exit /b |
Contributor
There was a problem hiding this comment.
For batch syntax highlighting:
Suggested change
| following line can be added at the start of the script:: | |
| @py -x "%~f0" %* & exit /b | |
| following line can be added at the start of the script: | |
| .. code-block:: batch | |
| @py -x "%~f0" %* & exit /b |
Comment on lines
+531
to
+533
| Or, to specify the path to the Python interpreter explicitly:: | ||
|
|
||
| @"C:\Path\to\python.exe" -x "%~f0" %* & exit /b |
Contributor
There was a problem hiding this comment.
Suggested change
| Or, to specify the path to the Python interpreter explicitly:: | |
| @"C:\Path\to\python.exe" -x "%~f0" %* & exit /b | |
| Or, to specify the path to the Python interpreter explicitly: | |
| .. code-block:: batch | |
| @"C:\Path\to\python.exe" -x "%~f0" %* & exit /b |
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.
Expand the documentation for the
-xcommand-line option to explain its purpose and usage for turning Python scripts into Windows batch files, with examples of batch file header lines.The current documentation is a single line:
This gives virtually no information about why the option exists or how to use it. As noted by @serhiy-storchaka in the issue, the purpose of
-xis to allow turning Python scripts into Windows batch files (similar to how shebang lines work on Unix).The expanded documentation now includes:
-xis needed (the header line is not valid Python syntax)📚 Documentation preview 📚: https://cpython-previews--144857.org.readthedocs.build/