Example - pypackitup - Python Package Template
Author: Wren J. Rudolph for Wrencode, LLC

# `Hello, World!`

Module containing Python code for the Python Package Template.

This module is an example for the Python Package Template.

Attributes: | `__author__` (`str`) – Python package template author. `__email__` (`str`) – Python package template author email.

Classes:

Name | Description
--- | ---
`PythonPackageTemplate` |

Functions:

Name | Description
--- | ---
`main` | Example main function for the Python Package Template.

## PythonPackageTemplate

Bases: `object`

Methods:

Name | Description
--- | ---
`__init__` | Instantiate the Python Package Template example class.
`example_method` | Example method for the Python Package Template.

Source code in `src/pypackitup/helloworld.py`

    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    class PythonPackageTemplate(object):

        def __init__(self, example_init_parameter: str = "Hello"):
            """Instantiate the Python Package Template example class.

            Args:
                example_init_parameter (str): Example class init parameter for the Python Package Template.

            Attributes:
                example_init_parameter (str): Example class attribute for the Python Package Template.

            """
            self.example_init_parameter = example_init_parameter

        def example_method(self, example_parameter: str = "World") -> str:
            """Example method for the Python Package Template.

            Args:
                example_parameter (str): Example class method parameter for the Python Package Template.

            Examples:
                >>> from pypackitup.helloworld import PythonPackageTemplate
                >>> example_class_instance = PythonPackageTemplate()
                >>> print(example_class_instance.example_method())
                Hello, World!

            Returns:
                str: Example return string for the Python Package Template.

            """
            if not example_parameter:
                raise ValueError("Invalid argument provided for example_parameter.")

            return f"{self.example_init_parameter}, {example_parameter}!"

### __init__

    __init__(example_init_parameter='Hello')

Instantiate the Python Package Template example class.

Parameters: | `example_init_parameter` (`str`, default: `'Hello'` ) – Example class init parameter for the Python Package Template.

Attributes: | `example_init_parameter` (`str`) – Example class attribute for the Python Package Template.

Source code in `src/pypackitup/helloworld.py`

    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    def __init__(self, example_init_parameter: str = "Hello"):
        """Instantiate the Python Package Template example class.

        Args:
            example_init_parameter (str): Example class init parameter for the Python Package Template.

        Attributes:
            example_init_parameter (str): Example class attribute for the Python Package Template.

        """
        self.example_init_parameter = example_init_parameter

### example_method

    example_method(example_parameter='World')

Example method for the Python Package Template.

Parameters: | `example_parameter` (`str`, default: `'World'` ) – Example class method parameter for the Python Package Template.

Examples:

    >>> from pypackitup.helloworld import PythonPackageTemplate
    >>> example_class_instance = PythonPackageTemplate()
    >>> print(example_class_instance.example_method())
    Hello, World!

Returns: | `str`( `str` ) – Example return string for the Python Package Template.

Source code in `src/pypackitup/helloworld.py`

    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    def example_method(self, example_parameter: str = "World") -> str:
        """Example method for the Python Package Template.

        Args:
            example_parameter (str): Example class method parameter for the Python Package Template.

        Examples:
            >>> from pypackitup.helloworld import PythonPackageTemplate
            >>> example_class_instance = PythonPackageTemplate()
            >>> print(example_class_instance.example_method())
            Hello, World!

        Returns:
            str: Example return string for the Python Package Template.

        """
        if not example_parameter:
            raise ValueError("Invalid argument provided for example_parameter.")

        return f"{self.example_init_parameter}, {example_parameter}!"

## main

    main()

Example main function for the Python Package Template.

Returns: | `None` – None

Source code in `src/pypackitup/helloworld.py`

    52
    53
    54
    55
    56
    57
    58
    59
    60
    def main() -> None:
        """Example main function for the Python Package Template.

        Returns:
            None

        """
        example_class_instance = PythonPackageTemplate()
        print(example_class_instance.example_method())

GitHub « Previous Next »