Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marco-rosner/gendocsgpt
CLI to generate API documentation in MarkDown based on the models and api handlers for a given project using ChatGPT.
https://github.com/marco-rosner/gendocsgpt
chatgpt documentation generator gpt openai pytest python
Last synced: 3 months ago
JSON representation
CLI to generate API documentation in MarkDown based on the models and api handlers for a given project using ChatGPT.
- Host: GitHub
- URL: https://github.com/marco-rosner/gendocsgpt
- Owner: marco-rosner
- License: mit
- Created: 2023-09-11T22:20:03.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-22T15:41:06.000Z (over 1 year ago)
- Last Synced: 2024-08-09T09:30:40.679Z (6 months ago)
- Topics: chatgpt, documentation, generator, gpt, openai, pytest, python
- Language: Python
- Homepage: https://pypi.org/project/genDocsGPT/
- Size: 454 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pypi.org/project/genDocsGPT/) [](https://www.python.org) [](https://github.com/marco-rosner/genDocsGPT/actions/workflows/test.yml) [](https://opensource.org/licenses/MIT)

## Generate Docs using ChatGPT
CLI to generate API documentation in MarkDown based on the models and api handlers for given project using ChatGPT.
## genDocsGPT badge
[](https://github.com/marco-rosner/genDocsGPT)
## ChatGPT API Key
The genDosGPT demand a ChatGPT API Key that you can generate after create your free account in [OpenAI](https://www.openai.com/). Tutorial [here](https://www.maisieai.com/help/how-to-get-an-openai-api-key-for-chatgpt). After this, create a `.env` file in the following format:
```
API_KEY="chatgpt_api_Key"
```## Usage
```
usage: genDocsGPT [-h] [-v, --verbose] -m / --model -a / --api
[-o / --output ] [-t / --token ] [--env ] [--gpt_model ]CLI to generate API documentation in MarkDown based on the models and api handlers for
given project using ChatGPT.options:
-h, --help show this help message and exit
-v, --verbose Show all the messages to debug
-m / --model
Model paths. If more than one, separate with a comma
-a / --api
API paths. If more than one, separate with a comma
-o / --output
Filename to the documentation generated. Default: ./api.md
-t / --token ChatGPT API KEY
--env Env file that MUST and ONLY have API_KEY="chatgpt_api_key".
Default: ./.env
--gpt_model Model that will be used by ChatGPT. Default: gpt-3.5-turboWe do not recommend using it in non-open-source projects.
```### Standalone

The [genDocsGPT.sh](https://github.com/marco-rosner/genDocsGPT/blob/main/usage/Standalone/genDocsGPT.sh), the bash script above, should be used in projects where the documentation should be generated not frequently. You only need to copy this file, **change the configuration** (models, API handlers…), paste it into your project, create the .env file with the ChatGPT API Key, and run this bash script.
I am using this standalone version in the [DadosJusBr’s GraphQL](https://github.com/marco-rosner/dadosjusbr-graphql) project which is a Node/ExpressJS using Apollo Server. So, I created a script in the [package.json](https://github.com/marco-rosner/dadosjusbr-graphql/blob/main/package.json) to run it only using: `npm run genDocsGPT` or `yarn genDocsGPT`
### GitHub Action

This GitHub Action will run after every commit in the main/master branch and create a pull request that you only need to approve (or not) and the documentation will be updated.
For [genDocsGPT.yml](https://github.com/marco-rosner/lightweight-go-server/blob/main/.github/workflows/genDocsGPT.yml) works fine in your project, you should set the model, API handlers paths, and other options ([line 30](https://github.com/marco-rosner/lightweight-go-server/blob/main/.github/workflows/genDocsGPT.yml#L30)), create, in the GitHub, the secret **ChatGPT_API_KEY** ([_tutorial here_](https://docs.github.com/pt/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository)), and change the workflow permissions ([_tutorial here_](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#configuring-the-default-github_token-permissions)) to “**Read and Write permissions**” and use the “**Allow GitHub Action to create and approve pull requests**”.

For more detail, I integrated this GitHub Action in the [Lightweight Go Server](https://github.com/marco-rosner/lightweight-go-server) project, a [Go servers benchmark between Echo, Gin, and Fiber](https://blog.stackademic.com/go-servers-benchmark-echo-fiber-and-gin-caadd9a78319).