Skip to content

Releases: simon-ritchie/stubdoc

Adapt generation of callable names to be able to detect built-in functionstions

12 Aug 11:20
Compare
Choose a tag to compare

What's Changed

  • Adapt generation of callable names to be able to detect built-in functionstions by @tobiasah in #7

New Contributors

Full Changelog: 0.1.11...0.1.12

Support a top-level class docstring

03 Aug 12:44
Compare
Choose a tag to compare

The stubdoc library now supports a top-level class docstring.

Related issue

#5

Examples

Original module code:

from random import randint

sample_int: int = 100


def sample_func(a: int, b: str) -> bool:
    """
    Lorem ipsum dolor sit amet, consectetur adipiscing elit,
    ed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

    Parameters
    ----------
    a : int
        Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    b : str
        ed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

    Returns
    -------
    c : bool
        Ut enim ad minim veniam, quis nostrud exercitation.
    """
    return True


class SampleClass:
    """
    Lorem ipsum dolor sit amet, consectetur adipiscing elit,
    sed do eiusmod tempor incididunt ut labore et dolore magna
    aliqua. Ut enim ad minim veniam.
    """

    def __init__(self) -> None:
        """
        Lorem ipsum dolor sit amet, consectetur adipiscing elit.
        """

    @property
    def sample_property(self) -> int:
        """
        Lorem ipsum dolor sit amet, consectetur adipiscing elit.

        Returns
        -------
        d : int
            ed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
        """
        return randint(0, 100)

Original stub file (create with the mypy command):

sample_int: int

def sample_func(a: int, b: str) -> bool: ...

class SampleClass:
    def __init__(self) -> None: ...
    @property
    def sample_property(self) -> int: ...

After the stubdoc command ($ stubdoc -m samples/sample.py -s out/samples/sample.pyi) stubfile becomes as follows:

sample_int: int

def sample_func(a: int, b: str) -> bool:
    """
    Lorem ipsum dolor sit amet, consectetur adipiscing elit,
    ed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

    Parameters
    ----------
    a : int
        Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    b : str
        ed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

    Returns
    -------
    c : bool
        Ut enim ad minim veniam, quis nostrud exercitation.
    """

class SampleClass:
    """
    Lorem ipsum dolor sit amet, consectetur adipiscing elit,
    sed do eiusmod tempor incididunt ut labore et dolore magna
    aliqua. Ut enim ad minim veniam.
    """
    def __init__(self) -> None:
        """
        Lorem ipsum dolor sit amet, consectetur adipiscing elit.
        """
    @property
    def sample_property(self) -> int:
        """
        Lorem ipsum dolor sit amet, consectetur adipiscing elit.

        Returns
        -------
        d : int
            ed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
        """

Support additional extensions of the .pyc, .pyw, and .{platform_suffix}.pyd

12 Feb 00:34
Compare
Choose a tag to compare

This release includes the following pull request: #3

Contributed by @CSchulzeTLK

Support the `.pyd` files

05 Feb 05:12
Compare
Choose a tag to compare

This release includes the following pull request: #2

Contributed by @CSchulzeTLK

Fix module import error

21 Dec 12:15
Compare
Choose a tag to compare
0.1.6

Fix module import error and add detailed error message.

Add Python interface

21 Dec 03:28
Compare
Choose a tag to compare
0.1.5

Add Python interface to __init__ and instruction to README.

First release

19 Dec 10:52
71b3ffc
Compare
Choose a tag to compare
0.1.4

Create LICENSE