Repository navigation
Write the five open sections of the Program page - #397
Merged
Merged
Conversation
Up to standards ✅🟢 Issues
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #397 +/- ##
=======================================
Coverage 81.49% 81.49%
=======================================
Files 56 56
Lines 12796 12796
Branches 1951 1951
=======================================
Hits 10428 10428
Misses 1973 1973
Partials 395 395
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Paebbels
force-pushed
the
claude/doc-cliabstraction-program
branch
from
September 12, 2026 23:27
a922e58 to
d8b3916
Compare
Paebbels
approved these changes
Sep 19, 2026
'doc/CLIAbstraction/Program.rst' had five '.. todo::' blocks, each a bullet list of what to write, plus a 'CLIArgument' section whose entire body was the words "CLIArgument attribute". Setting Program Names based on OS documents '_executableNames' as what it is - a mapping from what 'platform.system()' returns to the program's name there - and then the part a caller actually trips over: where the executable is looked for. That is a table, because it depends on which of 'executablePath', 'binaryDirectoryPath' or neither was given, and the third case resolves through PATH with 'shutil.which'. Both failure modes are named with the exception they raise, and 'dryRun=True' is documented as what makes the checks skip - which is what lets a command line be assembled on a machine without the program. Defining Arguments on a Program explains the three things the example's three lines do: the nesting is the scope, so an argument cannot be set on a program that doesn't declare it; the 'CLIArgument' attribute is what makes the nested class findable, collected once by '__init_subclass__' into '__cliOptions__'; and the class-argument 'name="version"' is combined with the argument class' pattern to render '--version'. It also records the consequence nothing stated before: '__cliOptions__' maps each class to its *declaration position*, and that is the sort key 'ToArgumentList' uses - so the command line follows the order of the class body, not the order the arguments were set in. Setting Arguments on a Program documents the dictionary syntax with classes as keys, both 'KeyError' cases, and why 'True' is not a value but a way of saying *present* - '_NeedsParameterInitialization' decides whether the assigned value reaches the argument's constructor at all. Reading an item back gives the argument object, whose 'Value' can be changed to re-run a program with a different value. Derive Program Variants says what is true: a derived program class inherits none of the arguments, because '__init_subclass__' collects the nested classes in its own scope - and there is no helper to copy set arguments between instances, which is what the todo asked to explain. Two fixes on the page: The usage example called 'git.AsArgument()'. 'Program' has no such method - 'AsArgument' belongs to the argument classes. It is 'ToArgumentList()', and the example now shows both that and 'str(git)', with their output. The 'CLIArgument' stub carried the '.. _CLIABS/CLIArgument:' label and one line of placeholder text. The label moved to the written section; the stub is gone. Verified: the full 'doc/' build produces 554 warnings before and after, with no new warning kind, and every cross-reference on the page resolves to a link. Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
Paebbels
force-pushed
the
claude/doc-cliabstraction-program
branch
from
September 19, 2026 22:38
d8b3916 to
822c395
Compare
Merged
This was referenced Oct 12, 2026
Merged
Merged
Merged
This was referenced Oct 20, 2026
Merged
Merged
Merged
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documentation
doc/CLIAbstraction/Program.rst: five.. todo::blocks — each a bullet list of what to write — plus aCLIArgument section whose entire body was the words "CLIArgument attribute".
_executableNamesdocumented as what it is: a mapping from whatplatform.systemreturns to the program's name there. Then the part a caller trips over — where theexecutable is looked for — as a table, because it depends on whether
executablePath,binaryDirectoryPathorneither was given, the third resolving through
PATHwithshutil.which. Both failure modes are named with theexception they raise, and
dryRun=Trueis documented as what skips the checks, which is what lets a commandline be assembled on a machine that doesn't have the program.
so an argument cannot be set on a program that doesn't declare it.
CLIArgumentis what makes the nested classfindable, collected once by
__init_subclass__into__cliOptions__. The class-argumentname="version"iscombined with the argument class' pattern to render
--version. Plus the consequence nothing stated before:__cliOptions__maps each class to its declaration position, and that is the sort keyProgram.ToArgumentListuses — so the command line follows the order of the class body, not the order thearguments were set in.
Attribute, it carries no data, marking is all itdoes, and the collection happens once when the program class is created.
KeyErrorcases (anargument the program doesn't declare, and one already set), and why
Trueis not a value but a way of sayingpresent —
Program._NeedsParameterInitializationdecides whether the assigned value reaches the argument'sconstructor at all. Reading an item back gives the argument object, whose
Valuecan be changed to re-run witha different value.
__init_subclass__collects the nested classes in its own scope.Bug Fixes
doc/CLIAbstraction/Program.rst:git.AsArgument();Programhas noAsArgument— that belongs to the argument classes. The method isProgram.ToArgumentList, and the example nowshows both it and
str(git)together with their output... _CLIABS/CLIArgument:label above one line of placeholder text. The labelmoved to the written section and the stub is gone — leaving it in place while writing the new section produced a
"Duplicate explicit target name" warning, which is how it was caught.
Known Issues
configured variant from a configured program — which is what the Derive Program Variants todo asked to explain.
The section says so and gives the workaround (assign them again on the new instance). Adding such a helper belongs
to a code pull-request.
Others
and zero unresolved cross-references on the page.