Generate Docstrings with type-hint information.
Project description
Docstring Generator Extension
docstring_generator_ext is a high-performance Python extension written in C++ (using pybind11) designed to automatically generate and inject docstrings into Python source files. It leverages Python's ast module to extract type-hint information and function signatures to create well-formatted docstrings in various styles.
Features
- Automatic Docstring Injection: Parses Python files and inserts docstrings for functions and methods.
- Type-Hint Awareness: Extracts type information from annotations and default values.
- Multiple Styles: Supports popular docstring formats:
- reST (reStructuredText)
- Google style
- NumPy style
- High Performance: Core logic implemented in C++ for fast processing.
- Preserves Existing Content: Can update existing docstrings while trying to preserve manually added descriptions (using a special
$marker convention).
Installation
Prerequisites
- Python 3.13 or higher
- A C++ compiler with C++20 support (e.g., GCC, Clang, or MSVC)
pybind11
Building from Source
-
Clone the repository:
git clone https://github.com/FelixTheC/docstring_generator_ext.git cd docstring_generator_ext
-
Install the
buildpackage:pip install build
-
Build the package:
python -m build
-
Install the built wheel:
pip install dist/docstring_generator_ext-*.whl
Usage
After installation, you can use the extension in your Python scripts:
import docstring_generator_ext
# Path to the Python file you want to process
file_path = "path/to/your_script.py"
# Choose a style: GOOGLE, NUMPY, or reST
style = docstring_generator_ext.DocstringFormatStyle.GOOGLE
# Generate and inject docstrings
docstring_generator_ext.parse_file(file_path, style)
Docstring Styles
The extension provides an enum DocstringFormatStyle to choose the desired output:
docstring_generator_ext.DocstringFormatStyle.reSTdocstring_generator_ext.DocstringFormatStyle.GOOGLEdocstring_generator_ext.DocstringFormatStyle.NUMPY
Authors
- FelixTheC
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file docstring_generator_ext-1.0.2.tar.gz.
File metadata
- Download URL: docstring_generator_ext-1.0.2.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
543972de250d5343e1ccfca426cb393e7c4ac38df5e3a9ae8039220a13f968d0
|
|
| MD5 |
c2a3d58586f0fbbc1d661d4d28ee3873
|
|
| BLAKE2b-256 |
44e6093358d1064fde675a2842b42efedf7702a4255328529ec9e67331759218
|
Provenance
The following attestation bundles were made for docstring_generator_ext-1.0.2.tar.gz:
Publisher:
python-publish-ext.yml on FelixTheC/docstring_generator_ext
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
docstring_generator_ext-1.0.2.tar.gz -
Subject digest:
543972de250d5343e1ccfca426cb393e7c4ac38df5e3a9ae8039220a13f968d0 - Sigstore transparency entry: 1535242927
- Sigstore integration time:
-
Permalink:
FelixTheC/docstring_generator_ext@09af4f843819eac4ed4f6af0a3fc27ad3a8f0434 -
Branch / Tag:
refs/tags/1.0.2 - Owner: https://github.com/FelixTheC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish-ext.yml@09af4f843819eac4ed4f6af0a3fc27ad3a8f0434 -
Trigger Event:
release
-
Statement type:
File details
Details for the file docstring_generator_ext-1.0.2-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: docstring_generator_ext-1.0.2-cp314-cp314-win_amd64.whl
- Upload date:
- Size: 137.8 kB
- Tags: CPython 3.14, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
506888c8a131fa4d907db200fb9f43841a6f3ada9e9f9be1539ee93475420ae2
|
|
| MD5 |
477d82766082a09f672c2fa74d5e718b
|
|
| BLAKE2b-256 |
f374636286d6684d32b03d828ae8cf7365ee2740b514ccfa1498126abab2167c
|
Provenance
The following attestation bundles were made for docstring_generator_ext-1.0.2-cp314-cp314-win_amd64.whl:
Publisher:
python-publish-ext.yml on FelixTheC/docstring_generator_ext
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
docstring_generator_ext-1.0.2-cp314-cp314-win_amd64.whl -
Subject digest:
506888c8a131fa4d907db200fb9f43841a6f3ada9e9f9be1539ee93475420ae2 - Sigstore transparency entry: 1535243837
- Sigstore integration time:
-
Permalink:
FelixTheC/docstring_generator_ext@09af4f843819eac4ed4f6af0a3fc27ad3a8f0434 -
Branch / Tag:
refs/tags/1.0.2 - Owner: https://github.com/FelixTheC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish-ext.yml@09af4f843819eac4ed4f6af0a3fc27ad3a8f0434 -
Trigger Event:
release
-
Statement type:
File details
Details for the file docstring_generator_ext-1.0.2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: docstring_generator_ext-1.0.2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 182.5 kB
- Tags: CPython 3.14, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
988cef69cb98a5c2f6471c74584fd176feb2a8e5da8a44deba36a9e622834966
|
|
| MD5 |
5576242cc16bcda8e26b853d737432cf
|
|
| BLAKE2b-256 |
03ddd654a4f1bac8eb17bbd9e1e42622f713379a2aceca7367b61516ea823e6d
|
Provenance
The following attestation bundles were made for docstring_generator_ext-1.0.2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
python-publish-ext.yml on FelixTheC/docstring_generator_ext
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
docstring_generator_ext-1.0.2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
988cef69cb98a5c2f6471c74584fd176feb2a8e5da8a44deba36a9e622834966 - Sigstore transparency entry: 1535243727
- Sigstore integration time:
-
Permalink:
FelixTheC/docstring_generator_ext@09af4f843819eac4ed4f6af0a3fc27ad3a8f0434 -
Branch / Tag:
refs/tags/1.0.2 - Owner: https://github.com/FelixTheC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish-ext.yml@09af4f843819eac4ed4f6af0a3fc27ad3a8f0434 -
Trigger Event:
release
-
Statement type:
File details
Details for the file docstring_generator_ext-1.0.2-cp314-cp314-macosx_11_0_arm64.whl.
File metadata
- Download URL: docstring_generator_ext-1.0.2-cp314-cp314-macosx_11_0_arm64.whl
- Upload date:
- Size: 156.8 kB
- Tags: CPython 3.14, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec237b534ed6bd9ccdae9323412a9b0c44c7511d0261de706b2dac52cd017c21
|
|
| MD5 |
aeb9aa0c68557d7e992ffecfbedd596d
|
|
| BLAKE2b-256 |
e86785d3bda0759be367cf62b25a73e350188ce22295649815a6938b7dabf332
|
Provenance
The following attestation bundles were made for docstring_generator_ext-1.0.2-cp314-cp314-macosx_11_0_arm64.whl:
Publisher:
python-publish-ext.yml on FelixTheC/docstring_generator_ext
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
docstring_generator_ext-1.0.2-cp314-cp314-macosx_11_0_arm64.whl -
Subject digest:
ec237b534ed6bd9ccdae9323412a9b0c44c7511d0261de706b2dac52cd017c21 - Sigstore transparency entry: 1535243975
- Sigstore integration time:
-
Permalink:
FelixTheC/docstring_generator_ext@09af4f843819eac4ed4f6af0a3fc27ad3a8f0434 -
Branch / Tag:
refs/tags/1.0.2 - Owner: https://github.com/FelixTheC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish-ext.yml@09af4f843819eac4ed4f6af0a3fc27ad3a8f0434 -
Trigger Event:
release
-
Statement type:
File details
Details for the file docstring_generator_ext-1.0.2-cp314-cp314-macosx_10_15_x86_64.whl.
File metadata
- Download URL: docstring_generator_ext-1.0.2-cp314-cp314-macosx_10_15_x86_64.whl
- Upload date:
- Size: 166.4 kB
- Tags: CPython 3.14, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
791125ce7f8fa47e630de4d3c836e426b6a440adbe5797f6453c9ae4c41f3459
|
|
| MD5 |
4be168964d13b2b35c1c6d90172f6a90
|
|
| BLAKE2b-256 |
6503b5cabb4c8b56b930a189218764b526808739f7d2ac1194e74b0064b61896
|
Provenance
The following attestation bundles were made for docstring_generator_ext-1.0.2-cp314-cp314-macosx_10_15_x86_64.whl:
Publisher:
python-publish-ext.yml on FelixTheC/docstring_generator_ext
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
docstring_generator_ext-1.0.2-cp314-cp314-macosx_10_15_x86_64.whl -
Subject digest:
791125ce7f8fa47e630de4d3c836e426b6a440adbe5797f6453c9ae4c41f3459 - Sigstore transparency entry: 1535244157
- Sigstore integration time:
-
Permalink:
FelixTheC/docstring_generator_ext@09af4f843819eac4ed4f6af0a3fc27ad3a8f0434 -
Branch / Tag:
refs/tags/1.0.2 - Owner: https://github.com/FelixTheC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish-ext.yml@09af4f843819eac4ed4f6af0a3fc27ad3a8f0434 -
Trigger Event:
release
-
Statement type:
File details
Details for the file docstring_generator_ext-1.0.2-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: docstring_generator_ext-1.0.2-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 134.2 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2940ea96baa52eedea6df851fab2e40e7aff2f6cb9d306f3351520fbb998b71
|
|
| MD5 |
d5bba03ba92ada91b92b4f6bf8bd237a
|
|
| BLAKE2b-256 |
30ef1d26380c254344829442cc9c1085e0f264e88587559425cff34950ab660b
|
Provenance
The following attestation bundles were made for docstring_generator_ext-1.0.2-cp313-cp313-win_amd64.whl:
Publisher:
python-publish-ext.yml on FelixTheC/docstring_generator_ext
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
docstring_generator_ext-1.0.2-cp313-cp313-win_amd64.whl -
Subject digest:
f2940ea96baa52eedea6df851fab2e40e7aff2f6cb9d306f3351520fbb998b71 - Sigstore transparency entry: 1535243564
- Sigstore integration time:
-
Permalink:
FelixTheC/docstring_generator_ext@09af4f843819eac4ed4f6af0a3fc27ad3a8f0434 -
Branch / Tag:
refs/tags/1.0.2 - Owner: https://github.com/FelixTheC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish-ext.yml@09af4f843819eac4ed4f6af0a3fc27ad3a8f0434 -
Trigger Event:
release
-
Statement type:
File details
Details for the file docstring_generator_ext-1.0.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: docstring_generator_ext-1.0.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 182.4 kB
- Tags: CPython 3.13, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48d158d3e83981e8a53f81eff454257e2db0b55565354d0bc7c4ee51eb050386
|
|
| MD5 |
8f7ba1a0bd104bb40c94515b0e4774ae
|
|
| BLAKE2b-256 |
b8d810912a72ab77cc7cadd78938ab71176704b0aae4311d75e49a7a72bff9f8
|
Provenance
The following attestation bundles were made for docstring_generator_ext-1.0.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
python-publish-ext.yml on FelixTheC/docstring_generator_ext
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
docstring_generator_ext-1.0.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
48d158d3e83981e8a53f81eff454257e2db0b55565354d0bc7c4ee51eb050386 - Sigstore transparency entry: 1535243404
- Sigstore integration time:
-
Permalink:
FelixTheC/docstring_generator_ext@09af4f843819eac4ed4f6af0a3fc27ad3a8f0434 -
Branch / Tag:
refs/tags/1.0.2 - Owner: https://github.com/FelixTheC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish-ext.yml@09af4f843819eac4ed4f6af0a3fc27ad3a8f0434 -
Trigger Event:
release
-
Statement type:
File details
Details for the file docstring_generator_ext-1.0.2-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: docstring_generator_ext-1.0.2-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 156.5 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e0d5af15a93ce7c546c886f5c00625be3fa0f1bb6a2a3866c6aa009f7358a98
|
|
| MD5 |
4664cdc48198f4e6fdf6487a3aaa9bc3
|
|
| BLAKE2b-256 |
f895194b9a84c48dd211b02843765cb4479b9a8fd780f4a8ddf29d462a4b016f
|
Provenance
The following attestation bundles were made for docstring_generator_ext-1.0.2-cp313-cp313-macosx_11_0_arm64.whl:
Publisher:
python-publish-ext.yml on FelixTheC/docstring_generator_ext
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
docstring_generator_ext-1.0.2-cp313-cp313-macosx_11_0_arm64.whl -
Subject digest:
5e0d5af15a93ce7c546c886f5c00625be3fa0f1bb6a2a3866c6aa009f7358a98 - Sigstore transparency entry: 1535243099
- Sigstore integration time:
-
Permalink:
FelixTheC/docstring_generator_ext@09af4f843819eac4ed4f6af0a3fc27ad3a8f0434 -
Branch / Tag:
refs/tags/1.0.2 - Owner: https://github.com/FelixTheC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish-ext.yml@09af4f843819eac4ed4f6af0a3fc27ad3a8f0434 -
Trigger Event:
release
-
Statement type:
File details
Details for the file docstring_generator_ext-1.0.2-cp313-cp313-macosx_10_13_x86_64.whl.
File metadata
- Download URL: docstring_generator_ext-1.0.2-cp313-cp313-macosx_10_13_x86_64.whl
- Upload date:
- Size: 166.4 kB
- Tags: CPython 3.13, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ad9d0dfb9621643c269a41dc1daeee9ced3d5fe476aae011aa64b4f1a2f9912
|
|
| MD5 |
35be0460d601950a75aea04592d3e369
|
|
| BLAKE2b-256 |
f0ffbf220728830d83a743b71133e55f1b675a8b3f03411c1471561a74afa61e
|
Provenance
The following attestation bundles were made for docstring_generator_ext-1.0.2-cp313-cp313-macosx_10_13_x86_64.whl:
Publisher:
python-publish-ext.yml on FelixTheC/docstring_generator_ext
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
docstring_generator_ext-1.0.2-cp313-cp313-macosx_10_13_x86_64.whl -
Subject digest:
5ad9d0dfb9621643c269a41dc1daeee9ced3d5fe476aae011aa64b4f1a2f9912 - Sigstore transparency entry: 1535243271
- Sigstore integration time:
-
Permalink:
FelixTheC/docstring_generator_ext@09af4f843819eac4ed4f6af0a3fc27ad3a8f0434 -
Branch / Tag:
refs/tags/1.0.2 - Owner: https://github.com/FelixTheC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish-ext.yml@09af4f843819eac4ed4f6af0a3fc27ad3a8f0434 -
Trigger Event:
release
-
Statement type: