Skip to main content

Write docstrings in Markdown!

Project description

inari

Write docstrings in Markdown!

Features

  • Minimum configuration.
  • No dependencies by default(but MkDocs is recommended!).
  • CLI and MkDocs Plugin.
  • Cross reference in API documents.

Install

pip install inari[mkdocs]

Example

# sample.py
"""This is a sample module."""

variable = 42
"""(`int`):  Docstrings for module-level variables."""

def func(foo: str, bar: int) -> str:
    """
    Docstrings for functions.

    **Args**

    * foo (`str`): First argument.
    * bar (`int`): Second argument.

    **Returns**

    * `str`: Type of return value.

    """
    return foo * bar

class SampleClass:
    """
    Class docstrings.

    **Attributes**

    * baz (`str`): Docstrings for attributes.

    """
    baz: str

    def __init__(self, b: str):
        """
        **Args**

        * b (`str`): Arguments for initializing.

        """

        self.baz = b

    def method(self, bar: int) -> str:
        """
        Method docstrings.

        Cross reference available. `sample.func`

        **Args**

        * bar(`int`)

        **Returns**

        * `str`

        """
        return func(self.baz, bar)
inari sample docs

inari makes this Markdown file:

<!-- docs/sample-py.md -->
# Module sample

This is a sample module.


## Variables

* **variable**{: #variable } (`int`):  Docstrings for module-level variables.

## Classes

### SampleClass {: #SampleClass }

```python
class SampleClass(self, b: str)
```

Class docstrings.

**Attributes**

* **baz** (`str`): Docstrings for attributes.

**Args**

* **b** (`str`): Arguments for initializing.


------

#### Methods {: #SampleClass-methods }

[**method**](#SampleClass.method){: #SampleClass.method }

```python
def method(self, bar: int) -> str
```

Method docstrings.

Cross reference available. [`func `](./#func)

**Args**

* **bar** (`int`)
**Returns**

* `str`

## Functions

### func {: #func }

```python
def func(foo: str, bar: int) -> str
```

Docstrings for functions.

**Args**

* **foo** (`str`): First argument.
* **bar** (`int`): Second argument.

**Returns**

* `str`: Type of return value.

License

MIT

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

inari-0.1.1.tar.gz (9.7 kB view hashes)

Uploaded Source

Built Distribution

inari-0.1.1-py3-none-any.whl (9.8 kB view hashes)

Uploaded Python 3

Supported by

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