GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-98763: Prefer "python" over "python3" for command line examples in docs. by felixxm · Pull Request #98761 · python/cpython

Conversation

@felixxm

@felixxm felixxm commented Oct 27, 2022 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Currently docs are not consistent in using python vs. python3 for command line examples. As far as I'm aware, we should prefer python, see https://peps.python.org/pep-0394/#for-end-users-of-python

I can create a new issue, if required for such cleanup.

  • Issue: Prefer "python" over "python3" for command line examples in docs. #98763

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added awaiting review docs Documentation in the Doc dir skip news labels Oct 27, 2022
@AlexWaygood

AlexWaygood commented Oct 27, 2022

Copy link
Copy Markdown
Member

Thanks! We generally create issues for everything except the most trivial changes, to ensure visibility -- would you mind creating an issue for this?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@felixxm
felixxm force-pushed the python-python3 branch from 9ef0759 to 81e0988 Compare October 27, 2022 10:18
@felixxm felixxm changed the title Prefer "python" over "python3" for command line examples in docs. gh-98763: Prefer "python" over "python3" for command line examples in docs. Oct 27, 2022
@felixxm

felixxm commented Oct 27, 2022

Copy link
Copy Markdown
Contributor Author

Thanks! We generally create issues for everything except the most trivial changes, to ensure visibility -- would you mind creating an issue for this?

Created 👍

AlexWaygood reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AlexWaygood
AlexWaygood self-requested a review October 28, 2022 19:13
furkanonder
furkanonder approved these changes Dec 22, 2022
View reviewed changes
@bedevere-bot bedevere-bot added awaiting core review and removed awaiting review labels Dec 22, 2022
hauntsaninja
hauntsaninja approved these changes Dec 22, 2022
View reviewed changes

@hauntsaninja hauntsaninja left a comment

Copy link
Copy Markdown
Contributor

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.

Thank you!

I'm in favour of merging, given:

  • the https://peps.python.org/pep-0394/#for-end-users-of-python section that you link
  • the fact that three years on, Python 2 is finally mostly dead
  • that any eventual Python 4 is unlikely to break any of these examples

cc @JelleZijlstra

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Dec 22, 2022
JelleZijlstra
JelleZijlstra approved these changes Dec 22, 2022
View reviewed changes

@JelleZijlstra JelleZijlstra left a comment

Copy link
Copy Markdown
Member

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 agree but it's probably good to get some more opinions. @warsaw as one of the authors of PEP 394, what do you think?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@warsaw

warsaw commented Dec 23, 2022

Copy link
Copy Markdown
Member

Gah! GH lost the long comment I was composing.

I think it's worth revisiting PEP 394 in light of Python 2's EOL, but I am not involved in distro maintenance these days. @doko42 and @encukou might have relevant input here. On modern macOS, there's no python command and Homebrew doesn't install it, so the documentation will be broken for some folks. If it didn't touch so many files, I'd recommend including a note that these examples are only guaranteed to work in a virtualenv and if they don't work, try substituting python3 for python. Then there's also the py launcher to consider (@brettcannon).

3 years on, I think it's time to reclaim python for Python 3. Python 4 is still vaporware (wishware?) so I wouldn't worry about it.

JelleZijlstra, zware, and hugovk reacted with thumbs up emoji
All reactions
  • 👍 3 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@felixxm

felixxm commented Dec 23, 2022

Copy link
Copy Markdown
Contributor Author

Then there's also the py launcher to consider (@brettcannon).

In Django docs, we have a custom extension for the console directive which renders two-tab code blocks, 1st for Linux/MacOs with $ python, and the 2nd for Windows with ...\> py (see an example page):

image

I could prepare a similar solution for Python docs and the shell-session directive.

warsaw reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@warsaw

warsaw commented Dec 23, 2022

Copy link
Copy Markdown
Member

@felixxm That's nice, although the distinction between the tab labels may not always be correct (i.e. install py in Homebrew and it'll work on macOS, but also python doesn't work out of the box on standard macOS, afaict).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@brettcannon

brettcannon commented Dec 23, 2022

Copy link
Copy Markdown
Member

python doesn't work out of the box on standard macOS, afaict

Apple dropped Python from the macOS install, so the closest you get to Python being automatically installed now on an OS is some Linux distros and Windows and it's python3 shim (I don't know if it also covers python).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AlexWaygood

AlexWaygood commented Dec 23, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Windows and it's python3 shim (I don't know if it also covers python).

As a Windows user, I'd personally much prefer "python" in the docs to "python3". I tried installing it from the Windows Store once, and it didn't work (can't remember why not, I don't think I ever dug too deeply). Since then I've always installed it from python.org because, well, it's never not worked.

Unfortunately, because I installed it from python.org rather than the Windows Store, python3 on the command line takes me straight to the Windows Store every time rather than executing Python. python, on the other hand, works every time.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

encukou
encukou approved these changes Jan 2, 2023
View reviewed changes

@encukou encukou left a comment

Copy link
Copy Markdown
Member

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 can't speak for all Linux distros, let alone other platforms, but as far as I know it'd be best to follow the ”For end users of Python” section of PEP 394:

While far from being universally available, python remains the preferred spelling for explicitly invoking Python.

While a lot of the PEP's reasoning is outdated nowadays, I think the actual recommendations have aged pretty well.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@warsaw

warsaw commented Jan 2, 2023

Copy link
Copy Markdown
Member

@encukou Does that mean that the modern Fedora ecosystem provides python executable that invokes Python 3?

(I haven't been a user or contributor to Debuntu in years so I haven't kept up.)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@encukou

encukou commented Jan 3, 2023

Copy link
Copy Markdown
Member

@encukou Does that mean that the modern Fedora ecosystem provides python executable that invokes Python 3?

Yes. Back in 2019 we updated PEP 394 so we could do that :)

The “unversioned” python command is packaged separately, so it's not present in some environments (like minimal / non-Python containers). But even there, dnf install python or dnf install /usr/bin/python will install a 3.x python command.
(Python 2 is still available, because Gimp needs it, but that's always explicitly named python2.)

felixxm and gpshead reacted with hooray emoji
All reactions
  • 🎉 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@felixxm
felixxm force-pushed the python-python3 branch from 81e0988 to cb27624 Compare January 3, 2023 13:15
@bedevere-bot bedevere-bot mentioned this pull request Jan 3, 2023
Prefer "python" over "python3" for command line examples in docs. #98763
Closed
@felixxm
pythongh-98763: Prefer "python" over "python3" for command line examp…
d89202c
…les in docs.

See https://peps.python.org/pep-0394/#for-end-users-of-python
@felixxm
felixxm force-pushed the python-python3 branch from cb27624 to d89202c Compare January 11, 2023 09:08
@felixxm

felixxm commented Jan 11, 2023

Copy link
Copy Markdown
Contributor Author

As far as I'm aware, we reached a consensus to use python for command line examples 🥳 Thanks to everyone 🥇

gh640 and gpshead reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kumaraditya303
kumaraditya303 approved these changes Jan 11, 2023
View reviewed changes

@kumaraditya303 kumaraditya303 left a comment

Copy link
Copy Markdown
Contributor

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, time to get this in!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

felixxm and gh640 reacted with hooray emoji felixxm reacted with rocket emoji
All reactions
  • 🎉 2 reactions
  • 🚀 1 reaction
@kumaraditya303
kumaraditya303 merged commit 847d770 into python:main Jan 11, 2023
@bedevere-bot bedevere-bot removed the awaiting merge label Jan 11, 2023
@felixxm
felixxm deleted the python-python3 branch January 11, 2023 10:22
@furkanonder furkanonder mentioned this pull request Jan 15, 2023
gh-100972: For command line examples in the documentation, use "python" rather than "python3" #100973
Closed
This was referenced Mar 1, 2023
make install should symlink bin/python to bin/python3 #102358
Open
Usage of venv specifies a python3 command not found in 3.11.2 on Windows #102354
Closed
erlend-aasland pushed a commit to erlend-aasland/devguide that referenced this pull request Sep 8, 2023
@felixxm @erlend-aasland
python/cpython#98763: Prefer "python" over "python3" for command line…
2e689ce
… examples in docs. (python/cpython#98761)
AA-Turner pushed a commit to AA-Turner/devguide that referenced this pull request Sep 13, 2023
@felixxm
python/cpython#98763: Prefer "python" over "python3" for command line…
9243c7a
… examples in docs. (python/cpython#98761)
erlend-aasland pushed a commit to python/devguide that referenced this pull request Sep 26, 2023
@felixxm @erlend-aasland
python/cpython#98763: Prefer "python" over "python3" for command line…
980ec86
… examples in docs. (python/cpython#98761)
@Suncatcher Suncatcher mentioned this pull request Oct 6, 2024
v5.0.0beta: Python Runtime can't be found despite manually setting the Python path qbittorrent/qBittorrent#20737
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@encukou encukou encukou approved these changes
@JelleZijlstra JelleZijlstra JelleZijlstra approved these changes
@hauntsaninja hauntsaninja hauntsaninja approved these changes
@furkanonder furkanonder furkanonder approved these changes
@kumaraditya303 kumaraditya303 kumaraditya303 approved these changes
@AlexWaygood AlexWaygood Awaiting requested review from AlexWaygood

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

docs Documentation in the Doc dir skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

10 participants

@felixxm @AlexWaygood @warsaw @brettcannon @encukou @JelleZijlstra @hauntsaninja @furkanonder @kumaraditya303 @bedevere-bot
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.