code2docs 3.0.3__tar.gz → 3.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. {code2docs-3.0.3 → code2docs-3.0.4}/PKG-INFO +3 -3
  2. {code2docs-3.0.3 → code2docs-3.0.4}/README.md +2 -2
  3. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/__init__.py +1 -1
  4. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/generators/examples_gen.py +21 -15
  5. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs.egg-info/PKG-INFO +3 -3
  6. {code2docs-3.0.3 → code2docs-3.0.4}/pyproject.toml +1 -1
  7. {code2docs-3.0.3 → code2docs-3.0.4}/LICENSE +0 -0
  8. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/__main__.py +0 -0
  9. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/analyzers/__init__.py +0 -0
  10. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/analyzers/dependency_scanner.py +0 -0
  11. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/analyzers/docstring_extractor.py +0 -0
  12. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/analyzers/endpoint_detector.py +0 -0
  13. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/analyzers/project_scanner.py +0 -0
  14. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/base.py +0 -0
  15. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/cli.py +0 -0
  16. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/config.py +0 -0
  17. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/examples/advanced_usage.py +0 -0
  18. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/examples/quickstart.py +0 -0
  19. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/formatters/__init__.py +0 -0
  20. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/formatters/badges.py +0 -0
  21. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/formatters/markdown.py +0 -0
  22. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/formatters/toc.py +0 -0
  23. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/generators/__init__.py +0 -0
  24. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/generators/_registry_adapters.py +0 -0
  25. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/generators/_source_links.py +0 -0
  26. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/generators/api_changelog_gen.py +0 -0
  27. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/generators/api_reference_gen.py +0 -0
  28. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/generators/architecture_gen.py +0 -0
  29. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/generators/changelog_gen.py +0 -0
  30. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/generators/code2llm_gen.py +0 -0
  31. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/generators/config_docs_gen.py +0 -0
  32. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/generators/contributing_gen.py +0 -0
  33. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/generators/coverage_gen.py +0 -0
  34. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/generators/depgraph_gen.py +0 -0
  35. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/generators/getting_started_gen.py +0 -0
  36. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/generators/mkdocs_gen.py +0 -0
  37. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/generators/module_docs_gen.py +0 -0
  38. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/generators/readme_gen.py +0 -0
  39. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/llm_helper.py +0 -0
  40. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/registry.py +0 -0
  41. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/sync/__init__.py +0 -0
  42. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/sync/differ.py +0 -0
  43. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/sync/updater.py +0 -0
  44. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/sync/watcher.py +0 -0
  45. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/templates/api_module.md.j2 +0 -0
  46. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/templates/architecture.md.j2 +0 -0
  47. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/templates/example_usage.py.j2 +0 -0
  48. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/templates/index.md.j2 +0 -0
  49. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/templates/module_doc.md.j2 +0 -0
  50. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs/templates/readme.md.j2 +0 -0
  51. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs.egg-info/SOURCES.txt +0 -0
  52. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs.egg-info/dependency_links.txt +0 -0
  53. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs.egg-info/entry_points.txt +0 -0
  54. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs.egg-info/requires.txt +0 -0
  55. {code2docs-3.0.3 → code2docs-3.0.4}/code2docs.egg-info/top_level.txt +0 -0
  56. {code2docs-3.0.3 → code2docs-3.0.4}/setup.cfg +0 -0
  57. {code2docs-3.0.3 → code2docs-3.0.4}/tests/test_analyzers.py +0 -0
  58. {code2docs-3.0.3 → code2docs-3.0.4}/tests/test_cli.py +0 -0
  59. {code2docs-3.0.3 → code2docs-3.0.4}/tests/test_code2docs.py +0 -0
  60. {code2docs-3.0.3 → code2docs-3.0.4}/tests/test_config.py +0 -0
  61. {code2docs-3.0.3 → code2docs-3.0.4}/tests/test_formatters.py +0 -0
  62. {code2docs-3.0.3 → code2docs-3.0.4}/tests/test_generators.py +0 -0
  63. {code2docs-3.0.3 → code2docs-3.0.4}/tests/test_llm_helper.py +0 -0
  64. {code2docs-3.0.3 → code2docs-3.0.4}/tests/test_registry.py +0 -0
  65. {code2docs-3.0.3 → code2docs-3.0.4}/tests/test_sync.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code2docs
3
- Version: 3.0.3
3
+ Version: 3.0.4
4
4
  Summary: Auto-generate and sync project documentation from source code analysis
5
5
  Author-email: Tom Sapletta <tom@sapletta.com>
6
6
  License-Expression: Apache-2.0
@@ -50,7 +50,7 @@ Dynamic: license-file
50
50
 
51
51
  # code2docs
52
52
 
53
- ![version](https://img.shields.io/badge/version-3.0.3-blue) ![python](https://img.shields.io/badge/python-%3E%3D3.9-blue) ![docs](https://img.shields.io/badge/docs-auto--generated-blueviolet)
53
+ ![version](https://img.shields.io/badge/version-3.0.4-blue) ![python](https://img.shields.io/badge/python-%3E%3D3.9-blue) ![docs](https://img.shields.io/badge/docs-auto--generated-blueviolet)
54
54
 
55
55
  > Auto-generate and sync project documentation from source code analysis.
56
56
 
@@ -190,7 +190,7 @@ code2docs can update only specific sections of an existing README using markers:
190
190
  ```markdown
191
191
  <!-- code2docs:start --># code2docs
192
192
 
193
- ![version](https://img.shields.io/badge/version-3.0.3-blue) ![python](https://img.shields.io/badge/python-%3E%3D3.9-blue) ![coverage](https://img.shields.io/badge/coverage-unknown-lightgrey) ![functions](https://img.shields.io/badge/functions-276-green)
193
+ ![version](https://img.shields.io/badge/version-3.0.4-blue) ![python](https://img.shields.io/badge/python-%3E%3D3.9-blue) ![coverage](https://img.shields.io/badge/coverage-unknown-lightgrey) ![functions](https://img.shields.io/badge/functions-276-green)
194
194
  > **276** functions | **57** classes | **51** files | CC̄ = 3.8
195
195
 
196
196
  > Auto-generated project documentation from source code analysis.
@@ -1,6 +1,6 @@
1
1
  # code2docs
2
2
 
3
- ![version](https://img.shields.io/badge/version-3.0.3-blue) ![python](https://img.shields.io/badge/python-%3E%3D3.9-blue) ![docs](https://img.shields.io/badge/docs-auto--generated-blueviolet)
3
+ ![version](https://img.shields.io/badge/version-3.0.4-blue) ![python](https://img.shields.io/badge/python-%3E%3D3.9-blue) ![docs](https://img.shields.io/badge/docs-auto--generated-blueviolet)
4
4
 
5
5
  > Auto-generate and sync project documentation from source code analysis.
6
6
 
@@ -140,7 +140,7 @@ code2docs can update only specific sections of an existing README using markers:
140
140
  ```markdown
141
141
  <!-- code2docs:start --># code2docs
142
142
 
143
- ![version](https://img.shields.io/badge/version-3.0.3-blue) ![python](https://img.shields.io/badge/python-%3E%3D3.9-blue) ![coverage](https://img.shields.io/badge/coverage-unknown-lightgrey) ![functions](https://img.shields.io/badge/functions-276-green)
143
+ ![version](https://img.shields.io/badge/version-3.0.4-blue) ![python](https://img.shields.io/badge/python-%3E%3D3.9-blue) ![coverage](https://img.shields.io/badge/coverage-unknown-lightgrey) ![functions](https://img.shields.io/badge/functions-276-green)
144
144
  > **276** functions | **57** classes | **51** files | CC̄ = 3.8
145
145
 
146
146
  > Auto-generated project documentation from source code analysis.
@@ -5,7 +5,7 @@ Uses code2llm's AnalysisResult to produce human-readable documentation:
5
5
  README.md, API references, module docs, examples, and architecture diagrams.
6
6
  """
7
7
 
8
- __version__ = "3.0.3"
8
+ __version__ = "3.0.4"
9
9
  __author__ = "Tom Sapletta"
10
10
 
11
11
  from .config import Code2DocsConfig
@@ -138,15 +138,18 @@ class ExamplesGenerator:
138
138
 
139
139
  # --- Example 1: Config (define first so later examples can use it) ---
140
140
  config_cls = self._find_class_by_name("Code2DocsConfig")
141
+ project_name = self.config.project_name or Path(self.result.project_path).name
142
+ source = self.config.source or "./"
143
+ output = self.config.output or "./docs"
141
144
  if config_cls:
142
145
  lines.append('# ' + '=' * 50)
143
146
  lines.append("# Example 1: Configuration")
144
147
  lines.append('# ' + '=' * 50)
145
148
  lines.append("")
146
149
  lines.append(f"config = {config_cls.name}(")
147
- lines.append(' project_name="my-project",')
148
- lines.append(' source="./src",')
149
- lines.append(' output="./docs",')
150
+ lines.append(f' project_name="{project_name}",')
151
+ lines.append(f' source="{source}",')
152
+ lines.append(f' output="{output}",')
150
153
  lines.append(" verbose=True,")
151
154
  lines.append(")")
152
155
  lines.append("")
@@ -157,20 +160,22 @@ class ExamplesGenerator:
157
160
  lines.append("# Example 2: Generate documentation")
158
161
  lines.append('# ' + '=' * 50)
159
162
  lines.append("")
163
+
164
+ project_path = f'"./{project_name}"' if project_name != "." else '"./"'
160
165
 
161
166
  gen_func = self._find_function_by_name("generate_readme")
162
167
  if gen_func:
163
168
  lines.append("# Generate a README for your project")
164
- lines.append('generate_readme("./my-project", output="README.md")')
169
+ lines.append(f'generate_readme({project_path}, output="README.md")')
165
170
  lines.append("")
166
171
 
167
172
  docs_func = self._find_function_by_name("generate_docs")
168
173
  if docs_func:
169
174
  lines.append("# Generate all documentation")
170
175
  if config_cls:
171
- lines.append('docs = generate_docs("./my-project", config=config)')
176
+ lines.append(f'docs = generate_docs({project_path}, config=config)')
172
177
  else:
173
- lines.append('docs = generate_docs("./my-project")')
178
+ lines.append(f'docs = generate_docs({project_path})')
174
179
  lines.append('print(f"Generated {len(docs)} documentation sections")')
175
180
  lines.append("")
176
181
 
@@ -185,7 +190,7 @@ class ExamplesGenerator:
185
190
  lines.append(f"from {pkg}.analyzers.project_scanner import ProjectScanner")
186
191
  lines.append("")
187
192
  lines.append("scanner = ProjectScanner(config)")
188
- lines.append('result = scanner.analyze("./my-project")')
193
+ lines.append(f'result = scanner.analyze({project_path})')
189
194
  lines.append("")
190
195
  lines.append('print(f"Found {len(result.functions)} functions")')
191
196
  lines.append('print(f"Found {len(result.classes)} classes")')
@@ -229,7 +234,7 @@ class ExamplesGenerator:
229
234
  lines.append("# Step 1: Analyze the project")
230
235
  lines.append("config = Code2DocsConfig(project_name=\"my-project\")")
231
236
  lines.append("scanner = ProjectScanner(config)")
232
- lines.append('result = scanner.analyze("./my-project")')
237
+ lines.append('result = scanner.analyze(f"./${project_name_adv}") if project_name_adv != "." else result = scanner.analyze("./")')
233
238
  lines.append("")
234
239
 
235
240
  for i, cls in enumerate(gen_classes[:4], start=2):
@@ -389,8 +394,8 @@ class ExamplesGenerator:
389
394
  args = [a for a in func.args if a not in ("self", "cls")]
390
395
  parts = []
391
396
  for arg in args[:5]:
392
- val = _ARG_EXAMPLES.get(arg)
393
- if not val:
397
+ val = self._get_example_value(arg)
398
+ if not val or val == '"..."':
394
399
  # Try type hint
395
400
  val = self._example_from_type(func, arg)
396
401
  if not val:
@@ -398,17 +403,18 @@ class ExamplesGenerator:
398
403
  parts.append(f"{arg}={val}" if len(args) > 1 else val)
399
404
  return ", ".join(parts)
400
405
 
401
- @staticmethod
402
- def _example_from_type(func: FunctionInfo, arg: str) -> Optional[str]:
406
+ def _example_from_type(self, func: FunctionInfo, arg: str) -> Optional[str]:
403
407
  """Try to infer example value from type annotation."""
408
+ project_name = self.config.project_name or Path(self.result.project_path).name
409
+
404
410
  # FunctionInfo.returns gives return type, but arg types
405
411
  # are not always available; use naming heuristics
406
412
  if "path" in arg.lower():
407
- return '"./my-project"'
413
+ return f'"./{project_name}"'
408
414
  if "name" in arg.lower():
409
- return '"my-project"'
415
+ return f'"{project_name}"'
410
416
  if "dir" in arg.lower():
411
- return '"./docs"'
417
+ return f'"{self.config.output}"' if self.config.output else '"./docs"'
412
418
  if arg.startswith("is_") or arg.startswith("enable"):
413
419
  return "True"
414
420
  if "count" in arg.lower() or "max" in arg.lower() or "min" in arg.lower():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code2docs
3
- Version: 3.0.3
3
+ Version: 3.0.4
4
4
  Summary: Auto-generate and sync project documentation from source code analysis
5
5
  Author-email: Tom Sapletta <tom@sapletta.com>
6
6
  License-Expression: Apache-2.0
@@ -50,7 +50,7 @@ Dynamic: license-file
50
50
 
51
51
  # code2docs
52
52
 
53
- ![version](https://img.shields.io/badge/version-3.0.3-blue) ![python](https://img.shields.io/badge/python-%3E%3D3.9-blue) ![docs](https://img.shields.io/badge/docs-auto--generated-blueviolet)
53
+ ![version](https://img.shields.io/badge/version-3.0.4-blue) ![python](https://img.shields.io/badge/python-%3E%3D3.9-blue) ![docs](https://img.shields.io/badge/docs-auto--generated-blueviolet)
54
54
 
55
55
  > Auto-generate and sync project documentation from source code analysis.
56
56
 
@@ -190,7 +190,7 @@ code2docs can update only specific sections of an existing README using markers:
190
190
  ```markdown
191
191
  <!-- code2docs:start --># code2docs
192
192
 
193
- ![version](https://img.shields.io/badge/version-3.0.3-blue) ![python](https://img.shields.io/badge/python-%3E%3D3.9-blue) ![coverage](https://img.shields.io/badge/coverage-unknown-lightgrey) ![functions](https://img.shields.io/badge/functions-276-green)
193
+ ![version](https://img.shields.io/badge/version-3.0.4-blue) ![python](https://img.shields.io/badge/python-%3E%3D3.9-blue) ![coverage](https://img.shields.io/badge/coverage-unknown-lightgrey) ![functions](https://img.shields.io/badge/functions-276-green)
194
194
  > **276** functions | **57** classes | **51** files | CC̄ = 3.8
195
195
 
196
196
  > Auto-generated project documentation from source code analysis.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "code2docs"
7
- version = "3.0.3"
7
+ version = "3.0.4"
8
8
  description = "Auto-generate and sync project documentation from source code analysis"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes