-
Notifications
You must be signed in to change notification settings - Fork 0
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
PoC: Get rid of some globals #30
Conversation
e64f7e3
to
e12a8b1
Compare
Lib/test/test_clinic.py
Outdated
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.
Possibly even test_clinic
could become a package, and tests for helpers could be put in submodules? But we can also do that later, of course
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.
Yes, that's a good idea for a follow-up enhancement.
Tools/clinic/libclinic/__init__.py
Outdated
|
||
__all__ = [ | ||
# Accumulators | ||
"_TextAccumulator", |
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.
It feels a bit weird to include things with leading underscores in __all__
and import them from elsewhere. IIRC we've remarked before on the text-accumulator API not having great names. We should probably tackle that chunk of clinic.py in its own PR, and try to think through which bits of the text-accumulator stuff really need to be public-API (and what they should be renamed to, if they currently have private names)
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.
Yeah, this naming is very irritating. Let's fix it first.
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.
I wonder if we really need the underscore version; we can just do _, out, add = text_accumulator
instead. Also, we talked about just using lists and join
, and just get rid of that whole API.
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.
I did some experiments and landed on something that might work. Take a look at #31.
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.
Also: #33
I'll take a deeper look tomorrow! |
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.
This is great. There'll obviously be merge conflicts after python#113402 is merged, and I left one or two minor nitpicks, but other than that -- let's do it!
Split up clinic.py by establishing libclinic as a support package for Argument Clinic. Get rid of clinic.py globals by either making them class members, or by putting them into libclinic. - Move INCLUDE_COMMENT_COLUMN to BlockPrinter - Move NO_VARARG to CLanguage - Move formatting helpers to libclinic - Move some constants to libclinic (and annotate them as Final)
e12a8b1
to
6dc7246
Compare
Moved upstream (I'll address your latest comments there): |
Draft PR for an initial libclinic. The commits are atomic, so we can easily split this up in multiple PRs, if wanted.
📚 Documentation preview 📚: https://cpython-previews--30.org.readthedocs.build/