gpt4docstrings
Project description
gpt4docstrings
Generating Python docstrings with OpenAI ChatGPT!!
What is gpt4docstrings
?
gpt4docstrings
is a library that helps you to write docstrings
for your Python code. Select a path / paths where you want gpt4docstrings
to be applied and wait for the results!!
Requirements
gpt4docstrings
supports Python 3.9 and above.
Installation
You can install gpt4docstrings via pip from PyPI:
$ pip install gpt4docstrings
Usage
Command Line Interface
The first option when using gpt4docstrings
is to use it as a Command Line Interface (CLI).
The following is an example command that generates docstrings for all the non-documented
classes / functions under src/
directory.
gpt4docstrings src/
Another quite common situation is that we want to exclude the tests/
folder, for example,
from the generation of docstrings. Doing this is very simple.
gpt4docstrings --exclude tests/ .
Lastly, you could also run gpt4docstrings
in a specific Python file.
gpt4docstrings ./src/example.py
Remember that, if you don't have your OpenAI API Key defined as an Environment Variable (OPENAI_API_KEY),
gpt4docstrings
can accept the API Key as an option.
gpt4docstrings --exclude tests/ --api_key sk-xxxxxxxxxxxx .
pre-commit hook
Another cool use of gpt4docstrings
is as a precommit
hook.
All you have to do is add it to your configuration file and you’re done!
repos:
- repo: https://github.com/MichaelisTrofficus/gpt4docstrings
rev: v0.1.0
hooks:
- id: gpt4docstrings
name: gpt4docstrings
language: python
entry: gpt4docstrings
types: [python]
Please see the Command-line Reference for more details!!
Contributing
Contributions are very welcome. To learn more, see the Contributor Guide.
License
Distributed under the terms of the MIT license, gpt4docstrings is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Credits
This project was generated from @cjolowicz's Hypermodern Python Cookiecutter template.
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 Distribution
File details
Details for the file gpt4docstrings-0.1.2.tar.gz
.
File metadata
- Download URL: gpt4docstrings-0.1.2.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 536054e2ecec1f107b10c86b86afc614264dbe54db610b7c8bc4e9d45c8000b3 |
|
MD5 | 43de14919fce736ebfc0463323736b13 |
|
BLAKE2b-256 | 2e5db25823c411d8b89a574e30d4613a4f32934186b32112373b654a0d82404b |
File details
Details for the file gpt4docstrings-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: gpt4docstrings-0.1.2-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 087ea8c2bf7003b4437164490dc2a2f9b23ea759ee11301d23d240638089bbe8 |
|
MD5 | 7ef94714d3c55fd1e108c66af6f6537c |
|
BLAKE2b-256 | c0268887ee55c377b834a071bffecd623d8b15c322fa5b0f4d1d60424eff9e98 |