Skip to main content

No project description provided

Project description

Auto documentation

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

Install the package using pypi

pip install autopress

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

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

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:

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:

<MethodAutopress module="autopress.utils" method="convert_tag" />

After:

<!--<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 file and in the 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:

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autopress-0.1.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autopress-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file autopress-0.1.0.tar.gz.

File metadata

  • Download URL: autopress-0.1.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for autopress-0.1.0.tar.gz
Algorithm Hash digest
SHA256 60d440ce582ad514c12ffa77d3c75429332e7c18c33e9e7cc2a90ca2d44459b0
MD5 4ad335550f6e2e1d558953cf41e2a4e9
BLAKE2b-256 29923606b5f1965ab55bba6fc224755c83994353b8e416637036aadef9ae0736

See more details on using hashes here.

File details

Details for the file autopress-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: autopress-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for autopress-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 544998f192a7c695bdf089f7bc480f1bf82df64896174cd56c78b8bf4ee9de95
MD5 106be22eb7576120f01d1ee99aef78f5
BLAKE2b-256 804574cd769bed0649c4e77e4e33cf6fc767c5fb9c7155b34e1992371d0236cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page