This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Clean-up turtledemo in-package documentation
Type: enhancement Stage: resolved
Components: Demos and Tools, Documentation Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: belopolsky Nosy List: belopolsky, eric.araujo, georg.brandl, glingl, gregorlingl, gvanrossum, jesstess, ned.deily, python-dev, r.david.murray, rhettinger, terry.reedy
Priority: normal Keywords: easy, needs review, patch

Created on 2010-11-02 02:03 by belopolsky, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue10291.diff belopolsky, 2011-03-22 19:59 review
issue10291_2.diff jesstess, 2014-04-20 00:07 review
Messages (15)
msg120200 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-11-02 02:03
Since after closing of issue #10199, docstrings in demo scripts are accessible to pydoc, it is important to bring them up to date.  For example, turtledemo.wikipedia docstring contains a reference to nonexistent wikipedia1 and calls itself tdemo_wikipedia3.py.

In addition, the turtledemo package contains three text files: Lib/turtledemo/about_turtle.txt, Lib/turtledemo/about_turtledemo.txt, and Lib/turtledemo/demohelp.txt.  The contents of these files should be moved to appropriate (doc)strings inside appropriate .py files.
msg131766 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-03-22 18:55
Agreed.  Which .py files would be appropriate?
msg131768 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2011-03-22 19:14
On Tue, Mar 22, 2011 at 2:55 PM, Éric Araujo <report@bugs.python.org> wrote:
..
> Agreed.  Which .py files would be appropriate?

Lib/turtledemo/about_turtle.txt - seems to belong to turtle.py

Lib/turtledemo/about_turtledemo.txt  -> turtledemo/__init__.py

and Lib/turtledemo/demohelp.txt. -> turtledemo/__main__.py or a new
module to be imported from __main__ most of the code in __main__ can
be moved/
msg131770 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2011-03-22 19:16
On Tue, Mar 22, 2011 at 3:14 PM, Alexander Belopolsky
<belopolsky@users.sourceforge.net> wrote:
..
> Lib/turtledemo/about_turtle.txt - seems to belong to turtle.py

In fact, it looks like turtle docstring is already a copy (or almost a
copy) of  Lib/turtledemo/about_turtle.txt.  Instead of reading
about_turtle.txt, turtledemo should just reuse turtle.__doc__.
msg131780 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-03-22 21:15
The patch contains one unrelated code change.

I think the docstrings should not go as is but be cleaned up to match docstrings conventions.  I’ve also spotted some phrasing issues.
msg131787 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2011-03-22 21:26
On Tue, Mar 22, 2011 at 5:15 PM, Éric Araujo <report@bugs.python.org> wrote:
>..
> The patch contains one unrelated code change.
>

Yes, I noticed that, but it may not be that unrelated.  Of course the
two changes need to be committed separately, but the pop-under issue
(issue11571) affects turtledemo in the same way as turtle.

> I think the docstrings should not go as is but be cleaned up to match docstrings conventions.
>  I’ve also spotted some phrasing issues.

I would rather keep code and documentation changes separate.  Not that
we have any strict  docstrings conventions. :-)
msg131788 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-03-22 21:29
> I would rather keep code and documentation changes separate.
I don’t follow; my comment about bad phrasing was about the text added to the docstrings.

> Not that we have any strict  docstrings conventions. :-)
Not enforced, but still useful to follow: PEP 257.

*looks at ast.py and grumbles*
msg131790 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2011-03-22 21:34
On Tue, Mar 22, 2011 at 5:29 PM, Éric Araujo <report@bugs.python.org> wrote:
..
>> I would rather keep code and documentation changes separate.
> I don’t follow; my comment about bad phrasing was about the text added to the docstrings.

The text added to docstrings was copied from deleted text files.  (I
only fixed a few obvious anachronisms such as turtleDemo vs.
turtledemo.)  From user's POV, there is no change: the help topics
display the same text as before.
msg216885 - (view) Author: Jessica McKellar (jesstess) * (Python triager) Date: 2014-04-20 00:07
Thanks for the bug report and patch, belopolsky!

The original patch no longer applies cleanly, so attached is a regenerated version.

* The new patch passes `make patchcheck`.
* The full test suite passes with this patch.
* I manually tested that before the patch, `./python.exe Lib/turtledemo/__main__.py` would start the demo window behind the Terminal on OSX, and after the patch it starts in front as desired.
* I manually checked the 3 help menu drop-down options in the demo, and they have the expected content.

There is a lot of out of date content in the turtle docs, and I think we should consider that work separate from this ticket and do a full audit of what needs updating in a new ticket.

=> commit review
msg216889 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-04-20 02:15
New changeset 004fe3449193 by Ned Deily in branch 'default':
Issue #10291: Cleanup turtledemo to use docstrings for help.
http://hg.python.org/cpython/rev/004fe3449193
msg216893 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-04-20 02:27
Thanks for the refresh, Jessica.  I decided to separate out the turtle window raise for OS X and apply that for 3.4.1 and 3.5.0 in Issue11571.  The remainder of the patch to use the docstrings, plus removal of the two other obsolete text files, is spplied here for 3.5.0.
msg223923 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-07-25 06:59
Is there any reason when turtledemo.__init__ and turtledemo.__main__ should not get docstrings in earlier versions? And the turtledemo.__main__ get the same changes in 3.4?

Not doing so introduced seeming gratuitous differences between the versions. The help refactoring I committed in 3.4 for #22053 could not be merged as it is. The demohelp.txt changes I have made for 3.4 have cleanly merged forward to file that is ignored and no longer displayed. With demohelp.txt moved to a docstring for 3.4 also, I would leave demohelp.txt in 3.4 but mark it 'unmaintained.

Why was demohelp.txt left after being copied to .__main__?  Expecting the file and docstring to remain in sync is not realistic.
msg223932 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-07-25 08:36
> Is there any reason when turtledemo.__init__ and turtledemo.__main__ should > not get docstrings in earlier versions? And the turtledemo.__main__ get the > same changes in 3.4?

I think my reasoning was that it was not a bug fix so it wasn't a strong candidate for a maintenance release.  But feel free to backport it if you think it important.

> Why was demohelp.txt left after being copied to .__main__?

It wasn't: 004fe3449193 deleted it.  It appears that an incorrect merge from 3.4 (3f4abe3107ce) in a subsequent set of changes for Issue21823 brought it back to life in default.
msg223986 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-07-25 18:41
Thanks for the explanation. I will re-delete the file after copying 3.4 version to docstring and marking the original .txt as frozen.
I will do same with other files deleted in 3.5.
msg225331 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-08-15 04:06
New changeset 7708f80940b0 by Terry Jan Reedy in branch '3.4':
Issue #10291: Backport 004fe3449193 with a few changes due to 22095.
http://hg.python.org/cpython/rev/7708f80940b0

New changeset 68902ee48985 by Terry Jan Reedy in branch 'default':
Issue #10291: null merge
http://hg.python.org/cpython/rev/68902ee48985
History
Date User Action Args
2022-04-11 14:57:08adminsetgithub: 54500
2014-08-15 04:06:16python-devsetmessages: + msg225331
2014-07-25 18:41:54terry.reedysetmessages: + msg223986
2014-07-25 08:36:13ned.deilysetmessages: + msg223932
2014-07-25 06:59:44terry.reedysetmessages: + msg223923
2014-04-20 02:27:55ned.deilysetstatus: open -> closed
versions: + Python 3.5, - Python 3.3
messages: + msg216893

resolution: fixed
stage: commit review -> resolved
2014-04-20 02:15:33python-devsetnosy: + python-dev
messages: + msg216889
2014-04-20 00:07:32jesstesssetfiles: + issue10291_2.diff

nosy: + jesstess
messages: + msg216885

keywords: + needs review
stage: needs patch -> commit review
2011-03-22 21:34:54belopolskysetnosy: gvanrossum, georg.brandl, rhettinger, terry.reedy, glingl, belopolsky, gregorlingl, ned.deily, eric.araujo, r.david.murray
messages: + msg131790
2011-03-22 21:29:05eric.araujosetnosy: gvanrossum, georg.brandl, rhettinger, terry.reedy, glingl, belopolsky, gregorlingl, ned.deily, eric.araujo, r.david.murray
messages: + msg131788
2011-03-22 21:26:13belopolskysetnosy: gvanrossum, georg.brandl, rhettinger, terry.reedy, glingl, belopolsky, gregorlingl, ned.deily, eric.araujo, r.david.murray
messages: + msg131787
2011-03-22 21:15:55eric.araujosetnosy: gvanrossum, georg.brandl, rhettinger, terry.reedy, glingl, belopolsky, gregorlingl, ned.deily, eric.araujo, r.david.murray
messages: + msg131780
2011-03-22 19:59:12belopolskysetfiles: + issue10291.diff
nosy: gvanrossum, georg.brandl, rhettinger, terry.reedy, glingl, belopolsky, gregorlingl, ned.deily, eric.araujo, r.david.murray
keywords: + patch
2011-03-22 19:44:26belopolskysetnosy: gvanrossum, georg.brandl, rhettinger, terry.reedy, glingl, belopolsky, gregorlingl, ned.deily, eric.araujo, r.david.murray
type: enhancement
versions: + Python 3.3, - Python 3.2
2011-03-22 19:16:28belopolskysetnosy: gvanrossum, georg.brandl, rhettinger, terry.reedy, glingl, belopolsky, gregorlingl, ned.deily, eric.araujo, r.david.murray
messages: + msg131770
2011-03-22 19:14:44belopolskysetnosy: gvanrossum, georg.brandl, rhettinger, terry.reedy, glingl, belopolsky, gregorlingl, ned.deily, eric.araujo, r.david.murray
messages: + msg131768
2011-03-22 18:55:20eric.araujosetnosy: gvanrossum, georg.brandl, rhettinger, terry.reedy, glingl, belopolsky, gregorlingl, ned.deily, eric.araujo, r.david.murray
messages: + msg131766
2010-11-02 02:03:30belopolskycreate