docstring-generator 2.1.0__tar.gz → 2.1.1__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 (17) hide show
  1. docstring_generator-2.1.1/LICENSE +13 -0
  2. docstring_generator-2.1.1/NOTICE +25 -0
  3. {docstring_generator-2.1.0/src/docstring_generator.egg-info → docstring_generator-2.1.1}/PKG-INFO +64 -3
  4. docstring_generator-2.1.0/PKG-INFO → docstring_generator-2.1.1/README.md +58 -18
  5. {docstring_generator-2.1.0 → docstring_generator-2.1.1}/pyproject.toml +14 -8
  6. {docstring_generator-2.1.0 → docstring_generator-2.1.1}/src/docstring_generator/new_gen_docs.py +38 -3
  7. docstring_generator-2.1.0/README.md → docstring_generator-2.1.1/src/docstring_generator.egg-info/PKG-INFO +79 -2
  8. {docstring_generator-2.1.0 → docstring_generator-2.1.1}/src/docstring_generator.egg-info/SOURCES.txt +2 -0
  9. docstring_generator-2.1.1/src/docstring_generator.egg-info/requires.txt +2 -0
  10. {docstring_generator-2.1.0 → docstring_generator-2.1.1}/tests/test_library.py +33 -5
  11. docstring_generator-2.1.0/src/docstring_generator.egg-info/requires.txt +0 -2
  12. {docstring_generator-2.1.0 → docstring_generator-2.1.1}/setup.cfg +0 -0
  13. {docstring_generator-2.1.0 → docstring_generator-2.1.1}/src/docstring_generator/__init__.py +0 -0
  14. {docstring_generator-2.1.0 → docstring_generator-2.1.1}/src/docstring_generator/output.py +0 -0
  15. {docstring_generator-2.1.0 → docstring_generator-2.1.1}/src/docstring_generator.egg-info/dependency_links.txt +0 -0
  16. {docstring_generator-2.1.0 → docstring_generator-2.1.1}/src/docstring_generator.egg-info/entry_points.txt +0 -0
  17. {docstring_generator-2.1.0 → docstring_generator-2.1.1}/src/docstring_generator.egg-info/top_level.txt +0 -0
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2026 FelixTheC
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -0,0 +1,25 @@
1
+ Docstring Generator
2
+
3
+ Copyright (c) 2026 FelixTheC
4
+
5
+ This product is licensed under the Apache License, Version 2.0.
6
+ You may obtain a copy of the License at:
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ Third-party attributions
17
+ ------------------------
18
+ If you include third-party libraries or other content that require
19
+ attribution, list them here with their license and a short note. For
20
+ example:
21
+
22
+ - SomeLibrary — MIT License — https://example.org/somelibrary
23
+
24
+ (If you don't have any third-party attributions to declare, you can
25
+ leave this section as-is or remove it.)
@@ -1,18 +1,23 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: docstring-generator
3
- Version: 2.1.0
3
+ Version: 2.1.1
4
4
  Summary: Auto generate docstring from type-hints.
5
5
  Author: FelixTheC
6
+ License: Apache-2.0
6
7
  Project-URL: Repository, https://github.com/FelixTheC/docstring_generator
7
8
  Classifier: Environment :: Console
8
9
  Classifier: Programming Language :: Python :: 3
9
10
  Classifier: Topic :: Utilities
10
11
  Classifier: Topic :: Software Development :: Documentation
11
12
  Classifier: Typing :: Typed
13
+ Classifier: License :: OSI Approved :: Apache Software License
12
14
  Requires-Python: >=3.13
13
15
  Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ License-File: NOTICE
14
18
  Requires-Dist: click==8.4.2
15
- Requires-Dist: docstring-generator-ext>=2.0.4
19
+ Requires-Dist: docstring-generator-ext>=2.0.9
20
+ Dynamic: license-file
16
21
 
17
22
  [![Python 3.10](https://img.shields.io/badge/python-3-blue.svg)](https://www.python.org/downloads/)
18
23
  [![PyPI version](https://badge.fury.io/py/docstring-generator.svg)](https://badge.fury.io/py/docstring-generator)
@@ -20,6 +25,8 @@ Requires-Dist: docstring-generator-ext>=2.0.4
20
25
  [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
21
26
  [![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
22
27
  [![](https://img.shields.io/pypi/dm/docstring-generator.svg)](https://pypi.org/project/docstring-generator/)
28
+ [![VS Code Extension](https://img.shields.io/badge/VS%20Code-Extension-007ACC?logo=visualstudiocode&logoColor=white)](https://marketplace.visualstudio.com/items?itemName=felixthec.docstring-generator-vscode)
29
+ [![JetBrains File Watcher](https://img.shields.io/badge/JetBrains-File%20Watcher-000000?logo=jetbrains&logoColor=white)](gendocs_file_watchers.xml)
23
30
 
24
31
  # docstring_generator
25
32
 
@@ -62,6 +69,8 @@ gendocs_new mydir/ # entire directory
62
69
 
63
70
  That's it. Your functions now have properly formatted docstrings.
64
71
 
72
+ > 💡 **Prefer working inside your editor?** Skip the terminal entirely — install the [VS Code extension](https://marketplace.visualstudio.com/items?itemName=felixthec.docstring-generator-vscode) or import the [JetBrains File Watcher](#jetbrains-ides-pycharm-intellij--python-plugin) to generate docstrings automatically every time you save a `.py` file. → [Jump to IDE Integration](#ide-integration)
73
+
65
74
  ---
66
75
 
67
76
  ## Options
@@ -382,6 +391,57 @@ hooks:
382
391
 
383
392
  ---
384
393
 
394
+ ## IDE Integration
395
+
396
+ ### VS Code Extension
397
+
398
+ Install the [docstring-generator VS Code extension](https://marketplace.visualstudio.com/items?itemName=felixthec.docstring-generator-vscode) from the marketplace to generate docstrings directly from the editor — no terminal required.
399
+
400
+ **Features:**
401
+ - Right-click any `.py` file → **Generate Docstrings**
402
+ - Keyboard shortcut: `Ctrl+Shift+D` (Windows/Linux) / `Cmd+Shift+D` (macOS)
403
+ - Configurable style (`numpy`, `google`, `rest`) via VS Code settings
404
+
405
+ **Setup:**
406
+ 1. Install from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=felixthec.docstring-generator-vscode)
407
+ 2. Make sure `gendocs_new` is on your `PATH` (install `docstring-generator` via pip)
408
+ 3. Optionally configure the style in your VS Code settings:
409
+ ```json
410
+ {
411
+ "docstringGenerator.style": "google"
412
+ }
413
+ ```
414
+
415
+ ### JetBrains IDEs (PyCharm, IntelliJ + Python plugin)
416
+
417
+ Use the provided **File Watcher** configuration to automatically generate docstrings every time you save a `.py` file.
418
+
419
+ **Setup:**
420
+ 1. Copy [`gendocs_file_watchers.xml`](gendocs_file_watchers.xml) from the repository root into your project's `.idea/watcherTasks.xml` — or import it via **Settings → Tools → File Watchers → Import**.
421
+ 2. The watcher is pre-configured to:
422
+ - Run on every `.py` file in the project scope
423
+ - Use `$PROJECT_DIR$/.venv/bin/gendocs_new` as the executable (adjust the path if your venv lives elsewhere)
424
+ - Pass `--style numpy $FilePath$` by default — change `numpy` to `google` or `rest` as needed
425
+ - Write the result back to the same file (`$FilePath$`)
426
+
427
+ ```xml
428
+ <TaskOptions>
429
+ <TaskOptions>
430
+ <option name="arguments" value="--style numpy $FilePath$" />
431
+ <option name="fileExtension" value="py" />
432
+ <option name="name" value="gendocs_new" />
433
+ <option name="output" value="$FilePath$" />
434
+ <option name="program" value="$PROJECT_DIR$/.venv/bin/gendocs_new" />
435
+ <option name="scopeName" value="Project Files" />
436
+ <option name="workingDir" value="$FileDir$" />
437
+ </TaskOptions>
438
+ </TaskOptions>
439
+ ```
440
+
441
+ > **Tip:** Combine the File Watcher with `--ignore-magic` or `pyproject.toml` configuration to tailor which methods are documented automatically on save.
442
+
443
+ ---
444
+
385
445
  ## FAQ
386
446
 
387
447
  ### What happens if I re-run docstring generation?
@@ -428,10 +488,11 @@ Planned features and areas of investment:
428
488
 
429
489
  ### Medium-term
430
490
 
491
+ - [x] File Watcher configuration for JetBrains IDEs (PyCharm) — import `gendocs_file_watchers.xml` to auto-generate docstrings on every file save
492
+ - [x] VS Code extension — available on the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=felixthec.docstring-generator-vscode)
431
493
  - [ ] GitHub Action — publish a ready-to-use Action to the Marketplace so teams can enforce docstring coverage in CI without any local installation
432
494
  - [ ] Coverage badge generation (`--badge`) — produce an SVG badge from `--check` results to embed in README, similar to a test-coverage badge
433
495
  - [ ] JUnit/SARIF output for `--check` — emit machine-readable results for GitHub, GitLab, and Azure DevOps CI panels; enables PR annotations that highlight undocumented functions inline
434
- - [ ] IDE plugin support (JetBrains, VS Code)
435
496
 
436
497
  ### Longer-term
437
498
 
@@ -1,25 +1,11 @@
1
- Metadata-Version: 2.4
2
- Name: docstring-generator
3
- Version: 2.1.0
4
- Summary: Auto generate docstring from type-hints.
5
- Author: FelixTheC
6
- Project-URL: Repository, https://github.com/FelixTheC/docstring_generator
7
- Classifier: Environment :: Console
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Topic :: Utilities
10
- Classifier: Topic :: Software Development :: Documentation
11
- Classifier: Typing :: Typed
12
- Requires-Python: >=3.13
13
- Description-Content-Type: text/markdown
14
- Requires-Dist: click==8.4.2
15
- Requires-Dist: docstring-generator-ext>=2.0.4
16
-
17
1
  [![Python 3.10](https://img.shields.io/badge/python-3-blue.svg)](https://www.python.org/downloads/)
18
2
  [![PyPI version](https://badge.fury.io/py/docstring-generator.svg)](https://badge.fury.io/py/docstring-generator)
19
3
  ![Actions](https://github.com/FelixTheC/docstring_generator/actions/workflows/python-app.yml/badge.svg)
20
4
  [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
21
5
  [![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
22
6
  [![](https://img.shields.io/pypi/dm/docstring-generator.svg)](https://pypi.org/project/docstring-generator/)
7
+ [![VS Code Extension](https://img.shields.io/badge/VS%20Code-Extension-007ACC?logo=visualstudiocode&logoColor=white)](https://marketplace.visualstudio.com/items?itemName=felixthec.docstring-generator-vscode)
8
+ [![JetBrains File Watcher](https://img.shields.io/badge/JetBrains-File%20Watcher-000000?logo=jetbrains&logoColor=white)](gendocs_file_watchers.xml)
23
9
 
24
10
  # docstring_generator
25
11
 
@@ -62,6 +48,8 @@ gendocs_new mydir/ # entire directory
62
48
 
63
49
  That's it. Your functions now have properly formatted docstrings.
64
50
 
51
+ > 💡 **Prefer working inside your editor?** Skip the terminal entirely — install the [VS Code extension](https://marketplace.visualstudio.com/items?itemName=felixthec.docstring-generator-vscode) or import the [JetBrains File Watcher](#jetbrains-ides-pycharm-intellij--python-plugin) to generate docstrings automatically every time you save a `.py` file. → [Jump to IDE Integration](#ide-integration)
52
+
65
53
  ---
66
54
 
67
55
  ## Options
@@ -382,6 +370,57 @@ hooks:
382
370
 
383
371
  ---
384
372
 
373
+ ## IDE Integration
374
+
375
+ ### VS Code Extension
376
+
377
+ Install the [docstring-generator VS Code extension](https://marketplace.visualstudio.com/items?itemName=felixthec.docstring-generator-vscode) from the marketplace to generate docstrings directly from the editor — no terminal required.
378
+
379
+ **Features:**
380
+ - Right-click any `.py` file → **Generate Docstrings**
381
+ - Keyboard shortcut: `Ctrl+Shift+D` (Windows/Linux) / `Cmd+Shift+D` (macOS)
382
+ - Configurable style (`numpy`, `google`, `rest`) via VS Code settings
383
+
384
+ **Setup:**
385
+ 1. Install from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=felixthec.docstring-generator-vscode)
386
+ 2. Make sure `gendocs_new` is on your `PATH` (install `docstring-generator` via pip)
387
+ 3. Optionally configure the style in your VS Code settings:
388
+ ```json
389
+ {
390
+ "docstringGenerator.style": "google"
391
+ }
392
+ ```
393
+
394
+ ### JetBrains IDEs (PyCharm, IntelliJ + Python plugin)
395
+
396
+ Use the provided **File Watcher** configuration to automatically generate docstrings every time you save a `.py` file.
397
+
398
+ **Setup:**
399
+ 1. Copy [`gendocs_file_watchers.xml`](gendocs_file_watchers.xml) from the repository root into your project's `.idea/watcherTasks.xml` — or import it via **Settings → Tools → File Watchers → Import**.
400
+ 2. The watcher is pre-configured to:
401
+ - Run on every `.py` file in the project scope
402
+ - Use `$PROJECT_DIR$/.venv/bin/gendocs_new` as the executable (adjust the path if your venv lives elsewhere)
403
+ - Pass `--style numpy $FilePath$` by default — change `numpy` to `google` or `rest` as needed
404
+ - Write the result back to the same file (`$FilePath$`)
405
+
406
+ ```xml
407
+ <TaskOptions>
408
+ <TaskOptions>
409
+ <option name="arguments" value="--style numpy $FilePath$" />
410
+ <option name="fileExtension" value="py" />
411
+ <option name="name" value="gendocs_new" />
412
+ <option name="output" value="$FilePath$" />
413
+ <option name="program" value="$PROJECT_DIR$/.venv/bin/gendocs_new" />
414
+ <option name="scopeName" value="Project Files" />
415
+ <option name="workingDir" value="$FileDir$" />
416
+ </TaskOptions>
417
+ </TaskOptions>
418
+ ```
419
+
420
+ > **Tip:** Combine the File Watcher with `--ignore-magic` or `pyproject.toml` configuration to tailor which methods are documented automatically on save.
421
+
422
+ ---
423
+
385
424
  ## FAQ
386
425
 
387
426
  ### What happens if I re-run docstring generation?
@@ -428,10 +467,11 @@ Planned features and areas of investment:
428
467
 
429
468
  ### Medium-term
430
469
 
470
+ - [x] File Watcher configuration for JetBrains IDEs (PyCharm) — import `gendocs_file_watchers.xml` to auto-generate docstrings on every file save
471
+ - [x] VS Code extension — available on the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=felixthec.docstring-generator-vscode)
431
472
  - [ ] GitHub Action — publish a ready-to-use Action to the Marketplace so teams can enforce docstring coverage in CI without any local installation
432
473
  - [ ] Coverage badge generation (`--badge`) — produce an SVG badge from `--check` results to embed in README, similar to a test-coverage badge
433
474
  - [ ] JUnit/SARIF output for `--check` — emit machine-readable results for GitHub, GitLab, and Azure DevOps CI panels; enables PR annotations that highlight undocumented functions inline
434
- - [ ] IDE plugin support (JetBrains, VS Code)
435
475
 
436
476
  ### Longer-term
437
477
 
@@ -455,4 +495,4 @@ Follows [Semantic Versioning](https://semver.org/). See the [tags](../../tags) f
455
495
 
456
496
  ## License
457
497
 
458
- MIT License — free to use in personal and commercial projects.
498
+ MIT License — free to use in personal and commercial projects.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "docstring-generator"
3
- version = "2.1.0"
3
+ version = "2.1.1"
4
4
  description = "Auto generate docstring from type-hints."
5
5
  authors = [
6
6
  { name = "FelixTheC" },
@@ -8,17 +8,21 @@ authors = [
8
8
  readme = "README.md"
9
9
  requires-python = ">=3.13"
10
10
 
11
+ # License metadata
12
+ license = { text = "Apache-2.0" }
13
+
11
14
  classifiers=[
12
15
  "Environment :: Console",
13
16
  "Programming Language :: Python :: 3",
14
17
  "Topic :: Utilities",
15
18
  "Topic :: Software Development :: Documentation",
16
19
  "Typing :: Typed",
20
+ "License :: OSI Approved :: Apache Software License",
17
21
  ]
18
22
 
19
23
  dependencies = [
20
24
  "click == 8.4.2",
21
- "docstring-generator-ext>=2.0.4",
25
+ "docstring-generator-ext>=2.0.9",
22
26
  ]
23
27
 
24
28
  [dependency-groups]
@@ -26,7 +30,7 @@ dev = [
26
30
  "pytest>=9.1.1",
27
31
  "pytest-cov>=7.1.0",
28
32
  "ruff==0.15.21",
29
- "fastapi==0.139.0",
33
+ "fastapi==0.140.0",
30
34
  "sqlalchemy==2.0.51"
31
35
  ]
32
36
 
@@ -36,11 +40,6 @@ no-binary-package = ["docstring-generator-ext"]
36
40
  [tool.uv.extra-build-variables]
37
41
  docstring-generator-ext = { MACOSX_DEPLOYMENT_TARGET = "13.3", CXXFLAGS = "-std=c++20", CL = "/std:c++20" }
38
42
 
39
- [tool.poetry.group.dev.dependencies]
40
- black = ">=22.8,<25.0"
41
- isort = "^5.10.1"
42
- pytest = "^7.1.3"
43
-
44
43
  [project.urls]
45
44
  Repository = "https://github.com/FelixTheC/docstring_generator"
46
45
 
@@ -57,3 +56,10 @@ exclude = ["tests"]
57
56
 
58
57
  [project.scripts]
59
58
  gendocs_new = "docstring_generator.new_gen_docs:main"
59
+
60
+ # Ensure non-code files like NOTICE are included in sdist/wheel
61
+ [tool.setuptools]
62
+ include-package-data = true
63
+
64
+ [tool.setuptools.data-files]
65
+ "doc" = ["NOTICE"]
@@ -21,6 +21,14 @@ def find_pyproject_toml(start_paths: tuple[str, ...]) -> pathlib.Path | None:
21
21
  """
22
22
  Walks up parent directories from the target files/directories
23
23
  to discover the project root's pyproject.toml.
24
+
25
+ Parameters
26
+ ----------
27
+ start_paths : tuple[str, Ellipsis] [Argument]
28
+
29
+ Returns
30
+ -------
31
+ Union[pathlib.Path, None]
24
32
  """
25
33
  # Fallback to current working directory if no paths passed
26
34
  base_path = (
@@ -39,7 +47,15 @@ def find_pyproject_toml(start_paths: tuple[str, ...]) -> pathlib.Path | None:
39
47
 
40
48
 
41
49
  def load_toml_config(config_path: pathlib.Path | None) -> dict:
42
- """Finds and parses configuration options from pyproject.toml."""
50
+ """Finds and parses configuration options from pyproject.toml.
51
+ Parameters
52
+ ----------
53
+ config_path : Union[pathlib.Path, None] [Argument]
54
+
55
+ Returns
56
+ -------
57
+ dict
58
+ """
43
59
  if not config_path or not config_path.exists():
44
60
  return {}
45
61
 
@@ -95,6 +111,25 @@ def main(
95
111
  ignore_magic: bool,
96
112
  changed_only: bool,
97
113
  ) -> None:
114
+ """
115
+ Parameters
116
+ ----------
117
+ paths : tuple[str, Ellipsis] [Argument]
118
+ style : str [Argument]
119
+ check : bool [Argument]
120
+ strict : bool [Argument]
121
+ threshold : Union[int, None] [Argument]
122
+ exclude_file : list[str] [Argument]
123
+ exclude_dir : list[str] [Argument]
124
+ overwrite_style : bool [Argument]
125
+ dry_run : bool [Argument]
126
+ ignore_magic : bool [Argument]
127
+ changed_only : bool [Argument]
128
+
129
+ Returns
130
+ -------
131
+ None
132
+ """
98
133
  docstring_style = STYLE_MAP[style]
99
134
 
100
135
  config = load_toml_config(find_pyproject_toml(paths))
@@ -102,7 +137,7 @@ def main(
102
137
  _threshold = threshold or config.get("threshold", 100)
103
138
  _exclude_files = config.get("exclude_files", [])
104
139
  _exclude_dirs = config.get("exclude_dirs", [])
105
- _ignore_magic = config.get("ignore_magic", [])
140
+ _ignore_magic = config.get("ignore_magic", False)
106
141
 
107
142
  # CLI args always wins
108
143
  if exclude_file:
@@ -167,7 +202,7 @@ def main(
167
202
  if check:
168
203
  checked_files = {
169
204
  file.absolute().as_posix(): docstring_generator_ext.check_docstring(
170
- file.absolute().as_posix()
205
+ file.absolute().as_posix(), _ignore_magic
171
206
  )
172
207
  for file in files_
173
208
  }
@@ -1,9 +1,32 @@
1
+ Metadata-Version: 2.4
2
+ Name: docstring-generator
3
+ Version: 2.1.1
4
+ Summary: Auto generate docstring from type-hints.
5
+ Author: FelixTheC
6
+ License: Apache-2.0
7
+ Project-URL: Repository, https://github.com/FelixTheC/docstring_generator
8
+ Classifier: Environment :: Console
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Topic :: Utilities
11
+ Classifier: Topic :: Software Development :: Documentation
12
+ Classifier: Typing :: Typed
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Requires-Python: >=3.13
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ License-File: NOTICE
18
+ Requires-Dist: click==8.4.2
19
+ Requires-Dist: docstring-generator-ext>=2.0.9
20
+ Dynamic: license-file
21
+
1
22
  [![Python 3.10](https://img.shields.io/badge/python-3-blue.svg)](https://www.python.org/downloads/)
2
23
  [![PyPI version](https://badge.fury.io/py/docstring-generator.svg)](https://badge.fury.io/py/docstring-generator)
3
24
  ![Actions](https://github.com/FelixTheC/docstring_generator/actions/workflows/python-app.yml/badge.svg)
4
25
  [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
5
26
  [![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
6
27
  [![](https://img.shields.io/pypi/dm/docstring-generator.svg)](https://pypi.org/project/docstring-generator/)
28
+ [![VS Code Extension](https://img.shields.io/badge/VS%20Code-Extension-007ACC?logo=visualstudiocode&logoColor=white)](https://marketplace.visualstudio.com/items?itemName=felixthec.docstring-generator-vscode)
29
+ [![JetBrains File Watcher](https://img.shields.io/badge/JetBrains-File%20Watcher-000000?logo=jetbrains&logoColor=white)](gendocs_file_watchers.xml)
7
30
 
8
31
  # docstring_generator
9
32
 
@@ -46,6 +69,8 @@ gendocs_new mydir/ # entire directory
46
69
 
47
70
  That's it. Your functions now have properly formatted docstrings.
48
71
 
72
+ > 💡 **Prefer working inside your editor?** Skip the terminal entirely — install the [VS Code extension](https://marketplace.visualstudio.com/items?itemName=felixthec.docstring-generator-vscode) or import the [JetBrains File Watcher](#jetbrains-ides-pycharm-intellij--python-plugin) to generate docstrings automatically every time you save a `.py` file. → [Jump to IDE Integration](#ide-integration)
73
+
49
74
  ---
50
75
 
51
76
  ## Options
@@ -366,6 +391,57 @@ hooks:
366
391
 
367
392
  ---
368
393
 
394
+ ## IDE Integration
395
+
396
+ ### VS Code Extension
397
+
398
+ Install the [docstring-generator VS Code extension](https://marketplace.visualstudio.com/items?itemName=felixthec.docstring-generator-vscode) from the marketplace to generate docstrings directly from the editor — no terminal required.
399
+
400
+ **Features:**
401
+ - Right-click any `.py` file → **Generate Docstrings**
402
+ - Keyboard shortcut: `Ctrl+Shift+D` (Windows/Linux) / `Cmd+Shift+D` (macOS)
403
+ - Configurable style (`numpy`, `google`, `rest`) via VS Code settings
404
+
405
+ **Setup:**
406
+ 1. Install from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=felixthec.docstring-generator-vscode)
407
+ 2. Make sure `gendocs_new` is on your `PATH` (install `docstring-generator` via pip)
408
+ 3. Optionally configure the style in your VS Code settings:
409
+ ```json
410
+ {
411
+ "docstringGenerator.style": "google"
412
+ }
413
+ ```
414
+
415
+ ### JetBrains IDEs (PyCharm, IntelliJ + Python plugin)
416
+
417
+ Use the provided **File Watcher** configuration to automatically generate docstrings every time you save a `.py` file.
418
+
419
+ **Setup:**
420
+ 1. Copy [`gendocs_file_watchers.xml`](gendocs_file_watchers.xml) from the repository root into your project's `.idea/watcherTasks.xml` — or import it via **Settings → Tools → File Watchers → Import**.
421
+ 2. The watcher is pre-configured to:
422
+ - Run on every `.py` file in the project scope
423
+ - Use `$PROJECT_DIR$/.venv/bin/gendocs_new` as the executable (adjust the path if your venv lives elsewhere)
424
+ - Pass `--style numpy $FilePath$` by default — change `numpy` to `google` or `rest` as needed
425
+ - Write the result back to the same file (`$FilePath$`)
426
+
427
+ ```xml
428
+ <TaskOptions>
429
+ <TaskOptions>
430
+ <option name="arguments" value="--style numpy $FilePath$" />
431
+ <option name="fileExtension" value="py" />
432
+ <option name="name" value="gendocs_new" />
433
+ <option name="output" value="$FilePath$" />
434
+ <option name="program" value="$PROJECT_DIR$/.venv/bin/gendocs_new" />
435
+ <option name="scopeName" value="Project Files" />
436
+ <option name="workingDir" value="$FileDir$" />
437
+ </TaskOptions>
438
+ </TaskOptions>
439
+ ```
440
+
441
+ > **Tip:** Combine the File Watcher with `--ignore-magic` or `pyproject.toml` configuration to tailor which methods are documented automatically on save.
442
+
443
+ ---
444
+
369
445
  ## FAQ
370
446
 
371
447
  ### What happens if I re-run docstring generation?
@@ -412,10 +488,11 @@ Planned features and areas of investment:
412
488
 
413
489
  ### Medium-term
414
490
 
491
+ - [x] File Watcher configuration for JetBrains IDEs (PyCharm) — import `gendocs_file_watchers.xml` to auto-generate docstrings on every file save
492
+ - [x] VS Code extension — available on the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=felixthec.docstring-generator-vscode)
415
493
  - [ ] GitHub Action — publish a ready-to-use Action to the Marketplace so teams can enforce docstring coverage in CI without any local installation
416
494
  - [ ] Coverage badge generation (`--badge`) — produce an SVG badge from `--check` results to embed in README, similar to a test-coverage badge
417
495
  - [ ] JUnit/SARIF output for `--check` — emit machine-readable results for GitHub, GitLab, and Azure DevOps CI panels; enables PR annotations that highlight undocumented functions inline
418
- - [ ] IDE plugin support (JetBrains, VS Code)
419
496
 
420
497
  ### Longer-term
421
498
 
@@ -439,4 +516,4 @@ Follows [Semantic Versioning](https://semver.org/). See the [tags](../../tags) f
439
516
 
440
517
  ## License
441
518
 
442
- MIT License — free to use in personal and commercial projects.
519
+ MIT License — free to use in personal and commercial projects.
@@ -1,3 +1,5 @@
1
+ LICENSE
2
+ NOTICE
1
3
  README.md
2
4
  pyproject.toml
3
5
  src/docstring_generator/__init__.py
@@ -0,0 +1,2 @@
1
+ click==8.4.2
2
+ docstring-generator-ext>=2.0.9
@@ -17,6 +17,11 @@ EXPECTED_FILES = {
17
17
 
18
18
  @pytest.mark.parametrize("style", ("numpy", "rest", "google"))
19
19
  def test_docstring_creation(style):
20
+ """
21
+ Parameters
22
+ ----------
23
+ style : [Argument]
24
+ """
20
25
  with NamedTemporaryFile(suffix=".py", delete=False) as tmp_file:
21
26
  tmp_path = Path(tmp_file.name)
22
27
  tmp_file.write(BASE_EXAMPLE_FILE.read_bytes())
@@ -60,6 +65,11 @@ def test_check_coverage_no_coverage():
60
65
 
61
66
  @pytest.mark.parametrize("test_file", EXPECTED_FILES.values())
62
67
  def test_check_coverage_full_coverage(test_file):
68
+ """
69
+ Parameters
70
+ ----------
71
+ test_file : [Argument]
72
+ """
63
73
  gendocs_new = Path(sys.executable).parent / "gendocs_new"
64
74
  result = subprocess.run(
65
75
  [str(gendocs_new), "--check", "--threshold", "95", str(test_file)],
@@ -79,6 +89,11 @@ def test_check_coverage_full_coverage(test_file):
79
89
  @pytest.mark.parametrize("test_file", EXPECTED_FILES.values())
80
90
  @pytest.mark.xfail
81
91
  def test_check_coverage_full_coverage_with_strict(test_file):
92
+ """
93
+ Parameters
94
+ ----------
95
+ test_file : [Argument]
96
+ """
82
97
  gendocs_new = Path(sys.executable).parent / "gendocs_new"
83
98
  result = subprocess.run(
84
99
  [str(gendocs_new), "--check", "--threshold", "95", "--strict", str(test_file)],
@@ -94,12 +109,29 @@ def test_check_coverage_full_coverage_with_strict(test_file):
94
109
 
95
110
  assert check_result["passing"]
96
111
 
112
+
113
+ @pytest.mark.parametrize("test_file", EXPECTED_FILES.values())
114
+ def test_check_coverage_full_coverage_with_ignore_magic(test_file):
115
+ """
116
+ Parameters
117
+ ----------
118
+ test_file : [Argument]
119
+ """
120
+ from docstring_generator.new_gen_docs import main
121
+ main(["--check", "--ignore-magic", "--threshold", "95", str(test_file)], standalone_mode=False)
122
+
123
+ with Path(Path.cwd(), "gendocs_check_output.json").open('r') as output_file:
124
+ import json
125
+ check_result = json.load(output_file)
126
+
127
+ assert check_result["passing"]
128
+
129
+
97
130
  # ---------------------------------------------------------------------------
98
131
  # --dry-run tests
99
132
  # ---------------------------------------------------------------------------
100
133
 
101
134
  def test_dry_run_shows_diff_and_does_not_modify_file():
102
- """--dry-run must print a unified diff but leave the original file unchanged."""
103
135
  gendocs_new = Path(sys.executable).parent / "gendocs_new"
104
136
 
105
137
  with NamedTemporaryFile(suffix=".py", delete=False) as tmp_file:
@@ -131,7 +163,6 @@ def test_dry_run_shows_diff_and_does_not_modify_file():
131
163
 
132
164
 
133
165
  def test_dry_run_reports_no_changes_for_fully_documented_file():
134
- """--dry-run should report 'no changes' for a file whose docstrings are already complete."""
135
166
  gendocs_new = Path(sys.executable).parent / "gendocs_new"
136
167
  # Use a hand-crafted, minimal fixture that is genuinely idempotent (no raises → no edge cases)
137
168
  idempotent_file = Path(__file__).parent / "files" / "idempotent_example.py"
@@ -153,7 +184,6 @@ def test_dry_run_reports_no_changes_for_fully_documented_file():
153
184
  # ---------------------------------------------------------------------------
154
185
 
155
186
  def test_changed_only_aborts_when_git_not_found():
156
- """--changed-only must exit with a non-zero code when git is not on PATH."""
157
187
  gendocs_new = Path(sys.executable).parent / "gendocs_new"
158
188
 
159
189
  with NamedTemporaryFile(suffix=".py", delete=False) as tmp_file:
@@ -183,7 +213,6 @@ def test_changed_only_aborts_when_git_not_found():
183
213
 
184
214
 
185
215
  def test_changed_only_processes_only_changed_files():
186
- """--changed-only must skip files that are not tracked as modified in git."""
187
216
  gendocs_new = Path(sys.executable).parent / "gendocs_new"
188
217
 
189
218
  with TemporaryDirectory() as tmp_dir:
@@ -243,7 +272,6 @@ def test_changed_only_processes_only_changed_files():
243
272
  # ---------------------------------------------------------------------------
244
273
 
245
274
  def test_changed_only_combined_with_dry_run():
246
- """--changed-only --dry-run must show a diff only for changed files and not modify any file."""
247
275
  gendocs_new = Path(sys.executable).parent / "gendocs_new"
248
276
 
249
277
  with TemporaryDirectory() as tmp_dir:
@@ -1,2 +0,0 @@
1
- click==8.4.2
2
- docstring-generator-ext>=2.0.4