Skip to content

feat: rename the tool-name attribute from name to tool_name - #28

Merged
bhirsz merged 1 commit into
mainfrom
refactor/tool-name-attr
Aug 30, 2026
Merged

feat: rename the tool-name attribute from name to tool_name#28
bhirsz merged 1 commit into
mainfrom
refactor/tool-name-attr

Conversation

@bhirsz

@bhirsz bhirsz commented Aug 30, 2026

Copy link
Copy Markdown
Member

Summary

Renames the ArgConfig tool-name class attribute from name to tool_name.

The old name attribute squatted on a very common option name: a subclass could not declare its own name option. The Robot Framework example had to work around this with an ugly name_ attribute mapped to --name. With this change, name is free for user options and the example declares a natural name.

Changes

  • base.py: the settable attribute is now tool_name; the resolved (non-optional, class-name fallback) value is exposed as the new resolved_tool_name property.
  • processor.py: uses resolved_tool_name for env-var and user-config-dir lookups.
  • Robot example (tests/robot_cli.py) now declares name: str | None = option(name="name", ...) and drops name_.
  • All examples, tests and README updated to set tool_name = "...".

Migration (pre-1.0)

  • Rename name = "..."tool_name = "..." on your ArgConfig subclasses.
  • If you read the resolved name off an instance, use resolved_tool_name instead of tool_name.

No stability guarantees yet (alpha); documented inline rather than as a breaking-change footer per the project's pre-1.0 policy.

All 230 tests pass; ruff + mypy clean.

@bhirsz
bhirsz force-pushed the refactor/tool-name-attr branch from 617f17f to 02732ee Compare August 30, 2026 13:32
@bhirsz
bhirsz changed the base branch from main to feat/profiles August 30, 2026 13:32
@bhirsz
bhirsz force-pushed the refactor/tool-name-attr branch from 02732ee to 4843d19 Compare August 30, 2026 13:34
Base automatically changed from feat/profiles to main August 30, 2026 13:34
The ArgConfig class attribute that sets the tool name was called `name`,
which squatted on a very common option name: a subclass could not declare
its own `name` option (the robot example had to use an ugly `name_`).

Rename the attribute to `tool_name` so `name` is free for user options.
The resolved (non-optional) value is now exposed as the `resolved_tool_name`
property. The robot example now declares a natural `name` option.

Migration (pre-1.0): rename `name = "..."` to `tool_name = "..."` on your
ArgConfig subclasses. If you read the resolved name off an instance, use
`resolved_tool_name` instead of `tool_name`.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bhirsz
bhirsz force-pushed the refactor/tool-name-attr branch from 4843d19 to 71c08b8 Compare August 30, 2026 13:34
@bhirsz
bhirsz merged commit d98c293 into main Aug 30, 2026
8 checks passed
@bhirsz
bhirsz deleted the refactor/tool-name-attr branch August 30, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant