python / cpython

The Python programming language
https://www.python.org
Other
63.21k stars 30.27k forks source link

Add turtle module into installion option tcl/tk #125729

Open CoderTCY opened 1 week ago

CoderTCY commented 1 week ago

Feature or enhancement

Proposal:

Just as the title said, add turtle module into the option in the picture: pic Because the turtle module is a tool requiring tkinter, why should it added since the user didn't want to install tkinter?

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

CoderTCY commented 1 week ago

This is a literal description level problem, and not installing tcl/tk will cancel the installation of turtle. I don't think that's necessary. Should we add both tkinter turtle turtledemo IDLE

https://github.com/python/cpython/blob/main/PC/layout/main.py#L39-L40

But I still found turtle.py in Lib folder even I didn't tick the option, is it a bug? (Tested in 3.13.0) And sorry for my poor english ~_~

Wulian233 commented 1 week ago

I sorry for my mistake. You were right. Unchecking tcl/tk will remove the installation of turtledemo,

https://github.com/python/cpython/blob/main/Tools%2Fmsi%2Ftcltk%2Ftcltk.wixproj#L31-L31

but turtle will still be installed. However, turtle depends on tkinter. https://github.com/python/cpython/blob/main/Lib%2Fturtle.py#L101-L101

terryjreedy commented 6 days ago

I have informally suggested this somewhere once, but never made an issue. It seems sensible, so thanks. I do not know the situation on Mac, so included it also. What *nix distributions do is out of our hands.

What does turtle do when import turtle fails?

I believe that there is some tkinter code somewhere in tools. If so, it should fail gracefully. IDLE tries to fail gracefully (write a message) if import tkinter fails and it was started from a console in such a way that there is a sys.__stdout__ to write to. Tools may not be installed anyway; are more likely to be started from a terminal; and have less bulk that turtle; so omitting them seems less important.

zooba commented 5 days ago

Is the proposal here to list "turtle" as something that is added/removed with the Tcl/Tk option (that is, update the text in the installer)? Or do we need to actually make it add/remove with that option (that is, update the behaviour of the installer)?

I'm pretty sure we stopped distributing the Tools directory a while ago.

terryjreedy commented 4 days ago

Both:

  1. Omit turtle along with idlelib and turtledemo when tck/tk and (_)tkinter are omitted. (Two people say above that this is not the case now. Turtle is installed when it cannot run.)
  2. Modify label: "tcl/tk, tkinter, IDLE, and turtle" and desciption: "Installs tkinter, turtle, and the IDLE development environment."

I an not sure what happens on Macs.

ned-deily commented 4 days ago

I a not sure what happens on Macs.

The Python for macOS installers we provide on python.org do not have an option to not install tkinter, IDLE, or turtle.

terryjreedy commented 4 days ago

Thanks. Then this is Windows only.

CoderTCY commented 4 days ago

Is the proposal here to list "turtle" as something that is added/removed with the Tcl/Tk option (that is, update the text in the installer)? Or do we need to actually make it add/remove with that option (that is, update the behaviour of the installer)?

I'm pretty sure we stopped distributing the Tools directory a while ago.

Just like @terryjreedy said.