docstringify 0.5.1__tar.gz → 0.7.0__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 (44) hide show
  1. docstringify-0.7.0/.github/pull_request_template.md +14 -0
  2. {docstringify-0.5.1 → docstringify-0.7.0}/.github/workflows/ci.yml +2 -2
  3. {docstringify-0.5.1 → docstringify-0.7.0}/.github/workflows/pypi-publish.yml +4 -4
  4. {docstringify-0.5.1 → docstringify-0.7.0}/.pre-commit-config.yaml +13 -1
  5. docstringify-0.7.0/CODE_OF_CONDUCT.md +128 -0
  6. docstringify-0.7.0/CONTRIBUTING.md +54 -0
  7. {docstringify-0.5.1 → docstringify-0.7.0}/PKG-INFO +7 -9
  8. {docstringify-0.5.1 → docstringify-0.7.0}/README.md +5 -5
  9. {docstringify-0.5.1 → docstringify-0.7.0}/pyproject.toml +18 -3
  10. {docstringify-0.5.1 → docstringify-0.7.0}/src/docstringify/__init__.py +1 -1
  11. {docstringify-0.5.1 → docstringify-0.7.0}/src/docstringify/cli.py +53 -20
  12. {docstringify-0.5.1 → docstringify-0.7.0}/src/docstringify/converters/__init__.py +2 -0
  13. docstringify-0.7.0/src/docstringify/converters/base.py +251 -0
  14. docstringify-0.7.0/src/docstringify/converters/google.py +140 -0
  15. docstringify-0.7.0/src/docstringify/converters/numpydoc.py +141 -0
  16. docstringify-0.7.0/src/docstringify/converters/stub.py +121 -0
  17. {docstringify-0.5.1 → docstringify-0.7.0}/src/docstringify/nodes/base.py +6 -4
  18. {docstringify-0.5.1 → docstringify-0.7.0}/src/docstringify/nodes/function.py +13 -3
  19. {docstringify-0.5.1 → docstringify-0.7.0}/src/docstringify/traversal/transformer.py +51 -2
  20. docstringify-0.7.0/src/docstringify/traversal/visitor.py +285 -0
  21. {docstringify-0.5.1 → docstringify-0.7.0}/src/docstringify.egg-info/PKG-INFO +7 -9
  22. {docstringify-0.5.1 → docstringify-0.7.0}/src/docstringify.egg-info/SOURCES.txt +4 -0
  23. docstringify-0.5.1/src/docstringify/converters/base.py +0 -92
  24. docstringify-0.5.1/src/docstringify/converters/google.py +0 -54
  25. docstringify-0.5.1/src/docstringify/converters/numpydoc.py +0 -55
  26. docstringify-0.5.1/src/docstringify/traversal/visitor.py +0 -99
  27. {docstringify-0.5.1 → docstringify-0.7.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  28. {docstringify-0.5.1 → docstringify-0.7.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  29. {docstringify-0.5.1 → docstringify-0.7.0}/.github/dependabot.yml +0 -0
  30. {docstringify-0.5.1 → docstringify-0.7.0}/.github/release.yml +0 -0
  31. {docstringify-0.5.1 → docstringify-0.7.0}/.github/workflows/greetings.yml +0 -0
  32. {docstringify-0.5.1 → docstringify-0.7.0}/.gitignore +0 -0
  33. {docstringify-0.5.1 → docstringify-0.7.0}/.pre-commit-hooks.yaml +0 -0
  34. {docstringify-0.5.1 → docstringify-0.7.0}/LICENSE +0 -0
  35. {docstringify-0.5.1 → docstringify-0.7.0}/setup.cfg +0 -0
  36. {docstringify-0.5.1 → docstringify-0.7.0}/src/docstringify/__main__.py +0 -0
  37. {docstringify-0.5.1 → docstringify-0.7.0}/src/docstringify/components.py +0 -0
  38. {docstringify-0.5.1 → docstringify-0.7.0}/src/docstringify/exceptions.py +0 -0
  39. {docstringify-0.5.1 → docstringify-0.7.0}/src/docstringify/nodes/__init__.py +0 -0
  40. {docstringify-0.5.1 → docstringify-0.7.0}/src/docstringify/traversal/__init__.py +0 -0
  41. {docstringify-0.5.1 → docstringify-0.7.0}/src/docstringify.egg-info/dependency_links.txt +0 -0
  42. {docstringify-0.5.1 → docstringify-0.7.0}/src/docstringify.egg-info/entry_points.txt +0 -0
  43. {docstringify-0.5.1 → docstringify-0.7.0}/src/docstringify.egg-info/requires.txt +0 -0
  44. {docstringify-0.5.1 → docstringify-0.7.0}/src/docstringify.egg-info/top_level.txt +0 -0
@@ -0,0 +1,14 @@
1
+ <!-- Which issue does this address? -->
2
+ Fixes #
3
+
4
+ **Describe your changes**
5
+
6
+ <!-- TODO -->
7
+
8
+ **Checklist**
9
+
10
+ <!-- Place an X between the [ ] for completed tasks -->
11
+
12
+ - [ ] Test cases have been modified/added to cover any code changes.
13
+ - [ ] Docstrings have been modified/created for any code changes.
14
+ - [ ] All linting and formatting checks pass (see the [contributing guidelines](https://github.com/stefmolin/docstringify/blob/main/CONTRIBUTING.md) for more information).
@@ -41,13 +41,13 @@ jobs:
41
41
  fail-fast: false
42
42
  matrix:
43
43
  os: [macos-latest, ubuntu-latest, windows-latest]
44
- python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
44
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
45
45
 
46
46
  steps:
47
47
  - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
48
48
 
49
49
  - name: Set up Python ${{ matrix.python-version }}
50
- uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
50
+ uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
51
51
  with:
52
52
  python-version: ${{ matrix.python-version }}
53
53
 
@@ -12,7 +12,7 @@ jobs:
12
12
  steps:
13
13
  - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
14
14
  - name: Set up Python
15
- uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
15
+ uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
16
16
  with:
17
17
  python-version: "3.x"
18
18
  - name: Install pypa/build
@@ -44,7 +44,7 @@ jobs:
44
44
 
45
45
  steps:
46
46
  - name: Download all the dists
47
- uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
47
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
48
48
  with:
49
49
  name: python-package-distributions
50
50
  path: dist/
@@ -65,7 +65,7 @@ jobs:
65
65
 
66
66
  steps:
67
67
  - name: Download all the dists
68
- uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
68
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
69
69
  with:
70
70
  name: python-package-distributions
71
71
  path: dist/
@@ -110,7 +110,7 @@ jobs:
110
110
 
111
111
  steps:
112
112
  - name: Download all the dists
113
- uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
113
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
114
114
  with:
115
115
  name: python-package-distributions
116
116
  path: dist/
@@ -11,8 +11,14 @@ repos:
11
11
  - id: end-of-file-fixer
12
12
  - id: trailing-whitespace
13
13
 
14
+ - repo: https://github.com/stefmolin/docstringify
15
+ rev: 0.6.0
16
+ hooks:
17
+ - id: docstringify
18
+ args: [--make-changes-inplace=numpydoc]
19
+
14
20
  - repo: https://github.com/astral-sh/ruff-pre-commit
15
- rev: v0.11.2
21
+ rev: v0.11.9
16
22
  hooks:
17
23
  - id: ruff
18
24
  args: [--fix, --exit-non-zero-on-fix, --show-fixes]
@@ -23,3 +29,9 @@ repos:
23
29
  hooks:
24
30
  - id: pyproject-fmt
25
31
  args: [--keep-full-version, --no-print-diff]
32
+
33
+ - repo: https://github.com/numpy/numpydoc
34
+ rev: v1.8.0
35
+ hooks:
36
+ - id: numpydoc-validation
37
+ exclude: (tests|docs)/.*
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ docstringify-coc@stefaniemolin.com.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
@@ -0,0 +1,54 @@
1
+ # Contributing Guidelines
2
+
3
+ Contributions are welcome. Please adhere to the following process.
4
+
5
+ ## 1. Open an issue
6
+ Open up an issue describing in detail the bug or feature request you are proposing. Be sure to fill out all the information requested in the template. Please wait for confirmation from a maintainer that this unit of work is in line with the project's roadmap *before* submitting a pull request.
7
+
8
+ ## 2. Work on your changes
9
+ Once you have been given the go ahead, you can start working on the code. Start by forking the project, cloning locally, and then creating a branch to work on. You will need to then install main dependencies as well as the `dev` dependencies, which can be done by running the following command:
10
+
11
+ ```shell
12
+ $ pip install -e '.[dev]'
13
+ ```
14
+
15
+ Set up the pre-commit hooks to make sure you can pass the CI checks:
16
+
17
+ ```shell
18
+ $ pre-commit install
19
+ ```
20
+
21
+ All commits will be squashed, so just make sure that the final commit passes all linting, documentation, and testing checks. These will run in GitHub Actions when you open a pull request, but you should also run them locally:
22
+
23
+ ```shell
24
+ $ pre-commit run --all-files # linting and documentation checks
25
+ $ pytest # run the test suite
26
+ ```
27
+
28
+ Some things to remember:
29
+
30
+ - All code must be documented using docstrings in the [numpydoc style](https://numpydoc.readthedocs.io/en/latest/format.html) &ndash; the pre-commit hooks will check for this.
31
+ - Any changes to the API must be accompanied by either an additional test case or a new test. Run `pytest` to make sure your changes are covered.
32
+
33
+ ## 3. Open a pull request
34
+
35
+ Once you have finished with the task you are working on and all the checks and tests pass, you can create a pull request. Please consult [GitHub's guide on how to do this](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork), if you need some guidance.
36
+
37
+ In your description, please do the following:
38
+ 1. Link to the corresponding issue for this unit of work.
39
+ 2. Describe what you changed and why.
40
+ 3. Include, if applicable, any testing instructions.
41
+
42
+ When you create your pull request, first-time contributors will need to wait for a maintainer to approve running the GitHub Actions workflows. Please be patient until this happens.
43
+
44
+ Once it does, the same checks described above (testing, documentation, linting) that you ran on your machine will run on Linux, macOS, and Windows with multiple versions of Python. Please note that it is possible that differences in operating systems and/or Python versions results in a failure, despite it working on your machine.
45
+
46
+ If anything fails, please attempt to fix it as we're unlikely to review your code until everything passes. If stuck, please feel free to leave a note in the pull request enumerating what you have already tried and someone may be able to offer assistance.
47
+
48
+ ## 4. Code review
49
+
50
+ After all checks in your pull request pass, a maintainer will review your code. In many cases, there will be some feedback to address, and this may require a few iterations to get to the best implementation. Remember to be patient and polite during this process.
51
+
52
+ ## 5. Congratulations!
53
+
54
+ When the pull request is approved, it will be merged into the `main` branch. Users of this project won't have your changes until the next release is made.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: docstringify
3
- Version: 0.5.1
3
+ Version: 0.7.0
4
4
  Summary: Flag missing docstrings and, optionally, generate them from signatures and type annotations.
5
5
  Author-email: Stefanie Molin <docstringify@stefaniemolin.com>
6
6
  License: MIT License
@@ -30,16 +30,14 @@ Project-URL: Homepage, https://github.com/stefmolin/docstringify
30
30
  Project-URL: Source, https://github.com/stefmolin/docstringify
31
31
  Keywords: ast,docstring generation,google-style docstring,numpydoc-style docstring,pre-commit
32
32
  Classifier: Development Status :: 3 - Alpha
33
- Classifier: License :: OSI Approved :: MIT License
34
33
  Classifier: Programming Language :: Python
35
34
  Classifier: Programming Language :: Python :: 3 :: Only
36
- Classifier: Programming Language :: Python :: 3.8
37
35
  Classifier: Programming Language :: Python :: 3.9
38
36
  Classifier: Programming Language :: Python :: 3.10
39
37
  Classifier: Programming Language :: Python :: 3.11
40
38
  Classifier: Programming Language :: Python :: 3.12
41
39
  Classifier: Programming Language :: Python :: 3.13
42
- Requires-Python: >=3.8
40
+ Requires-Python: >=3.9
43
41
  Description-Content-Type: text/markdown
44
42
  License-File: LICENSE
45
43
  Provides-Extra: dev
@@ -109,7 +107,7 @@ Add the following to your `.pre-commit-config.yaml` file to block commits with m
109
107
 
110
108
  ```yaml
111
109
  - repo: https://github.com/stefmolin/docstringify
112
- rev: 0.5.1
110
+ rev: 0.7.0
113
111
  hooks:
114
112
  - id: docstringify
115
113
  ```
@@ -118,17 +116,17 @@ By default, all docstrings are required. If you want to be more lenient, you can
118
116
 
119
117
  ```yaml
120
118
  - repo: https://github.com/stefmolin/docstringify
121
- rev: 0.5.1
119
+ rev: 0.7.0
122
120
  hooks:
123
121
  - id: docstringify
124
122
  args: [--threshold=0.75]
125
123
  ```
126
124
 
127
- If you would like to see suggested docstring templates (inferred from type annotations for functions and methods), provide the `--suggest-changes` argument, along with the docstring style you want to use (options are `google` and `numpydoc`). Here, we ask for [numpydoc-style docstring](https://numpydoc.readthedocs.io/en/latest/format.html#) suggestions:
125
+ If you would like to see suggested docstring templates (inferred from type annotations for functions and methods), provide the `--suggest-changes` argument, along with the docstring style you want to use (options are `google`, `numpydoc`, and `stub`). Here, we ask for [numpydoc-style docstring](https://numpydoc.readthedocs.io/en/latest/format.html#) suggestions:
128
126
 
129
127
  ```yaml
130
128
  - repo: https://github.com/stefmolin/docstringify
131
- rev: 0.5.1
129
+ rev: 0.7.0
132
130
  hooks:
133
131
  - id: docstringify
134
132
  args: [--suggest-changes=numpydoc]
@@ -138,7 +136,7 @@ Use `--make-changes` to create a copy of each file with docstring templates. Her
138
136
 
139
137
  ```yaml
140
138
  - repo: https://github.com/stefmolin/docstringify
141
- rev: 0.5.1
139
+ rev: 0.7.0
142
140
  hooks:
143
141
  - id: docstringify
144
142
  args: [--make-changes=google]
@@ -58,7 +58,7 @@ Add the following to your `.pre-commit-config.yaml` file to block commits with m
58
58
 
59
59
  ```yaml
60
60
  - repo: https://github.com/stefmolin/docstringify
61
- rev: 0.5.1
61
+ rev: 0.7.0
62
62
  hooks:
63
63
  - id: docstringify
64
64
  ```
@@ -67,17 +67,17 @@ By default, all docstrings are required. If you want to be more lenient, you can
67
67
 
68
68
  ```yaml
69
69
  - repo: https://github.com/stefmolin/docstringify
70
- rev: 0.5.1
70
+ rev: 0.7.0
71
71
  hooks:
72
72
  - id: docstringify
73
73
  args: [--threshold=0.75]
74
74
  ```
75
75
 
76
- If you would like to see suggested docstring templates (inferred from type annotations for functions and methods), provide the `--suggest-changes` argument, along with the docstring style you want to use (options are `google` and `numpydoc`). Here, we ask for [numpydoc-style docstring](https://numpydoc.readthedocs.io/en/latest/format.html#) suggestions:
76
+ If you would like to see suggested docstring templates (inferred from type annotations for functions and methods), provide the `--suggest-changes` argument, along with the docstring style you want to use (options are `google`, `numpydoc`, and `stub`). Here, we ask for [numpydoc-style docstring](https://numpydoc.readthedocs.io/en/latest/format.html#) suggestions:
77
77
 
78
78
  ```yaml
79
79
  - repo: https://github.com/stefmolin/docstringify
80
- rev: 0.5.1
80
+ rev: 0.7.0
81
81
  hooks:
82
82
  - id: docstringify
83
83
  args: [--suggest-changes=numpydoc]
@@ -87,7 +87,7 @@ Use `--make-changes` to create a copy of each file with docstring templates. Her
87
87
 
88
88
  ```yaml
89
89
  - repo: https://github.com/stefmolin/docstringify
90
- rev: 0.5.1
90
+ rev: 0.7.0
91
91
  hooks:
92
92
  - id: docstringify
93
93
  args: [--make-changes=google]
@@ -21,13 +21,11 @@ license = { file = "LICENSE" }
21
21
  authors = [
22
22
  { name = "Stefanie Molin", email = "docstringify@stefaniemolin.com" },
23
23
  ]
24
- requires-python = ">=3.8"
24
+ requires-python = ">=3.9"
25
25
  classifiers = [
26
26
  "Development Status :: 3 - Alpha",
27
- "License :: OSI Approved :: MIT License",
28
27
  "Programming Language :: Python",
29
28
  "Programming Language :: Python :: 3 :: Only",
30
- "Programming Language :: Python :: 3.8",
31
29
  "Programming Language :: Python :: 3.9",
32
30
  "Programming Language :: Python :: 3.10",
33
31
  "Programming Language :: Python :: 3.11",
@@ -94,3 +92,20 @@ lint.extend-per-file-ignores."tests/*" = [ "ANN" ] # don't require annotations f
94
92
  lint.isort.known-first-party = [
95
93
  "docstringify",
96
94
  ]
95
+
96
+ [tool.numpydoc_validation]
97
+ checks = [
98
+ "all", # report on all checks
99
+ "ES01", # but don't require an extended summary
100
+ "EX01", # or examples
101
+ "SA01", # or a see also section
102
+ "SS06", # and don't require the summary to fit on one line
103
+ ]
104
+ exclude = [ # don't report on checks for these
105
+ '\.__init__$',
106
+ '\.__repr__$',
107
+ '\.__str__$',
108
+ ]
109
+ override_SS05 = [ # override SS05 to allow docstrings starting with these words
110
+ '^Process ',
111
+ ]
@@ -3,4 +3,4 @@ Flag missing docstrings and, optionally, generate them from signatures and
3
3
  type annotations.
4
4
  """
5
5
 
6
- __version__ = '0.5.1'
6
+ __version__ = '0.7.0'
@@ -1,29 +1,60 @@
1
+ """CLI for Docstringify."""
2
+
1
3
  from __future__ import annotations
2
4
 
3
5
  import argparse
4
6
  import sys
5
7
  from functools import partial
6
- from typing import Sequence
8
+ from typing import TYPE_CHECKING
7
9
 
10
+ from . import __doc__ as pkg_description
8
11
  from . import __version__
9
- from .converters import GoogleDocstringConverter, NumpydocDocstringConverter
12
+ from .converters import (
13
+ GoogleDocstringConverter,
14
+ NumpydocDocstringConverter,
15
+ StubDocstringConverter,
16
+ )
10
17
  from .traversal import DocstringTransformer, DocstringVisitor
11
18
 
12
- PROG = __package__
19
+ if TYPE_CHECKING:
20
+ from collections.abc import Sequence
21
+
13
22
 
14
- STYLES = {
23
+ PROG = __package__
24
+ STYLES: dict[
25
+ str,
26
+ type[GoogleDocstringConverter]
27
+ | type[NumpydocDocstringConverter]
28
+ | type[StubDocstringConverter],
29
+ ] = {
15
30
  'google': GoogleDocstringConverter,
16
31
  'numpydoc': NumpydocDocstringConverter,
32
+ 'stub': StubDocstringConverter,
17
33
  }
18
34
  CLI_DEFAULTS = {'threshold': 1.0}
19
35
 
20
36
 
21
37
  def main(argv: Sequence[str] | None = None) -> int:
22
- parser = argparse.ArgumentParser(prog=PROG)
38
+ """
39
+ Flag missing docstrings and, optionally, generate them from signatures and
40
+ type annotations.
41
+
42
+ Parameters
43
+ ----------
44
+ argv : Sequence[str] | None, default=None
45
+ The arguments passed on the command line.
46
+
47
+ Returns
48
+ -------
49
+ int
50
+ Exit code for the process, where non-zero values indicate errors, and ``1``
51
+ indicates that more than the allowed percentage of docstrings were missing.
52
+ """
53
+
54
+ parser = argparse.ArgumentParser(prog=PROG, description=pkg_description)
55
+ parser.add_argument('filenames', nargs='*', help='Filenames to process')
23
56
  parser.add_argument(
24
- 'filenames',
25
- nargs='*',
26
- help='Filenames to process',
57
+ '-v', '--verbose', action='store_true', help='Run in verbose mode'
27
58
  )
28
59
  parser.add_argument(
29
60
  '--version', action='version', version=f'%(prog)s {__version__}'
@@ -57,19 +88,19 @@ def main(argv: Sequence[str] | None = None) -> int:
57
88
  )
58
89
  args = parser.parse_args(argv)
59
90
 
60
- if style := args.make_changes or args.make_changes_inplace or args.suggest_changes:
61
- converter = STYLES[style]
62
- else:
63
- converter = None
64
-
65
91
  get_docstring_processor = (
66
92
  partial(
67
93
  DocstringTransformer,
68
- converter=converter,
69
- **{'overwrite': bool(args.make_changes_inplace)},
94
+ converter=STYLES[style],
95
+ overwrite=bool(args.make_changes_inplace),
96
+ verbose=args.verbose,
97
+ )
98
+ if (style := args.make_changes or args.make_changes_inplace)
99
+ else partial(
100
+ DocstringVisitor,
101
+ converter=STYLES.get(args.suggest_changes),
102
+ verbose=args.verbose,
70
103
  )
71
- if args.make_changes or args.make_changes_inplace
72
- else partial(DocstringVisitor, converter=converter)
73
104
  )
74
105
 
75
106
  docstrings_processed = missing_docstrings = 0
@@ -79,9 +110,11 @@ def main(argv: Sequence[str] | None = None) -> int:
79
110
  missing_docstrings += len(processor.missing_docstrings)
80
111
  docstrings_processed += processor.docstrings_inspected
81
112
 
82
- if docstrings_processed and (
83
- missing_percentage := (missing_docstrings / docstrings_processed)
84
- ) > (1 - args.threshold):
113
+ if (
114
+ docstrings_processed
115
+ and (missing_percentage := (missing_docstrings / docstrings_processed))
116
+ > 1 - args.threshold
117
+ ):
85
118
  print(f'Missing {missing_percentage:.0%} of docstrings', file=sys.stderr)
86
119
  print(
87
120
  f'Your settings require {args.threshold:.0%} of docstrings to be present',
@@ -3,9 +3,11 @@
3
3
  from .base import DocstringConverter
4
4
  from .google import GoogleDocstringConverter
5
5
  from .numpydoc import NumpydocDocstringConverter
6
+ from .stub import StubDocstringConverter
6
7
 
7
8
  __all__ = [
8
9
  'DocstringConverter',
9
10
  'GoogleDocstringConverter',
10
11
  'NumpydocDocstringConverter',
12
+ 'StubDocstringConverter',
11
13
  ]