Skip to main content

Allows to extract docstrings from Python functions to create a documentation file in Markdown format.

Project description

mdocs

mdocs allows you to extract docstrings from Python functions to create a documentation file in Markdown format. It is designed as an alternative for projects that consist of just a few functions and do not require more sophisticated tools. We will obtain an MD file that can easily be linked to the README of our repository to present accessible and well-organized technical documentation to clients or users.

See the generated document of this same project as an example here.

Install

It can be installed from the PyPI repository.

pip install mdocs

https://pypi.org/project/mdocs/0.1.0/

Usage

First use

On the first use, use -c to configure the project.

mdocs -c

This will initiate the configuration process for the project. Enter the project details and remember that Project name and Project description are required.

Starter config...
Project name (required): Test Project
Project description (required): This is a test project
Developer or company name [default empty]: Your name
Contact e-mail [default empty]: Your email
Repository link [default empty]: Your link
2024-10-19 00:02:06,010 - INFO - Initial configuration file created successfully...
usage: mdocs [source]

This will create a configuration file named mdocs_settings.json in the directory where the program was executed.

Create documentation.

Use mdocs [source] to extract the documentation from your functions. [source] is the path to your source files.

For example.

mdocs ./src

This will create a file named documentation.md that will contain the documentation for your functions in the directory where the program was executed.

For it to work.

For now, it only extracts docstrings from functions and class, but more functionality is expected to be added.

It is expected to find a docstring with the following structure:

def calculate_rectangle_area(base, height):
    """
    Calculates the area of a rectangle.

    Args:
        base (float): The length of the rectangle's base.
        height (float): The height of the rectangle.

    Returns:
        float: The area of the rectangle calculated as base * height.

    Example:
        >>> calculate_rectangle_area(5, 3)
        15
    """
    return base * height

Contributing

If you would like to contribute or share ideas for improvement, please feel free to contact me via email. I welcome all suggestions and contributions to enhance this project!

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

mdocs-0.2.0.tar.gz (13.4 kB view details)

Uploaded Source

File details

Details for the file mdocs-0.2.0.tar.gz.

File metadata

  • Download URL: mdocs-0.2.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for mdocs-0.2.0.tar.gz
Algorithm Hash digest
SHA256 82625fa5393d5243adbfb35a975b5aaac6b087f58f565da0ccd8bf0c14c17de6
MD5 e51b5838fcbc3cebf5cab9a17342fbc2
BLAKE2b-256 d48af09086a72200a6d74db3205f6ca4efccbf9784d7f8c315d2f9b47c3a987a

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