autopress


Nameautopress JSON
Version 0.1.0 PyPI version JSON
download
home_page
Summary
upload_time2024-02-27 02:49:39
maintainer
docs_urlNone
authorEdward Laurence
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Auto documentation <!-- omit in toc -->

Generate the markdown documentation (like Sphinx) to be used for vitepress, using GPT4.
It uses the OpenAI API to generate the documentation based on the docstrings of the code.

- [Usage](#usage)
- [Example](#example)
- [Distribution on pypi](#distribution-on-pypi)

## Usage

Install the package using pypi
```bash
pip install autopress
```

Configure the package. The OpenAI API key will be asked if not already set.

```bash
autodoc configure
```

The configure command will ask for the OpenAI API key and let you change the default prompt for the OpenAI API.

The commands can be listed using

```bash
autopress --help
```
```
Commands:
  Autopress.from_class      Use this method to generate a docstring from...
  Autopress.from_docstring  Use this method to generate a docstring from...
  Autopress.from_file       Open a markdown file and replace the tags...
  Autopress.from_method     Use this method to generate a docstring from...
  configure                 Set your configuration settings
```

The main command is `Autopress.from_file` which will replace the tags in the markdown file with the actual documentation. Go in the root of the package and run the following command:

```bash
cd demo
autopress Autopress.from_file --file README.md --output README_out.md
```

The above command will generate the documentation for the README.md file and save it in the README_out.md file.

## Example

The below tag will be replaced with the actual documentation of the method `convert_tag` from the module `autopress.utils`.

Before:
```markdown
<MethodAutopress module="autopress.utils" method="convert_tag" />
```

After:
```markdown 
<!--<MethodAutopress module="autopress.utils" method="convert_tag"  id="9d66f8"/>-->
<!--<AutoDoc.Content id="9d66f8">-->

### `autopress.utils.convert_tag`
Converts a tag to a docstring and replaces it in the content. This operation is useful when modifying file contents dynamically by substituting placeholders or tags with actual docstrings.

### Parameters

| Name | Type | Default | Description |
|------|------|---------|-------------|
| `content` | `str` | | The content of the file. |
| `tag` | `str` | | The tag to convert. |
| `docstring` | `str` | | The docstring to replace the tag with. |
| `existing_id` | `re.Match` | | The existing ID of the tag. |

### Returns

| Type | Description |
|------|-------------|
| `str` | The content with the tag replaced by the docstring. |

<!--</AutoDoc.Content id="9d66f8">-->
```

You can excute again the command and the autpress will update the content.



## Distribution on pypi

> Make sure the version number is updated in the [__init__.py](autopress/__init__.py) file and in the [setup.py](setup.py) file.

The distribution on done with continuous integration using github actions. The secret `PYPI_API_TOKEN` is set in the repository settings.

Then, to trigger the release, we need to create a tag with the version number. The release will be automatically created and the package will be uploaded to pypi.

For example, to release version 1.0.0, we need to do the following:

```bash
git tag v1.0.0
git push origin v1.0.0
``` 

You can also create a release with a new tag in the github interface.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "autopress",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Edward Laurence",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/29/92/3606b5f1965ab55bba6fc224755c83994353b8e416637036aadef9ae0736/autopress-0.1.0.tar.gz",
    "platform": null,
    "description": "# Auto documentation <!-- omit in toc -->\n\nGenerate the markdown documentation (like Sphinx) to be used for vitepress, using GPT4.\nIt uses the OpenAI API to generate the documentation based on the docstrings of the code.\n\n- [Usage](#usage)\n- [Example](#example)\n- [Distribution on pypi](#distribution-on-pypi)\n\n## Usage\n\nInstall the package using pypi\n```bash\npip install autopress\n```\n\nConfigure the package. The OpenAI API key will be asked if not already set.\n\n```bash\nautodoc configure\n```\n\nThe configure command will ask for the OpenAI API key and let you change the default prompt for the OpenAI API.\n\nThe commands can be listed using\n\n```bash\nautopress --help\n```\n```\nCommands:\n  Autopress.from_class      Use this method to generate a docstring from...\n  Autopress.from_docstring  Use this method to generate a docstring from...\n  Autopress.from_file       Open a markdown file and replace the tags...\n  Autopress.from_method     Use this method to generate a docstring from...\n  configure                 Set your configuration settings\n```\n\nThe main command is `Autopress.from_file` which will replace the tags in the markdown file with the actual documentation. Go in the root of the package and run the following command:\n\n```bash\ncd demo\nautopress Autopress.from_file --file README.md --output README_out.md\n```\n\nThe above command will generate the documentation for the README.md file and save it in the README_out.md file.\n\n## Example\n\nThe below tag will be replaced with the actual documentation of the method `convert_tag` from the module `autopress.utils`.\n\nBefore:\n```markdown\n<MethodAutopress module=\"autopress.utils\" method=\"convert_tag\" />\n```\n\nAfter:\n```markdown \n<!--<MethodAutopress module=\"autopress.utils\" method=\"convert_tag\"  id=\"9d66f8\"/>-->\n<!--<AutoDoc.Content id=\"9d66f8\">-->\n\n### `autopress.utils.convert_tag`\nConverts a tag to a docstring and replaces it in the content. This operation is useful when modifying file contents dynamically by substituting placeholders or tags with actual docstrings.\n\n### Parameters\n\n| Name | Type | Default | Description |\n|------|------|---------|-------------|\n| `content` | `str` | | The content of the file. |\n| `tag` | `str` | | The tag to convert. |\n| `docstring` | `str` | | The docstring to replace the tag with. |\n| `existing_id` | `re.Match` | | The existing ID of the tag. |\n\n### Returns\n\n| Type | Description |\n|------|-------------|\n| `str` | The content with the tag replaced by the docstring. |\n\n<!--</AutoDoc.Content id=\"9d66f8\">-->\n```\n\nYou can excute again the command and the autpress will update the content.\n\n\n\n## Distribution on pypi\n\n> Make sure the version number is updated in the [__init__.py](autopress/__init__.py) file and in the [setup.py](setup.py) file.\n\nThe distribution on done with continuous integration using github actions. The secret `PYPI_API_TOKEN` is set in the repository settings.\n\nThen, to trigger the release, we need to create a tag with the version number. The release will be automatically created and the package will be uploaded to pypi.\n\nFor example, to release version 1.0.0, we need to do the following:\n\n```bash\ngit tag v1.0.0\ngit push origin v1.0.0\n``` \n\nYou can also create a release with a new tag in the github interface.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "804574cd769bed0649c4e77e4e33cf6fc767c5fb9c7155b34e1992371d0236cd",
                "md5": "106be22eb7576120f01d1ee99aef78f5",
                "sha256": "544998f192a7c695bdf089f7bc480f1bf82df64896174cd56c78b8bf4ee9de95"
            },
            "downloads": -1,
            "filename": "autopress-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "106be22eb7576120f01d1ee99aef78f5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7818,
            "upload_time": "2024-02-27T02:49:37",
            "upload_time_iso_8601": "2024-02-27T02:49:37.331455Z",
            "url": "https://files.pythonhosted.org/packages/80/45/74cd769bed0649c4e77e4e33cf6fc767c5fb9c7155b34e1992371d0236cd/autopress-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "29923606b5f1965ab55bba6fc224755c83994353b8e416637036aadef9ae0736",
                "md5": "4ad335550f6e2e1d558953cf41e2a4e9",
                "sha256": "60d440ce582ad514c12ffa77d3c75429332e7c18c33e9e7cc2a90ca2d44459b0"
            },
            "downloads": -1,
            "filename": "autopress-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4ad335550f6e2e1d558953cf41e2a4e9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7132,
            "upload_time": "2024-02-27T02:49:39",
            "upload_time_iso_8601": "2024-02-27T02:49:39.959133Z",
            "url": "https://files.pythonhosted.org/packages/29/92/3606b5f1965ab55bba6fc224755c83994353b8e416637036aadef9ae0736/autopress-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-27 02:49:39",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "autopress"
}
        
Elapsed time: 2.27436s