-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-113299: Move Argument Clinic CLI into libclinic #115542
Conversation
erlend-aasland
commented
Feb 15, 2024
•
edited by bedevere-app
bot
Loading
edited by bedevere-app
bot
- Issue: Refactor Argument Clinic support code into libclinic #113299
Can we not keep Maybe also consider adding |
Let's consider it. @AlexWaygood: what do you think, as the author of the patch?
Yes, that is a good idea. |
Yeah, I agree that makes more sense on the face of it. I think I tried it, but balked because it led to a much bigger diff, essentially destroying |
Also: thanks so much for picking this up! |
Ouch, yes that does mess up Git log pretty heavily! |
Turns out Git becomes extremely confused if we |
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.
What do you think of renaming libclinic to just clinic? And also move __main__.py
in the sub-directory?
My intent is to be able to run python -m clinic ...
when making the assumption that Tools/clinic/
is in the path.
Previously, "clinic" couldn't be used since Tools/clinic/
already contained clinic.py
.
I hope that in the long term, we can provide clinic as part of the stdlib! And clinic sounds like a better name than libclinic.
By the way, while we move files all around, what do you think of renaming clinic
to argclinic
?
Something like this? $ ls -lR Tools/clinic
total 24
drwxr-xr-x 10 erlend.aasland staff 320 Feb 16 09:11 clinic
-rw-r--r-- 1 erlend.aasland staff 266 Jan 17 12:58 mypy.ini
Tools/clinic/clinic:
total 536
-rw-r--r-- 1 erlend.aasland staff 1413 Feb 16 09:07 __init__.py
-rw-r--r-- 1 erlend.aasland staff 70 Feb 16 09:11 __main__.py
-rw-r--r-- 1 erlend.aasland staff 6361 Feb 16 09:11 cli.py
-rw-r--r-- 1 erlend.aasland staff 229513 Feb 16 09:11 clinic.py
-rw-r--r-- 1 erlend.aasland staff 5918 Feb 15 23:59 cpp.py
-rw-r--r-- 1 erlend.aasland staff 638 Feb 15 23:59 errors.py
-rw-r--r-- 1 erlend.aasland staff 6671 Feb 16 09:07 formatting.py
-rw-r--r-- 1 erlend.aasland staff 1049 Feb 16 09:07 identifiers.py
-rw-r--r-- 1 erlend.aasland staff 1951 Feb 15 23:59 utils.py
Currently, libclinic makes sense (we have clinic.py and a clinic lib with some refactored out code), but I agree it may be a temporary namespace. Here's a quick glance at what we do elsewhere in $ find Tools -name __main__.py
Tools/c-analyzer/c_parser/preprocessor/__main__.py
Tools/c-analyzer/c_parser/__main__.py
Tools/c-analyzer/cpython/__main__.py
Tools/c-analyzer/c_analyzer/__main__.py
Tools/peg_generator/pegen/__main__.py Your suggestion aligns with existing practice.
Let the painting begin 🎨🚲😄 My preference would be:
|
@vstinner: but we are digressing; the linked issue is about refactoring Argument Clinic into smaller and more manageable pieces, and this PR is about separating out the command-line interface. If we want a new Argument Clinic namespace, or make Argument Clinic a part of the stdlib, we should have a broader discussion 😃 Let us not derail further from the PR. |
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 if you remove __main__.py
.
You could use two commits/PRs to handle the Git history. IIUC, Git doesn't track renames, it just calculates them when generating its history. That ought to happen for each commit, so if there's a commit that is clearly a move rather than a big edit, followed by another one that's clearly a move rather than a big edit, it ought to stay happy. You can test with two commits on your own, but because we squash merge, it'll need to be separate PRs. The second one should just be a rename. |
@zooba, I see I did not clearly explain what I tested in #115542 (comment):
If we don't rename |
Yeah, I guess Git is going to make this painful for everyone regardless of the choice. Personally, calling it |
|
Well, there is the option just keeping the CLI in |
This reverts commit 95a59d7.
Removed with 730c3f9 |
Please don't do that :-( If we have a Also, run_clinic.py can live in a different directory, like |
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, but be careful of outdated NEWS entry (and maybe the commit message? I didn't check.)
@@ -0,0 +1,3 @@ | |||
The Argument Clinic CLI is now invoked as either :program:`python3 | |||
Tools/clinic` or :program:`python3 Tools/clinic/run_clinic.py`, as | |||
:file:`Tools/clinic/clinic.py` has been refactored into ``libclinic``. |
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.
The NEWS entry is outdated, there is no __main__.py
script.
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.
Ohh, thanks; the NEWS entry was not part of the commit I reverted. Good catch.
@zooba: How about @vstinner's suggestion (a $ python3 Tools/clinic/clinic |
The Argument Clinic CLI is now invoked as either :program:`python3 | ||
Tools/clinic` or :program:`python3 Tools/clinic/run_clinic.py`, as | ||
:file:`Tools/clinic/clinic.py` has been refactored into ``libclinic``. |
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.
The Argument Clinic CLI is now invoked as either :program:`python3 | |
Tools/clinic` or :program:`python3 Tools/clinic/run_clinic.py`, as | |
:file:`Tools/clinic/clinic.py` has been refactored into ``libclinic``. | |
The Argument Clinic CLI is now invoked as | |
:program:`python3 Tools/clinic/run_clinic.py`, | |
since :file:`Tools/clinic/clinic.py` has been refactored into ``libclinic``. |
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.
Yep, I like this NEWS entry.
I'd rather make However, since I don't do either right now, and because |
I would like to move clinic to the stdlib in the long term, so I would prefer to have |
Superseded by #117513. |