classification
Title: Make python -m ast more configurable
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: BTaskaya, levkivskyi, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2019-10-02 15:14 by BTaskaya, last changed 2019-12-16 18:24 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 16540 merged BTaskaya, 2019-10-02 15:30
Messages (8)
msg353741 - (view) Author: Batuhan Taskaya (BTaskaya) * (Python committer) Date: 2019-10-02 15:14
Allow user to set indent level and parsing status of type comments
msg353830 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-10-03 08:45
Why do you need this feature?
msg353842 - (view) Author: Batuhan Taskaya (BTaskaya) * (Python committer) Date: 2019-10-03 12:25
I was checking typed_ast and i wanted to know which parts changed and
implement that parts to astor. But there was no flags for --type-comments
False.

Also it can be handy to have an indention option to change it for fitting
tree into the terminal width.

On Thu, Oct 3, 2019, 11:45 AM Serhiy Storchaka <report@bugs.python.org>
wrote:

>
> Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment:
>
> Why do you need this feature?
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue38348>
> _______________________________________
>
msg353972 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-10-04 20:43
Sorry, I do not understand you. typed_ast does not have such features as multiline dump() and CLI. What relation is this have with the --type-comments flag?

As for fitting tree into the terminal width, the current indentation is 3 spaces. Changing it to 2 spaces will not save much horisontal space, and 1-space indentation is not particularly readable.

I do not want to complicate this tiny feature. If you want more control on the output, you can write a small Python script which calls ast.dump() programmatically.
msg353990 - (view) Author: Batuhan Taskaya (BTaskaya) * (Python committer) Date: 2019-10-05 04:43
> I do not want to complicate this tiny feature.
Making more configurable isn't making it complicated. It is just improving users control over it by indentation and parsing option.
msg354414 - (view) Author: Ivan Levkivskyi (levkivskyi) * (Python committer) Date: 2019-10-10 23:14
I don't have any strong opinion either way, so it looks like we need to wait until someone else will ask for this.
msg358502 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-12-16 18:23
New changeset 814d687c7df3e0c60036943b68ece13f9f19dfef by Victor Stinner (Batuhan Taşkaya) in branch 'master':
bpo-38348: Extend command line options of ast parsing tool (GH-16540)
https://github.com/python/cpython/commit/814d687c7df3e0c60036943b68ece13f9f19dfef
msg358503 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-12-16 18:24
Thanks Batuhan Taşkaya.
History
Date User Action Args
2019-12-16 18:24:07vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg358503

stage: patch review -> resolved
2019-12-16 18:23:36vstinnersetnosy: + vstinner
messages: + msg358502
2019-10-10 23:14:29levkivskyisetmessages: + msg354414
2019-10-05 04:43:16BTaskayasetmessages: + msg353990
2019-10-04 20:43:30serhiy.storchakasetmessages: + msg353972
2019-10-04 18:30:23levkivskyisetnosy: + levkivskyi
2019-10-03 12:25:49BTaskayasetmessages: + msg353842
2019-10-03 08:45:37serhiy.storchakasetmessages: + msg353830
2019-10-02 15:30:45BTaskayasetkeywords: + patch
stage: patch review
pull_requests: + pull_request16129
2019-10-02 15:14:59BTaskayacreate