Skip to content

Write the five open sections of the Program page - #397

Merged
Paebbels merged 1 commit into
devfrom
claude/doc-cliabstraction-program
Sep 19, 2026
Merged

Paebbels merged 1 commit into
devfrom
claude/doc-cliabstraction-program

Conversation

@pytooling-claude

@pytooling-claude pytooling-claude Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Documentation

  • doc/CLIAbstraction/Program.rst: 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 — _executableNames documented as what it is: a mapping from what
      platform.system returns to the program's name there. Then the part a caller trips over — where the
      executable is looked for — as a table, because it depends on whether executablePath, binaryDirectoryPath or
      neither was given, the third resolving through PATH with shutil.which. Both failure modes are named with the
      exception they raise, and dryRun=True is documented as what skips the checks, which is what lets a command
      line be assembled on a machine that doesn't have the program.
    • Defining Arguments on a Program — 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. CLIArgument is what makes the nested class
      findable, collected once by __init_subclass__ into __cliOptions__. The class-argument name="version" is
      combined 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 key
      Program.ToArgumentList uses — so the command line follows the order of the class body, not the order the
      arguments were set in.
    • CLIArgument — replaces the placeholder line: it is an Attribute, it carries no data, marking is all it
      does, and the collection happens once when the program class is created.
    • Setting Arguments on a Program — the dictionary syntax with classes as keys, both KeyError cases (an
      argument the program doesn't declare, and one already set), and why True is not a value but a way of saying
      present — Program._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 with
      a different value.
    • Derive Program Variants — a derived program class inherits none of the arguments, because
      __init_subclass__ collects the nested classes in its own scope.

Bug Fixes

  • doc/CLIAbstraction/Program.rst:
    • The usage example called a method that does not exist. It printed git.AsArgument(); Program has no
      AsArgument — that belongs to the argument classes. The method is Program.ToArgumentList, and the example now
      shows both it and str(git) together with their output.
    • The CLIArgument stub carried the .. _CLIABS/CLIArgument: label above one line of placeholder text. The label
      moved 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

  • There is no helper to copy the set arguments of one program instance to another, and no method to derive a
    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

  • Verified by building the full documentation before and after: 554 warnings both times, no new warning kind,
    and zero unresolved cross-references on the page.

@pytooling-claude
pytooling-claude Bot requested a review from Paebbels as a code owner September 9, 2026 23:07
@pytooling-claude pytooling-claude Bot added Documentation Improvements or additions to documentation Quality: Doc Documentation quality: completeness, coverage, level of details labels Sep 9, 2026
@codacy-production

codacy-production Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.49%. Comparing base (6947f22) to head (d8b3916).
⚠️ Report is 2 commits behind head on dev.
✅ All tests successful. No failed tests found.

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           
Flag Coverage Δ
unittests 81.49% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

'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
Paebbels force-pushed the claude/doc-cliabstraction-program branch from d8b3916 to 822c395 Compare September 19, 2026 22:38
@Paebbels
Paebbels merged commit d49d9eb into dev Sep 19, 2026
19 of 54 checks passed
@Paebbels
Paebbels deleted the claude/doc-cliabstraction-program branch September 19, 2026 22:43
@pytooling-claude pytooling-claude Bot mentioned this pull request Sep 19, 2026
@pytooling-claude pytooling-claude Bot added this to the v10.0 milestone Sep 19, 2026
This was referenced Oct 12, 2026
This was referenced Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation Quality: Doc Documentation quality: completeness, coverage, level of details

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants