docapi


Namedocapi JSON
Version 0.0.9 PyPI version JSON
download
home_pagehttps://github.com/Shulin-Zhang/docapi
SummaryDocAPI is a Python package that automatically generates API documentation using LLM.
upload_time2024-11-13 03:27:06
maintainerNone
docs_urlNone
authorZhangShulin
requires_python>=3.8
licenseNone
keywords llmdoc autodoc apidoc docapi
VCS
bugtrack_url
requirements openai fire pyyaml mkdocs
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![image](assets/logo.png)

![Python Version](https://img.shields.io/badge/python-3.8+-aff.svg)
![OS](https://img.shields.io/badge/os-linux%20|%20macOS-blue)
![Lisence](https://img.shields.io/badge/license-Apache%202-dfd.svg)
[![PyPI](https://img.shields.io/pypi/v/docapi)](https://pypi.org/project/docapi/)
[![GitHub pull request](https://img.shields.io/badge/PRs-welcome-blue)](https://github.com/Shulin-Zhang/docapi/pulls)

\[ English | [中文](README_zh.md) \]

#### DocAPI is a Python package that automatically generates API documentation using large models. It scans the API route structure, generates or updates the documentation, and provides code call examples.

## Installation

```bash
pip install docapi

or

pip install -U docapi -i https://pypi.org/simple
```

#### GitHub source code installation

```bash
pip install git+https://github.com/Shulin-Zhang/docapi
```

## Usage

#### Method 1 (Recommended)

**Automatically scan the routing structure. This is only valid for flask projects and must be used in the environment of api projects.**

```bash
export OPENAI_API_KEY=your_key

# Generate API documentation
docapi generate server.py

# Update API documentation
docapi update server.py

# Start the web service
docapi serve
```

#### Method 2

Generate the configuration file

```bash
docapi init
```

Edit the config.yaml file

```yaml
# API file list

api_files: 
  - 'flask_server.py'
  - 'flask_api.py'

# OpenAI

openai_api_key: xxx

openai_base_url: 'http://ip:port/v1'

openai_model: 'qwen-plus'

# Azure OpenAI

azure_api_key: null

azure_endpoint: null

azure_api_version: null

azure_model: null
```

```bash
# Generate API documentation
docapi generate --doc_dir ./docs --lang zh --config config.yaml

# Update API documentation
docapi update --doc_dir ./docs --lang zh --config config.yaml

# Start the web service
docapi serve ./docs -h 127.0.0.1 -p 9000
```

## Supported Models

- OpenAI

- AzureOpenAI

- Tongyi Qianwen

## Supported API Frameworks

- Flask
  
Automatic scanning is only valid for the Flask framework and is recommended for use on Flask services.

## API Web Page

![image](assets/example1.png)

## TODO
- Supports large models such as Wenxin Yiyan and Zhipu AI.

- Supports automatic scanning of frameworks such as fastapi and Django.

- ~~Supports online web page display of documents.~~

- Supports custom document templates.

- Multithreading accelerates requests.

- Import to postman.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Shulin-Zhang/docapi",
    "name": "docapi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "llmdoc, autodoc, apidoc, docapi",
    "author": "ZhangShulin",
    "author_email": "zhangslwork@yeah.net",
    "download_url": "https://files.pythonhosted.org/packages/22/db/5fbfa4321be8a72ecba32997aad930203efe637b41f7430d6b818c880ecb/docapi-0.0.9.tar.gz",
    "platform": null,
    "description": "![image](assets/logo.png)\n\n![Python Version](https://img.shields.io/badge/python-3.8+-aff.svg)\n![OS](https://img.shields.io/badge/os-linux%20|%20macOS-blue)\n![Lisence](https://img.shields.io/badge/license-Apache%202-dfd.svg)\n[![PyPI](https://img.shields.io/pypi/v/docapi)](https://pypi.org/project/docapi/)\n[![GitHub pull request](https://img.shields.io/badge/PRs-welcome-blue)](https://github.com/Shulin-Zhang/docapi/pulls)\n\n\\[ English | [\u4e2d\u6587](README_zh.md) \\]\n\n#### DocAPI is a Python package that automatically generates API documentation using large models. It scans the API route structure, generates or updates the documentation, and provides code call examples.\n\n## Installation\n\n```bash\npip install docapi\n\nor\n\npip install -U docapi -i https://pypi.org/simple\n```\n\n#### GitHub source code installation\n\n```bash\npip install git+https://github.com/Shulin-Zhang/docapi\n```\n\n## Usage\n\n#### Method 1 (Recommended)\n\n**Automatically scan the routing structure. This is only valid for flask projects and must be used in the environment of api projects.**\n\n```bash\nexport OPENAI_API_KEY=your_key\n\n# Generate API documentation\ndocapi generate server.py\n\n# Update API documentation\ndocapi update server.py\n\n# Start the web service\ndocapi serve\n```\n\n#### Method 2\n\nGenerate the configuration file\n\n```bash\ndocapi init\n```\n\nEdit the config.yaml file\n\n```yaml\n# API file list\n\napi_files: \n  - 'flask_server.py'\n  - 'flask_api.py'\n\n# OpenAI\n\nopenai_api_key: xxx\n\nopenai_base_url: 'http://ip:port/v1'\n\nopenai_model: 'qwen-plus'\n\n# Azure OpenAI\n\nazure_api_key: null\n\nazure_endpoint: null\n\nazure_api_version: null\n\nazure_model: null\n```\n\n```bash\n# Generate API documentation\ndocapi generate --doc_dir ./docs --lang zh --config config.yaml\n\n# Update API documentation\ndocapi update --doc_dir ./docs --lang zh --config config.yaml\n\n# Start the web service\ndocapi serve ./docs -h 127.0.0.1 -p 9000\n```\n\n## Supported Models\n\n- OpenAI\n\n- AzureOpenAI\n\n- Tongyi Qianwen\n\n## Supported API Frameworks\n\n- Flask\n  \nAutomatic scanning is only valid for the Flask framework and is recommended for use on Flask services.\n\n## API Web Page\n\n![image](assets/example1.png)\n\n## TODO\n- Supports large models such as Wenxin Yiyan and Zhipu AI.\n\n- Supports automatic scanning of frameworks such as fastapi and Django.\n\n- ~~Supports online web page display of documents.~~\n\n- Supports custom document templates.\n\n- Multithreading accelerates requests.\n\n- Import to postman.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "DocAPI is a Python package that automatically generates API documentation using LLM.",
    "version": "0.0.9",
    "project_urls": {
        "Homepage": "https://github.com/Shulin-Zhang/docapi"
    },
    "split_keywords": [
        "llmdoc",
        " autodoc",
        " apidoc",
        " docapi"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "00278ee1fce15650d2b9fac0845554a31d717125d0ca1a86eb9b367902421a03",
                "md5": "07f685f779e09e22780fd39db81b37c2",
                "sha256": "ce9502c262b9a22f949268588a207f6338d7ff9aed2099974724b5c216558f8e"
            },
            "downloads": -1,
            "filename": "docapi-0.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "07f685f779e09e22780fd39db81b37c2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 16149,
            "upload_time": "2024-11-13T03:27:04",
            "upload_time_iso_8601": "2024-11-13T03:27:04.844672Z",
            "url": "https://files.pythonhosted.org/packages/00/27/8ee1fce15650d2b9fac0845554a31d717125d0ca1a86eb9b367902421a03/docapi-0.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "22db5fbfa4321be8a72ecba32997aad930203efe637b41f7430d6b818c880ecb",
                "md5": "03f322d795042b574121462a6c34c473",
                "sha256": "d4de3c49ccec0d39852adb6a159be3b01d9e94ba10b185da3efef8e4ebf8bca6"
            },
            "downloads": -1,
            "filename": "docapi-0.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "03f322d795042b574121462a6c34c473",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 14561,
            "upload_time": "2024-11-13T03:27:06",
            "upload_time_iso_8601": "2024-11-13T03:27:06.824348Z",
            "url": "https://files.pythonhosted.org/packages/22/db/5fbfa4321be8a72ecba32997aad930203efe637b41f7430d6b818c880ecb/docapi-0.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-13 03:27:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Shulin-Zhang",
    "github_project": "docapi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "openai",
            "specs": [
                [
                    "==",
                    "1.54.3"
                ]
            ]
        },
        {
            "name": "fire",
            "specs": [
                [
                    "==",
                    "0.7.0"
                ]
            ]
        },
        {
            "name": "pyyaml",
            "specs": [
                [
                    "==",
                    "6.0.2"
                ]
            ]
        },
        {
            "name": "mkdocs",
            "specs": [
                [
                    "==",
                    "1.6.1"
                ]
            ]
        }
    ],
    "lcname": "docapi"
}
        
Elapsed time: 0.43174s