docs: add auto-generated code documentation#149
Conversation
Reviewer's GuideAdds a new auto-generated documentation section under docs/codedocs describing crepr’s architecture, concepts, CLI, and public APIs, without changing any library or test code. Sequence diagram for crepr add command with diff and inline modessequenceDiagram
actor User
participant App as app
participant Add as add
participant GM as get_modules
participant GMod as get_module
participant Sel as get_all_init_args
participant Gen as create_repr
participant Apply as apply_changes
participant Ins as insert_changes
participant Diff as print_diff
User->>App: invoke crepr add files [flags]
App->>Add: dispatch add(files, kwarg_splat, diff, ignore_existing)
Add->>GM: get_modules(files)
loop each file
GM->>GMod: get_module(file_path)
alt import ok
GMod-->>GM: ModuleType
else CreprError
GMod-->>GM: raise CreprError
GM-->>Add: skip file after error output
end
end
loop each loaded module
Add->>Sel: get_all_init_args(module)
Sel-->>Add: iterator of (cls, init_args, line, source)
Add->>Gen: create_repr(module, kwarg_splat, ignore_existing_flag)
Gen-->>Add: changes: dict[int, Change]
alt diff is None
Add->>Add: print_changes(changes, action="generated")
else diff is True
Add->>Apply: apply_changes(module, changes, file_path, diff=True, change_func=insert_changes)
Apply->>Ins: insert_changes(module, changes)
Ins-->>Apply: new_source_lines
Apply->>Diff: print_diff(before, after)
Diff-->>User: unified diff
else diff is False
Add->>Apply: apply_changes(module, changes, file_path, diff=False, change_func=insert_changes)
Apply->>Ins: insert_changes(module, changes)
Ins-->>Apply: new_source_lines
Apply-->>User: file rewritten on disk
end
end
Class diagram for core public types and their relationshipsclassDiagram
class CreprError {
- message: str
- exit_code: int
+ __init__(self: Self, message: str, exit_code: int)
}
class Change {
class_name: str
lines: list[str]
}
class ModuleType
class TyperApp
class Functions {
+ get_module(file_path: pathlib_Path) ModuleType
+ get_modules(files: Iterable_pathlib_Path) Iterator_ModuleType_pathlib_Path
+ get_all_init_args(module: ModuleType) Iterator_type_MappingProxyType_int_list_str
+ create_repr(module: ModuleType, kwarg_splat: str, ignore_existing: bool) dict_int_Change
+ remove_repr(module: ModuleType) dict_int_Change
+ insert_changes(module: ModuleType, changes: dict_int_Change) list_str
+ remove_changes(module: ModuleType, changes: dict_int_Change) list_str
+ apply_changes(module: ModuleType, changes: dict_int_Change, file_path: pathlib_Path, diff: bool, change_func: Callable_ModuleType_dict_int_Change_list_str_) None
}
class CLICommands {
+ add(files: list_pathlib_Path, kwarg_splat: str, diff: Optional_bool, ignore_existing: bool) None
+ remove(files: list_pathlib_Path, diff: Optional_bool) None
}
TyperApp <|-- CLICommands : registered_as
Functions --> Change : uses
Functions --> ModuleType : inspects
CLICommands --> TyperApp : entry_point
CLICommands --> Functions : orchestration
CreprError <.. Functions : raises get_module_error
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
📝 WalkthroughWalkthroughAdds comprehensive documentation to the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment Warning |
for more information, see https://pre-commit.ci
Review Summary by QodoAdd comprehensive auto-generated code documentation for crepr
WalkthroughsDescription• Adds comprehensive auto-generated code documentation covering architecture, core concepts, API reference, and practical guides • Documents module loading, class selection, repr generation, and edit modes with detailed walkthroughs and examples • Provides CLI command reference for add and remove with parameter tables and usage patterns • Includes source inspection, generation/mutation functions, and package exports with import paths and signatures Diagramflowchart LR
A["Documentation Structure"] --> B["Architecture & Concepts"]
A --> C["API Reference"]
A --> D["Practical Guides"]
B --> E["Module relationships<br/>Data lifecycle<br/>Design decisions"]
C --> F["CLI commands<br/>Generation functions<br/>Package exports<br/>Source inspection"]
D --> G["Preview workflows<br/>Diff & apply<br/>Removal operations<br/>Kwargs handling"]
File Changes1. docs/codedocs/architecture.md
|
Code Review by Qodo
1. Broken Tabs block
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In
docs/codedocs/generation-and-mutation.md, the finalapply_changesexample is missing a comma betweenpathanddiff(apply_changes(module, changes, path diff=True, ...)), which will confuse readers copying the snippet. - In
docs/codedocs/index.mdunder Installation, the line starting with" "poetry"]}>appears to be a broken or leftover Tabs/Callout marker and should be cleaned up or replaced with the correct Tabs wrapper.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `docs/codedocs/generation-and-mutation.md`, the final `apply_changes` example is missing a comma between `path` and `diff` (`apply_changes(module, changes, path diff=True, ...)`), which will confuse readers copying the snippet.
- In `docs/codedocs/index.md` under Installation, the line starting with `" "poetry"]}>` appears to be a broken or leftover Tabs/Callout marker and should be cleaned up or replaced with the correct Tabs wrapper.
## Individual Comments
### Comment 1
<location path="docs/codedocs/index.md" line_range="36" />
<code_context>
+
+<Callout type="info">`crepr` is published as a Python package, so installation uses Python package managers rather than npm.</Callout>
+
+" "poetry"]}>
+<Tab value="pip">
+
</code_context>
<issue_to_address>
**issue (bug_risk):** Stray text in the Installation section likely from a malformed Tabs declaration.
This looks like a leftover fragment (likely from a `<Tabs>` declaration) and is invalid Markdown/JSX/MDX. Please remove or fix it so the installation tabs render correctly.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
|
||
| <Callout type="info">`crepr` is published as a Python package, so installation uses Python package managers rather than npm.</Callout> | ||
|
|
||
| " "poetry"]}> |
There was a problem hiding this comment.
issue (bug_risk): Stray text in the Installation section likely from a malformed Tabs declaration.
This looks like a leftover fragment (likely from a <Tabs> declaration) and is invalid Markdown/JSX/MDX. Please remove or fix it so the installation tabs render correctly.
There was a problem hiding this comment.
Auto Pull Request Review from LlamaPReview
Review Status: Automated Review Skipped
Dear contributor,
Thank you for your Pull Request. LlamaPReview has analyzed your changes and determined that this PR does not require an automated code review.
Analysis Result:
PR only contains documentation changes (14 files)
Technical Context:
Documentation changes typically include:
- Markdown/RST file updates
- API documentation
- Code comments
- README updates
- Documentation in /docs directory
- License and contribution files
We're continuously improving our PR analysis capabilities. Have thoughts on when and how LlamaPReview should perform automated reviews? Share your insights in our GitHub Discussions.
Best regards,
LlamaPReview Team
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive documentation for the crepr tool, covering its architecture, core concepts, API reference, and practical usage guides. The documentation details how the tool uses runtime inspection to generate or remove repr methods across various execution modes. Review feedback identified several syntax errors in code examples, including missing commas in function calls and a mangled UI component in the getting started guide.
| module = get_module(path) | ||
| changes = create_repr(module, kwarg_splat="kwargs=...", ignore_existing=True) | ||
|
|
||
| apply_changes(module, changes, path diff=True, change_func=insert_changes) |
| module = get_module(path) | ||
| changes = remove_repr(module) | ||
|
|
||
| apply_changes(module, changes, path diff=False, change_func=remove_changes) |
|
|
||
| <Callout type="info">`crepr` is published as a Python package, so installation uses Python package managers rather than npm.</Callout> | ||
|
|
||
| " "poetry"]}> |
| <Callout type="warn">Inline mode rewrites the file content directly with `" | ||
| ".join(src)`. There is no backup file, formatting pass, or conflict detection. Use `--diff` first if you want a review step or if the file may have been edited concurrently.</Callout> |
There was a problem hiding this comment.
The string literal for the newline join is split across two lines, which will likely render incorrectly and is technically inaccurate as a Python snippet. It should be on a single line.
| <Callout type="warn">Inline mode rewrites the file content directly with `" | |
| ".join(src)`. There is no backup file, formatting pass, or conflict detection. Use `--diff` first if you want a review step or if the file may have been edited concurrently.</Callout> | |
| <Callout type="warn">Inline mode rewrites the file content directly with "\n".join(src). There is no backup file, formatting pass, or conflict detection. Use --diff first if you want a review step or if the file may have been edited concurrently.</Callout> |
| ``` | ||
|
|
||
| After the second command, `account.py` contains the new `__repr__`. | ||
|
|
There was a problem hiding this comment.
There is a missing comma between the mode and encoding arguments in the file_path.open call description.
| Diff mode and inline mode share the same selection and generation pipeline. There is no “preview implementation” and “apply implementation” that could diverge. The only difference is whether apply_changes calls print_diff or writes the resulting source back through file_path.open(mode="w", encoding="UTF-8"). |
Greptile SummaryThis PR adds 14 AI-generated documentation files under
Confidence Score: 3/5Not safe to merge as-is — broken MDX syntax will break the rendered docs page and copy-pasteable code examples contain syntax errors. Three P1 findings: two copy-paste-ready code examples with SyntaxErrors and one broken MDX component that will break rendering. These are straightforward to fix but should be resolved before the docs go live.
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant CLI as Typer CLI (add/remove)
participant Loader as get_modules / get_module
participant Scanner as get_all_init_args
participant Generator as create_repr / remove_repr
participant Output as print_changes / apply_changes
User->>CLI: crepr add file.py [--diff|--inline]
CLI->>Loader: load each file path
Loader-->>CLI: ModuleType (or print error and skip)
CLI->>Scanner: inspect module classes
Scanner-->>CLI: eligible (cls, init_args, lineno, source) tuples
CLI->>Generator: build dict[int, Change] keyed by line number
Generator-->>CLI: change map
alt diff is None (preview)
CLI->>Output: print_changes → stdout
else diff=True
CLI->>Output: apply_changes → print_diff → stdout
else diff=False (inline)
CLI->>Output: apply_changes → write file
end
Output-->>User: generated text / unified diff / rewritten file
Reviews (1): Last reviewed commit: "[pre-commit.ci] auto fixes from pre-comm..." | Re-trigger Greptile |
| module, | ||
| changes, | ||
| Path("models.py"), | ||
| diff=True, | ||
| change_func=insert_changes, | ||
| ) | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Missing comma in
apply_changes call examples
Both programmatic usage examples omit the required comma between the path positional argument and the diff keyword argument. Copying these examples as-is would produce a SyntaxError.
| module, | |
| changes, | |
| Path("models.py"), | |
| diff=True, | |
| change_func=insert_changes, | |
| ) | |
| ``` | |
| apply_changes(module, changes, path, diff=True, change_func=insert_changes) |
| from crepr.crepr import apply_changes, create_repr, get_module, insert_changes | ||
|
|
||
| path = Path("models.py") | ||
| module = get_module(path) | ||
| changes = create_repr(module, kwarg_splat="kwargs=...", ignore_existing=True) | ||
|
|
||
| apply_changes(module, changes, path diff=True, change_func=insert_changes) | ||
| ``` |
There was a problem hiding this comment.
Missing comma in
apply_changes remove-flow example
Same issue as the add-flow example: path diff=False is missing a comma and would fail as a SyntaxError if copied verbatim.
| from crepr.crepr import apply_changes, create_repr, get_module, insert_changes | |
| path = Path("models.py") | |
| module = get_module(path) | |
| changes = create_repr(module, kwarg_splat="kwargs=...", ignore_existing=True) | |
| apply_changes(module, changes, path diff=True, change_func=insert_changes) | |
| ``` | |
| apply_changes(module, changes, path, diff=False, change_func=remove_changes) |
| <Tab value="uv"> | ||
|
|
||
| ```bash | ||
| uv tool install crepr |
There was a problem hiding this comment.
The line " "poetry"]}> is clearly truncated/corrupted MDX. It appears the opening <Tabs ...> component tag was partially removed, leaving only the tail of a values={["pip", "uv", "pipx", "poetry"]}> attribute. As-is, this will cause a parse error in any MDX renderer and break the entire Installation section.
| | `kwarg_splat` | `str` | — | Placeholder fragment for `**kwargs`. | | ||
| | `ignore_existing` | `bool` | — | When `True`, skip classes that already define `__repr__`. | | ||
|
|
||
| Return type: `dict[int, Change]` |
There was a problem hiding this comment.
ignore_existing semantics are inverted relative to the CLI flag
The table documents create_repr's ignore_existing parameter as "When True, skip classes that already define __repr__". This is technically accurate for the internal function (if repr_exists(obj) and ignore_existing: continue), but the add command calls create_repr(module, kwarg_splat, not ignore_existing) — inverting the flag. A direct caller following this documented example with ignore_existing=True would see the opposite behavior from the same-named --ignore-existing CLI flag. The docs should add a note about this inversion.
| <Callout type="info">`crepr` is published as a Python package, so installation uses Python package managers rather than npm.</Callout> | ||
|
|
||
| " "poetry"]}> | ||
| <Tab value="pip"> | ||
|
|
||
| ```bash | ||
| pip install crepr | ||
| ``` | ||
|
|
||
| </Tab> | ||
| <Tab value="uv"> | ||
|
|
||
| ```bash | ||
| uv tool install crepr | ||
| ``` | ||
|
|
||
| </Tab> | ||
| <Tab value="pipx"> | ||
|
|
||
| ```bash | ||
| pipx install crepr | ||
| ``` | ||
|
|
||
| </Tab> | ||
| <Tab value="poetry"> | ||
|
|
||
| ```bash | ||
| poetry add --group dev crepr | ||
| ``` | ||
|
|
||
| </Tab> | ||
| </Tabs> |
There was a problem hiding this comment.
1. Broken tabs block 🐞 Bug ☼ Reliability
docs/codedocs/index.md contains an invalid Tabs section: a stray " "poetry"]}> line and a </Tabs> close without any opening <Tabs ...> tag. This will fail MDX parsing/rendering and can break the documentation build.
Agent Prompt
## Issue description
`docs/codedocs/index.md` has a malformed Tabs block: there is an invalid fragment (`" "poetry"]}>`) and a closing `</Tabs>` without a corresponding opening `<Tabs ...>` tag, which can break MDX compilation.
## Issue Context
The installation section is intended to render a tabbed UI for pip/uv/pipx/poetry.
## Fix Focus Areas
- docs/codedocs/index.md[32-66]
## Suggested change
Replace the broken fragment line with a correct opening `<Tabs ...>` tag compatible with this docs stack (likely something like `<Tabs items={["pip","uv","pipx","poetry"]}>`), ensuring the opening/closing tags match and that all `<Tab>` children are properly nested.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| <Callout type="warn">Inline mode rewrites the file content directly with `" | ||
| ".join(src)`. There is no backup file, formatting pass, or conflict detection. Use `--diff` first if you want a review step or if the file may have been edited concurrently.</Callout> |
There was a problem hiding this comment.
2. Invalid inline code span 🐞 Bug ☼ Reliability
docs/codedocs/edit-modes.md breaks an inline code span across a newline inside a <Callout> (`` "\n".join(src) ` becomes " <newline> ".join(src) `). This is invalid Markdown/MDX and can fail rendering or compilation.
Agent Prompt
## Issue description
`docs/codedocs/edit-modes.md` contains an inline code span that is split across two lines inside backticks, which is invalid Markdown/MDX and may break docs rendering.
## Issue Context
The callout is trying to document the exact string used when writing the file content in inline mode.
## Fix Focus Areas
- docs/codedocs/edit-modes.md[64-70]
- crepr/crepr.py[380-395]
## Suggested change
Rewrite the callout sentence so the code span is on a single line and matches the implementation, e.g.:
`Inline mode rewrites the file content directly with `"\n".join(src)`...`
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/codedocs/api-reference/generation-and-mutation.md`:
- Line 184: The example calls to apply_changes are syntactically invalid because
the positional argument list is missing commas after the path parameter; update
the example calls to pass arguments correctly by adding the missing comma
between path and the keyword args (e.g., after path) so that
apply_changes(module, changes, path, diff=True, change_func=insert_changes) and
the other call use proper comma separation; look for usages of apply_changes and
the parameter names module, changes, path, diff, change_func to fix all
instances.
In `@docs/codedocs/api-reference/package-exports.md`:
- Around line 18-22: Update the doc snippet to show that __version__ is
re-exported rather than defined in the package root: replace the literal
assignment example with an import-from form (e.g., from crepr.about import
__version__) and revise the explanatory sentence to state that the package root
re-exports __version__ from crepr.about; reference crepr.__init__/crepr.about
and the symbol __version__ so readers know the true source-of-truth.
In `@docs/codedocs/api-reference/source-inspection.md`:
- Around line 91-97: The docs incorrectly list POSITIONAL_OR_KEYWORD as
supported by has_only_kwargs; update the API reference text in
source-inspection.md so it matches the actual has_only_kwargs implementation by
stating it only returns True when parameters are KEYWORD_ONLY or VAR_KEYWORD and
returns False for POSITIONAL_OR_KEYWORD and VAR_POSITIONAL (e.g., remove
POSITIONAL_OR_KEYWORD from the supported list and clarify the behavior for
*args/VAR_POSITIONAL).
In `@docs/codedocs/architecture.md`:
- Around line 78-79: The doc claim about constructor-shape support is
inaccurate: `get_all_init_args` relies on `has_only_kwargs`, which currently
only accepts `KEYWORD_ONLY` and `VAR_KEYWORD` and thus does not actually support
`POSITIONAL_OR_KEYWORD` or `*args`; update the architecture text to reflect the
real behavior (that only keyword-only and **kwargs constructors are supported
and dataclasses are skipped because they don't define `__init__` in the class
body) or alternatively change the implementation by modifying `has_only_kwargs`
to also accept `POSITIONAL_OR_KEYWORD` parameters—reference `get_all_init_args`
and `has_only_kwargs` when making the fix so the doc and code remain consistent.
In `@docs/codedocs/edit-modes.md`:
- Around line 68-69: The callout currently breaks the inline join expression
across two lines (shows a quote on one line and .join(src) on the next); update
the callout text in edit-modes.md so the inline snippet is a single, continuous
literal showing an empty-string join of src (replace the broken split `" "
.join(src)` with a single inline snippet for the empty-string join), ensuring
the sentence reads smoothly and uses one inline code span for the join
expression.
In `@docs/codedocs/index.md`:
- Line 36: The MDX Tabs opening tag is malformed at the fragment `"
"poetry"]}>`; restore the full opening tag for the Tabs component (the <Tabs
...> element) so the MDX parser can render; locate the broken token near the
existing Tabs usage in docs/codedocs/index.md (search for `" "poetry"]}>` or the
surrounding closing tag) and replace it with the correct opening tag including
its expected attributes (e.g., the full <Tabs value={...} onChange={...}> or
whatever attributes the other Tabs usage in this file expects) so the Tabs block
is syntactically valid.
In `@docs/codedocs/repr-generation.md`:
- Around line 31-32: The doc contains a malformed fragment for VAR_KEYWORD
output (the broken literal starting with f"**{},) — replace that with a valid
fragment that mirrors the named-parameter pattern by inserting the VAR_KEYWORD
parameter name (and proper quoting/representation when appropriate) plus the
trailing comma and space so the example matches actual generated output and
reflects the --kwarg-splat option behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2b1763ac-1ff8-435b-851e-d273a0917144
📒 Files selected for processing (14)
docs/codedocs/api-reference/cli-commands.mddocs/codedocs/api-reference/generation-and-mutation.mddocs/codedocs/api-reference/package-exports.mddocs/codedocs/api-reference/source-inspection.mddocs/codedocs/architecture.mddocs/codedocs/class-selection.mddocs/codedocs/discovery-and-loading.mddocs/codedocs/edit-modes.mddocs/codedocs/guides/generate-preview.mddocs/codedocs/guides/remove-generated-reprs.mddocs/codedocs/guides/review-diff-and-apply.mddocs/codedocs/guides/work-with-existing-reprs.mddocs/codedocs/index.mddocs/codedocs/repr-generation.md
| module = get_module(path) | ||
| changes = create_repr(module, kwarg_splat="kwargs=...", ignore_existing=True) | ||
|
|
||
| apply_changes(module, changes, path diff=True, change_func=insert_changes) |
There was a problem hiding this comment.
Fix invalid Python example calls (apply_changes) in docs.
Line 184 and Line 197 are syntactically invalid due to missing commas after path.
Proposed fix
-apply_changes(module, changes, path diff=True, change_func=insert_changes)
+apply_changes(module, changes, path, diff=True, change_func=insert_changes)-apply_changes(module, changes, path diff=False, change_func=remove_changes)
+apply_changes(module, changes, path, diff=False, change_func=remove_changes)Also applies to: 197-197
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/codedocs/api-reference/generation-and-mutation.md` at line 184, The
example calls to apply_changes are syntactically invalid because the positional
argument list is missing commas after the path parameter; update the example
calls to pass arguments correctly by adding the missing comma between path and
the keyword args (e.g., after path) so that apply_changes(module, changes, path,
diff=True, change_func=insert_changes) and the other call use proper comma
separation; look for usages of apply_changes and the parameter names module,
changes, path, diff, change_func to fix all instances.
| ```python | ||
| __version__ = "0.6.0dev0" | ||
| ``` | ||
|
|
||
| The package root only re-exports `__version__` from `crepr/about.py`. If you need the installed library version in tooling or diagnostics, this is the stable import path. |
There was a problem hiding this comment.
__version__ definition is documented as a literal instead of a re-export.
Line 18–22 currently implies a direct package-root assignment, but crepr/__init__.py re-exports from crepr.about. This can mislead readers about source-of-truth location.
Suggested doc correction
-Definition:
+Re-export in `crepr/__init__.py`:
```python
-__version__ = "0.6.0dev0"
+from crepr.about import __version__-The package root only re-exports __version__ from crepr/about.py. If you need the installed library version in tooling or diagnostics, this is the stable import path.
+The package root re-exports __version__ from crepr/about.py. If you need the installed library version in tooling or diagnostics, this is the stable import path.
</details>
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against the current code and only fix it if needed.
In @docs/codedocs/api-reference/package-exports.md around lines 18 - 22, Update
the doc snippet to show that version is re-exported rather than defined in
the package root: replace the literal assignment example with an import-from
form (e.g., from crepr.about import version) and revise the explanatory
sentence to state that the package root re-exports version from crepr.about;
reference crepr.init/crepr.about and the symbol version so readers know
the true source-of-truth.
</details>
<!-- fingerprinting:phantom:triton:hawk:8efb80dd-fd62-4f8b-a4e9-b35b94c4dcc4 -->
<!-- This is an auto-generated comment by CodeRabbit -->
| Returns `True` when every parameter is one of: | ||
|
|
||
| - `POSITIONAL_OR_KEYWORD` | ||
| - `KEYWORD_ONLY` | ||
| - `VAR_KEYWORD` | ||
|
|
||
| It returns `False` for constructors with `VAR_POSITIONAL` (`*args`). |
There was a problem hiding this comment.
has_only_kwargs behavior is documented incorrectly.
Line 93 lists POSITIONAL_OR_KEYWORD as supported, but implementation only accepts KEYWORD_ONLY and VAR_KEYWORD. This is an API-reference mismatch.
Suggested doc correction
Returns `True` when every parameter is one of:
-- `POSITIONAL_OR_KEYWORD`
- `KEYWORD_ONLY`
- `VAR_KEYWORD`
-It returns `False` for constructors with `VAR_POSITIONAL` (`*args`).
+It returns `False` for constructors with `POSITIONAL_OR_KEYWORD` and `VAR_POSITIONAL` (`*args`).📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Returns `True` when every parameter is one of: | |
| - `POSITIONAL_OR_KEYWORD` | |
| - `KEYWORD_ONLY` | |
| - `VAR_KEYWORD` | |
| It returns `False` for constructors with `VAR_POSITIONAL` (`*args`). | |
| Returns `True` when every parameter is one of: | |
| - `KEYWORD_ONLY` | |
| - `VAR_KEYWORD` | |
| It returns `False` for constructors with `POSITIONAL_OR_KEYWORD` and `VAR_POSITIONAL` (`*args`). |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/codedocs/api-reference/source-inspection.md` around lines 91 - 97, The
docs incorrectly list POSITIONAL_OR_KEYWORD as supported by has_only_kwargs;
update the API reference text in source-inspection.md so it matches the actual
has_only_kwargs implementation by stating it only returns True when parameters
are KEYWORD_ONLY or VAR_KEYWORD and returns False for POSITIONAL_OR_KEYWORD and
VAR_POSITIONAL (e.g., remove POSITIONAL_OR_KEYWORD from the supported list and
clarify the behavior for *args/VAR_POSITIONAL).
| `get_all_init_args` only yields classes with an explicit `__init__` in `cls.__dict__` and only when `has_only_kwargs` returns `True`. In practice, that means classes with `POSITIONAL_OR_KEYWORD`, `KEYWORD_ONLY`, and `VAR_KEYWORD` parameters are supported, while `*args` is not. Dataclasses are also skipped because they do not define `__init__` directly in the class body. | ||
|
|
There was a problem hiding this comment.
Constructor-shape support is overstated.
Line 78 says get_all_init_args supports POSITIONAL_OR_KEYWORD, but current has_only_kwargs logic only accepts KEYWORD_ONLY and VAR_KEYWORD. This architectural statement should match implementation.
Suggested doc correction
-`get_all_init_args` only yields classes with an explicit `__init__` in `cls.__dict__` and only when `has_only_kwargs` returns `True`. In practice, that means classes with `POSITIONAL_OR_KEYWORD`, `KEYWORD_ONLY`, and `VAR_KEYWORD` parameters are supported, while `*args` is not. Dataclasses are also skipped because they do not define `__init__` directly in the class body.
+`get_all_init_args` only yields classes with an explicit `__init__` in `cls.__dict__` and only when `has_only_kwargs` returns `True`. In practice, that means classes with `KEYWORD_ONLY` and `VAR_KEYWORD` parameters are supported, while `POSITIONAL_OR_KEYWORD` and `*args` are not. Dataclasses are also skipped because they do not define `__init__` directly in the class body.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| `get_all_init_args` only yields classes with an explicit `__init__` in `cls.__dict__` and only when `has_only_kwargs` returns `True`. In practice, that means classes with `POSITIONAL_OR_KEYWORD`, `KEYWORD_ONLY`, and `VAR_KEYWORD` parameters are supported, while `*args` is not. Dataclasses are also skipped because they do not define `__init__` directly in the class body. | |
| `get_all_init_args` only yields classes with an explicit `__init__` in `cls.__dict__` and only when `has_only_kwargs` returns `True`. In practice, that means classes with `KEYWORD_ONLY` and `VAR_KEYWORD` parameters are supported, while `POSITIONAL_OR_KEYWORD` and `*args` are not. Dataclasses are also skipped because they do not define `__init__` directly in the class body. |
🧰 Tools
🪛 LanguageTool
[style] ~78-~78: This adverb was used twice in the sentence. Consider removing one of them or replacing them with a synonym.
Context: ...init__incls.dictand only whenhas_only_kwargsreturnsTrue`. In practice, th...
(ADVERB_REPETITION_PREMIUM)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/codedocs/architecture.md` around lines 78 - 79, The doc claim about
constructor-shape support is inaccurate: `get_all_init_args` relies on
`has_only_kwargs`, which currently only accepts `KEYWORD_ONLY` and `VAR_KEYWORD`
and thus does not actually support `POSITIONAL_OR_KEYWORD` or `*args`; update
the architecture text to reflect the real behavior (that only keyword-only and
**kwargs constructors are supported and dataclasses are skipped because they
don't define `__init__` in the class body) or alternatively change the
implementation by modifying `has_only_kwargs` to also accept
`POSITIONAL_OR_KEYWORD` parameters—reference `get_all_init_args` and
`has_only_kwargs` when making the fix so the doc and code remain consistent.
| <Callout type="warn">Inline mode rewrites the file content directly with `" | ||
| ".join(src)`. There is no backup file, formatting pass, or conflict detection. Use `--diff` first if you want a review step or if the file may have been edited concurrently.</Callout> |
There was a problem hiding this comment.
Callout contains a broken code literal for inline write behavior.
Line 68–69 splits the join expression and renders awkwardly. Use a single inline snippet.
Suggested doc correction
-<Callout type="warn">Inline mode rewrites the file content directly with `"
-".join(src)`. There is no backup file, formatting pass, or conflict detection. Use `--diff` first if you want a review step or if the file may have been edited concurrently.</Callout>
+<Callout type="warn">Inline mode rewrites the file content directly with `"\n".join(src)`. There is no backup file, formatting pass, or conflict detection. Use `--diff` first if you want a review step or if the file may have been edited concurrently.</Callout>🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/codedocs/edit-modes.md` around lines 68 - 69, The callout currently
breaks the inline join expression across two lines (shows a quote on one line
and .join(src) on the next); update the callout text in edit-modes.md so the
inline snippet is a single, continuous literal showing an empty-string join of
src (replace the broken split `" " .join(src)` with a single inline snippet for
the empty-string join), ensuring the sentence reads smoothly and uses one inline
code span for the join expression.
|
|
||
| <Callout type="info">`crepr` is published as a Python package, so installation uses Python package managers rather than npm.</Callout> | ||
|
|
||
| " "poetry"]}> |
There was a problem hiding this comment.
Fix broken MDX Tabs opening tag (parse/render blocker).
Line 36 is malformed (" "poetry"]}>) and will likely break page rendering/build for this doc. Please restore the full <Tabs ...> opening tag.
Proposed fix
-" "poetry"]}>
+<Tabs items={["pip", "uv", "pipx", "poetry"]}>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| " "poetry"]}> | |
| <Tabs items={["pip", "uv", "pipx", "poetry"]}> |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/codedocs/index.md` at line 36, The MDX Tabs opening tag is malformed at
the fragment `" "poetry"]}>`; restore the full opening tag for the Tabs
component (the <Tabs ...> element) so the MDX parser can render; locate the
broken token near the existing Tabs usage in docs/codedocs/index.md (search for
`" "poetry"]}>` or the surrounding closing tag) and replace it with the correct
opening tag including its expected attributes (e.g., the full <Tabs value={...}
onChange={...}> or whatever attributes the other Tabs usage in this file
expects) so the Tabs block is syntactically valid.
| It then iterates through the inspected constructor parameters, skipping `self`. Named parameters become fragments like `f"name={self.name!r}, "`. A `VAR_KEYWORD` parameter becomes a placeholder fragment like `f"**{},` by default, or another token if `--kwarg-splat` changes the placeholder. | ||
|
|
There was a problem hiding this comment.
Malformed placeholder example for VAR_KEYWORD output.
Line 31 has a broken literal (f"**{},) which is hard to parse. Use a valid fragment shape matching the actual generated line.
Suggested doc correction
-It then iterates through the inspected constructor parameters, skipping `self`. Named parameters become fragments like `f"name={self.name!r}, "`. A `VAR_KEYWORD` parameter becomes a placeholder fragment like `f"**{},` by default, or another token if `--kwarg-splat` changes the placeholder.
+It then iterates through the inspected constructor parameters, skipping `self`. Named parameters become fragments like `f"name={self.name!r}, "`. A `VAR_KEYWORD` parameter becomes a placeholder fragment like `f"**{},'"` by default (rendered as `f'**{},'` in generated code), or another token if `--kwarg-splat` changes the placeholder.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| It then iterates through the inspected constructor parameters, skipping `self`. Named parameters become fragments like `f"name={self.name!r}, "`. A `VAR_KEYWORD` parameter becomes a placeholder fragment like `f"**{},` by default, or another token if `--kwarg-splat` changes the placeholder. | |
| It then iterates through the inspected constructor parameters, skipping `self`. Named parameters become fragments like `f"name={self.name!r}, "`. A `VAR_KEYWORD` parameter becomes a placeholder fragment like `f"**{},'"` by default (rendered as `f'**{},'` in generated code), or another token if `--kwarg-splat` changes the placeholder. |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/codedocs/repr-generation.md` around lines 31 - 32, The doc contains a
malformed fragment for VAR_KEYWORD output (the broken literal starting with
f"**{},) — replace that with a valid fragment that mirrors the named-parameter
pattern by inserting the VAR_KEYWORD parameter name (and proper
quoting/representation when appropriate) plus the trailing comma and space so
the example matches actual generated output and reflects the --kwarg-splat
option behavior.
Auto-generated Code Documentation
AI-analyzed source code to produce structured documentation including:
Browse the documentation →
Generated by Context7 · View docs
Summary by Sourcery
Add comprehensive auto-generated documentation for crepr’s architecture, concepts, and public API, including CLI usage and repr-generation workflows.
Documentation:
Summary by CodeRabbit
__repr__implementations.