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: Argument Clinic: add --clean option
Type: enhancement Stage: resolved
Components: Versions:
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, larry, serhiy.storchaka
Priority: normal Keywords:

Created on 2014-01-07 09:12 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (13)
msg207515 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-07 09:12
It will be helpful to add the --clean option for the clinic tool, which removes all Argument Clinic generated code.
msg207516 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-07 09:26
When would you want this?
msg207524 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-07 11:36
As fast as it is possible. This shouldn't be hard task, Argument Clinic 
already clean old generated code before inserting new code.
msg207525 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-07 11:38
I meant, under what circumstances would you want to use this?

I don't know why you would ever want --clean.  Removing the output from the Argument Clinic blocks would break any file using it.  And Argument Clinic is sufficiently fast, if you were worried about the output being wrong you could just run it again.
msg207530 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-07 13:05
This would just make sources more readable and editable. While I read, write 
or edit code, I don't want generated code distract me.
msg207531 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-07 13:10
I don't think Argument Clinic should do this.  It would leave the file in a broken state.  But if it's an option on clinic.py it might tempt somebody into using it, then they'd be confused.

If you want this functionality, please hack it up yourself locally.  I wouldn't accept this as a patch.

Personally I just got used to the Clinic generated code.
msg207544 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-07 14:58
Consider: if you ran "clinic.py --clean" on a C file, then tried to use "make clinic", the makefile would first try to build the C file.  But since the C file is now broken, the make would fail.  And you can't use "make clinic" to regenerate the Clinic output.  Obviously this is fixable, but for someone unfamiliar with Argument Clinic this could be very confusing.
msg207559 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-07 16:52
How it differs from the case when you just edit clinic declaration and *_impl 
function? Until you run clinic on this source file, it is broken.

I see that peoples already confused by Argument Clinic and manually edit 
generated code.
msg207563 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-07 16:58
If you edit the Clinic input and don't run clinic.py on it, it's out-of-date but not broken.

If you edit the Clinic output and make a mistake, it's *your* fault.

If you ran clinic.py --clean, now you've broken your file *and* the normal Clinic build system and you were using the tool correctly.  It's the *tool's* fault.

I will admit to having very little interest in adding a command-line option called "--clean" that breaks everything.
msg207578 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-07 18:28
If you ran clinic.py --clean and then not ran clinic.py without --clean, it's 
*your* fault. And you will noticed this when run make.

I have named this option --clean because it is similar to 'make clean' and 
'make distclean'.

If you want make automatically call clinic.py, lets 'make clinic' create the 
.clinic file, 'clinic.py --clean' remove it, and 'make' check if this file 
exists and run 'make clinic' otherwise.
msg207580 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-07 18:32
I must admit I am losing patience with this conversation.  Argument Clinic is not going to provide an attractively-named option that breaks your build and requires fixing by hand.  The bug is closed, the feature is not happening, it's my hope that we can now move on.
msg207932 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2014-01-12 08:10
Another use case here is if you want to "check" the remaining call sites of (say) PyArg_ParseTuple that aren't generated by clinic.

Call it '--remove' if you want, but the functionality should be useful.
msg207953 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-12 13:29
You can accomplish that workflow by using the Clinic buffer prototype and moving all your output to the "side".  Or by using the "buffer" approach, and stopping when you hit the generated code.  One of these might actually happen in Clinic, too, so hang on to your hats.

https://bitbucket.org/larry/python-clinic-buffer
History
Date User Action Args
2022-04-11 14:57:56adminsetgithub: 64357
2014-01-12 13:29:02larrysetmessages: + msg207953
2014-01-12 08:10:26georg.brandlsetnosy: + georg.brandl
messages: + msg207932
2014-01-07 18:32:03larrysetmessages: + msg207580
2014-01-07 18:28:47serhiy.storchakasetmessages: + msg207578
2014-01-07 16:58:41larrysetmessages: + msg207563
2014-01-07 16:52:00serhiy.storchakasetmessages: + msg207559
2014-01-07 14:58:33larrysetmessages: + msg207544
2014-01-07 13:10:01larrysetstatus: open -> closed
resolution: rejected
messages: + msg207531

stage: resolved
2014-01-07 13:05:26serhiy.storchakasetmessages: + msg207530
2014-01-07 11:38:55larrysetmessages: + msg207525
2014-01-07 11:36:48serhiy.storchakasetmessages: + msg207524
2014-01-07 09:26:25larrysetmessages: + msg207516
2014-01-07 09:12:09serhiy.storchakacreate