wolfsoftware.notify


Namewolfsoftware.notify JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/DevelopersToolbox/notify-package
SummaryGenerate console base notification messages.
upload_time2024-06-24 17:59:44
maintainerNone
docs_urlNone
authorWolf Software
requires_python>=3.9
licenseMIT
keywords python notify
VCS
bugtrack_url
requirements colorama
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!-- markdownlint-disable -->
<p align="center">
    <a href="https://github.com/DevelopersToolbox/">
        <img src="https://cdn.wolfsoftware.com/assets/images/github/organisations/developerstoolbox/black-and-white-circle-256.png" alt="DevelopersToolbox logo" />
    </a>
    <br />
    <a href="https://github.com/DevelopersToolbox/notify-package/actions/workflows/cicd.yml">
        <img src="https://img.shields.io/github/actions/workflow/status/DevelopersToolbox/notify-package/cicd.yml?branch=master&label=build%20status&style=for-the-badge" alt="Github Build Status" />
    </a>
    <a href="https://github.com/DevelopersToolbox/notify-package/blob/master/LICENSE.md">
        <img src="https://img.shields.io/github/license/DevelopersToolbox/notify-package?color=blue&label=License&style=for-the-badge" alt="License">
    </a>
    <a href="https://github.com/DevelopersToolbox/notify-package">
        <img src="https://img.shields.io/github/created-at/DevelopersToolbox/notify-package?color=blue&label=Created&style=for-the-badge" alt="Created">
    </a>
    <br />
    <a href="https://github.com/DevelopersToolbox/notify-package/releases/latest">
        <img src="https://img.shields.io/github/v/release/DevelopersToolbox/notify-package?color=blue&label=Latest%20Release&style=for-the-badge" alt="Release">
    </a>
    <a href="https://github.com/DevelopersToolbox/notify-package/releases/latest">
        <img src="https://img.shields.io/github/release-date/DevelopersToolbox/notify-package?color=blue&label=Released&style=for-the-badge" alt="Released">
    </a>
    <a href="https://github.com/DevelopersToolbox/notify-package/releases/latest">
        <img src="https://img.shields.io/github/commits-since/DevelopersToolbox/notify-package/latest.svg?color=blue&style=for-the-badge" alt="Commits since release">
    </a>
    <br />
    <a href="https://github.com/DevelopersToolbox/notify-package/blob/master/.github/CODE_OF_CONDUCT.md">
        <img src="https://img.shields.io/badge/Code%20of%20Conduct-blue?style=for-the-badge" />
    </a>
    <a href="https://github.com/DevelopersToolbox/notify-package/blob/master/.github/CONTRIBUTING.md">
        <img src="https://img.shields.io/badge/Contributing-blue?style=for-the-badge" />
    </a>
    <a href="https://github.com/DevelopersToolbox/notify-package/blob/master/.github/SECURITY.md">
        <img src="https://img.shields.io/badge/Report%20Security%20Concern-blue?style=for-the-badge" />
    </a>
    <a href="https://github.com/DevelopersToolbox/notify-package/issues">
        <img src="https://img.shields.io/badge/Get%20Support-blue?style=for-the-badge" />
    </a>
</p>

## Overview

The Notify package provides a set of utility functions for printing formatted messages to the terminal. The main purpose of this
module is to facilitate the display of success, warning, error, informational, and system messages with specific color and style
formatting using predefined constants.

## Features

- Display success messages with green text.
- Display warning messages with yellow text.
- Display error messages with red text.
- Display informational messages with cyan text.
- Display system messages with grey text.
- Support for custom colors, prompts, and formatting scopes.
- Error handling for invalid colors and scopes.

## Installation

To install the Notify package, use the following command:

```bash
pip install wolfsoftware.notify
```

## Usage

Here is an example of how to use the notification functions provided by the Notify package:

```python
from wolfsoftware.notify import success_message, warning_message, error_message, info_message, system_message

print(success_message("Operation completed successfully."))
print(warning_message("This is a warning message."))
print(error_message("An error occurred."))
print(info_message("This is some information."))
print(system_message("System update available."))
```

## Functions

### `success_message`

Print a success message with a specific format.

```python
def success_message(
        message: str,
        color: str = 'green+bold',
        prompt: str = 'Success',
        scope: str = 'prompt_text',
        prompt_prefix: str = '[ ',
        prompt_suffix: str = ' ]'
    ) -> str:
```

### `warning_message`

Print a warning message with a specific format.

```python
def warning_message(
        message: str,
        color: str = 'yellow+bold',
        prompt: str = 'Warning',
        scope: str = 'prompt_text',
        prompt_prefix: str = '[ ',
        prompt_suffix: str = ' ]'
    ) -> str:
```

### `error_message`

Print an error message with a specific format.

```python
def error_message(
        message: str,
        color: str = 'red+bold',
        prompt: str = 'Error',
        scope: str = 'prompt_text',
        prompt_prefix: str = '[ ',
        prompt_suffix: str = ' ]'
    ) -> str:
```

### `failure_message`

Alias for `error_message`, but with a prompt='Failure'.

```python
failure_message = error_message
```

### `info_message`

Print an informational message with a specific format.

```python
def info_message(
        message: str,
        color: str = 'cyan+bold',
        prompt: str = 'Info',
        scope: str = 'prompt_text',
        prompt_prefix: str = '[ ',
        prompt_suffix: str = ' ]'
    ) -> str:
```

### `system_message`

Print a system message with a specific format.

```python
def system_message(
        message: str,
        color: str = 'grey+bold',
        prompt: str = 'System',
        scope: str = 'prompt_text',
        prompt_prefix: str = '[ ',
        prompt_suffix: str = ' ]'
    ) -> str:
```

## Customization

You can customize the color, prompt text, and the scope of the color application using the provided parameters. Here are some examples:

### Custom Colors

```python
print(success_message("Operation completed successfully.", color="blue+bold"))
```

### Custom Prompts

```python
print(success_message("Operation completed successfully.", prompt="Completed"))
```

### Custom Scopes

- `all`: Applies the color to the entire message.
- `prompt`: Applies the color to the prompt only.
- `prompt_text`: Applies the color to the text inside the brackets.

```python
print(success_message("Operation completed successfully.", scope="prompt"))
print(success_message("Operation completed successfully.", scope="prompt_text"))
```

### Custom Prefixes and Suffixes

You can also customize the prompt prefix and suffix.

```python
print(success_message("Operation completed successfully.", prompt_prefix="<<", prompt_suffix=">>"))
```

## Error Handling

The Notify package includes error handling for invalid color and scope inputs. If an invalid color or scope is provided, a `NotifyValueError` will be raised with an appropriate error message.

```python
from wolfsoftware.notify import NotifyValueError

try:
    print(success_message("Operation completed successfully.", color="invalid"))
except NotifyValueError as e:
    print(f"Error: {e}")
```

## Testing

The Notify package includes a comprehensive test suite to ensure the correct functionality of all message formatting functions. The tests verify that the package version is defined, the message functions return correctly formatted strings, and exceptions are raised appropriately for invalid inputs.

### Running Tests

To run the tests, use a testing framework such as pytest:

```bash
pytest tests/test_notify.py
```

## Acknowledgements

The Notify package uses the `colorama` library for cross-platform support of ANSI color codes. Many thanks to the contributors of the `colorama` project for their excellent work.

<br />
<p align="right"><a href="https://wolfsoftware.com/"><img src="https://img.shields.io/badge/Created%20by%20Wolf%20on%20behalf%20of%20Wolf%20Software-blue?style=for-the-badge" /></a></p>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/DevelopersToolbox/notify-package",
    "name": "wolfsoftware.notify",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "python, notify",
    "author": "Wolf Software",
    "author_email": "pypi@wolfsoftware.com",
    "download_url": "https://files.pythonhosted.org/packages/f9/52/d3cab4e104bbf84054d99393d004cd026217a1397983f0a7463330ce71ee/wolfsoftware_notify-0.1.2.tar.gz",
    "platform": null,
    "description": "<!-- markdownlint-disable -->\n<p align=\"center\">\n    <a href=\"https://github.com/DevelopersToolbox/\">\n        <img src=\"https://cdn.wolfsoftware.com/assets/images/github/organisations/developerstoolbox/black-and-white-circle-256.png\" alt=\"DevelopersToolbox logo\" />\n    </a>\n    <br />\n    <a href=\"https://github.com/DevelopersToolbox/notify-package/actions/workflows/cicd.yml\">\n        <img src=\"https://img.shields.io/github/actions/workflow/status/DevelopersToolbox/notify-package/cicd.yml?branch=master&label=build%20status&style=for-the-badge\" alt=\"Github Build Status\" />\n    </a>\n    <a href=\"https://github.com/DevelopersToolbox/notify-package/blob/master/LICENSE.md\">\n        <img src=\"https://img.shields.io/github/license/DevelopersToolbox/notify-package?color=blue&label=License&style=for-the-badge\" alt=\"License\">\n    </a>\n    <a href=\"https://github.com/DevelopersToolbox/notify-package\">\n        <img src=\"https://img.shields.io/github/created-at/DevelopersToolbox/notify-package?color=blue&label=Created&style=for-the-badge\" alt=\"Created\">\n    </a>\n    <br />\n    <a href=\"https://github.com/DevelopersToolbox/notify-package/releases/latest\">\n        <img src=\"https://img.shields.io/github/v/release/DevelopersToolbox/notify-package?color=blue&label=Latest%20Release&style=for-the-badge\" alt=\"Release\">\n    </a>\n    <a href=\"https://github.com/DevelopersToolbox/notify-package/releases/latest\">\n        <img src=\"https://img.shields.io/github/release-date/DevelopersToolbox/notify-package?color=blue&label=Released&style=for-the-badge\" alt=\"Released\">\n    </a>\n    <a href=\"https://github.com/DevelopersToolbox/notify-package/releases/latest\">\n        <img src=\"https://img.shields.io/github/commits-since/DevelopersToolbox/notify-package/latest.svg?color=blue&style=for-the-badge\" alt=\"Commits since release\">\n    </a>\n    <br />\n    <a href=\"https://github.com/DevelopersToolbox/notify-package/blob/master/.github/CODE_OF_CONDUCT.md\">\n        <img src=\"https://img.shields.io/badge/Code%20of%20Conduct-blue?style=for-the-badge\" />\n    </a>\n    <a href=\"https://github.com/DevelopersToolbox/notify-package/blob/master/.github/CONTRIBUTING.md\">\n        <img src=\"https://img.shields.io/badge/Contributing-blue?style=for-the-badge\" />\n    </a>\n    <a href=\"https://github.com/DevelopersToolbox/notify-package/blob/master/.github/SECURITY.md\">\n        <img src=\"https://img.shields.io/badge/Report%20Security%20Concern-blue?style=for-the-badge\" />\n    </a>\n    <a href=\"https://github.com/DevelopersToolbox/notify-package/issues\">\n        <img src=\"https://img.shields.io/badge/Get%20Support-blue?style=for-the-badge\" />\n    </a>\n</p>\n\n## Overview\n\nThe Notify package provides a set of utility functions for printing formatted messages to the terminal. The main purpose of this\nmodule is to facilitate the display of success, warning, error, informational, and system messages with specific color and style\nformatting using predefined constants.\n\n## Features\n\n- Display success messages with green text.\n- Display warning messages with yellow text.\n- Display error messages with red text.\n- Display informational messages with cyan text.\n- Display system messages with grey text.\n- Support for custom colors, prompts, and formatting scopes.\n- Error handling for invalid colors and scopes.\n\n## Installation\n\nTo install the Notify package, use the following command:\n\n```bash\npip install wolfsoftware.notify\n```\n\n## Usage\n\nHere is an example of how to use the notification functions provided by the Notify package:\n\n```python\nfrom wolfsoftware.notify import success_message, warning_message, error_message, info_message, system_message\n\nprint(success_message(\"Operation completed successfully.\"))\nprint(warning_message(\"This is a warning message.\"))\nprint(error_message(\"An error occurred.\"))\nprint(info_message(\"This is some information.\"))\nprint(system_message(\"System update available.\"))\n```\n\n## Functions\n\n### `success_message`\n\nPrint a success message with a specific format.\n\n```python\ndef success_message(\n        message: str,\n        color: str = 'green+bold',\n        prompt: str = 'Success',\n        scope: str = 'prompt_text',\n        prompt_prefix: str = '[ ',\n        prompt_suffix: str = ' ]'\n    ) -> str:\n```\n\n### `warning_message`\n\nPrint a warning message with a specific format.\n\n```python\ndef warning_message(\n        message: str,\n        color: str = 'yellow+bold',\n        prompt: str = 'Warning',\n        scope: str = 'prompt_text',\n        prompt_prefix: str = '[ ',\n        prompt_suffix: str = ' ]'\n    ) -> str:\n```\n\n### `error_message`\n\nPrint an error message with a specific format.\n\n```python\ndef error_message(\n        message: str,\n        color: str = 'red+bold',\n        prompt: str = 'Error',\n        scope: str = 'prompt_text',\n        prompt_prefix: str = '[ ',\n        prompt_suffix: str = ' ]'\n    ) -> str:\n```\n\n### `failure_message`\n\nAlias for `error_message`, but with a prompt='Failure'.\n\n```python\nfailure_message = error_message\n```\n\n### `info_message`\n\nPrint an informational message with a specific format.\n\n```python\ndef info_message(\n        message: str,\n        color: str = 'cyan+bold',\n        prompt: str = 'Info',\n        scope: str = 'prompt_text',\n        prompt_prefix: str = '[ ',\n        prompt_suffix: str = ' ]'\n    ) -> str:\n```\n\n### `system_message`\n\nPrint a system message with a specific format.\n\n```python\ndef system_message(\n        message: str,\n        color: str = 'grey+bold',\n        prompt: str = 'System',\n        scope: str = 'prompt_text',\n        prompt_prefix: str = '[ ',\n        prompt_suffix: str = ' ]'\n    ) -> str:\n```\n\n## Customization\n\nYou can customize the color, prompt text, and the scope of the color application using the provided parameters. Here are some examples:\n\n### Custom Colors\n\n```python\nprint(success_message(\"Operation completed successfully.\", color=\"blue+bold\"))\n```\n\n### Custom Prompts\n\n```python\nprint(success_message(\"Operation completed successfully.\", prompt=\"Completed\"))\n```\n\n### Custom Scopes\n\n- `all`: Applies the color to the entire message.\n- `prompt`: Applies the color to the prompt only.\n- `prompt_text`: Applies the color to the text inside the brackets.\n\n```python\nprint(success_message(\"Operation completed successfully.\", scope=\"prompt\"))\nprint(success_message(\"Operation completed successfully.\", scope=\"prompt_text\"))\n```\n\n### Custom Prefixes and Suffixes\n\nYou can also customize the prompt prefix and suffix.\n\n```python\nprint(success_message(\"Operation completed successfully.\", prompt_prefix=\"<<\", prompt_suffix=\">>\"))\n```\n\n## Error Handling\n\nThe Notify package includes error handling for invalid color and scope inputs. If an invalid color or scope is provided, a `NotifyValueError` will be raised with an appropriate error message.\n\n```python\nfrom wolfsoftware.notify import NotifyValueError\n\ntry:\n    print(success_message(\"Operation completed successfully.\", color=\"invalid\"))\nexcept NotifyValueError as e:\n    print(f\"Error: {e}\")\n```\n\n## Testing\n\nThe Notify package includes a comprehensive test suite to ensure the correct functionality of all message formatting functions. The tests verify that the package version is defined, the message functions return correctly formatted strings, and exceptions are raised appropriately for invalid inputs.\n\n### Running Tests\n\nTo run the tests, use a testing framework such as pytest:\n\n```bash\npytest tests/test_notify.py\n```\n\n## Acknowledgements\n\nThe Notify package uses the `colorama` library for cross-platform support of ANSI color codes. Many thanks to the contributors of the `colorama` project for their excellent work.\n\n<br />\n<p align=\"right\"><a href=\"https://wolfsoftware.com/\"><img src=\"https://img.shields.io/badge/Created%20by%20Wolf%20on%20behalf%20of%20Wolf%20Software-blue?style=for-the-badge\" /></a></p>\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Generate console base notification messages.",
    "version": "0.1.2",
    "project_urls": {
        "Documentation": "https://github.com/DevelopersToolbox/notify-package",
        "Homepage": "https://github.com/DevelopersToolbox/notify-package",
        "Source": "https://github.com/DevelopersToolbox/notify-package",
        "Sponsor": "https://github.com/sponsors/WolfSoftware",
        "Tracker": "https://github.com/DevelopersToolbox/notify-package/issues/"
    },
    "split_keywords": [
        "python",
        " notify"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7e49eaef5c34820b82561e3d3e2fcf289da7f5750e09fb78ecfd7470fbb2c6a4",
                "md5": "e97ef5cf3d67793b2b0debea7aa7168f",
                "sha256": "2a8d3e58d2226d6e166f6ab37e529500babc02a11e0f37a3e61cd57a1cb9e490"
            },
            "downloads": -1,
            "filename": "wolfsoftware.notify-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e97ef5cf3d67793b2b0debea7aa7168f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 9221,
            "upload_time": "2024-06-24T17:59:43",
            "upload_time_iso_8601": "2024-06-24T17:59:43.261832Z",
            "url": "https://files.pythonhosted.org/packages/7e/49/eaef5c34820b82561e3d3e2fcf289da7f5750e09fb78ecfd7470fbb2c6a4/wolfsoftware.notify-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f952d3cab4e104bbf84054d99393d004cd026217a1397983f0a7463330ce71ee",
                "md5": "da835fc02f5aab991b88ed371158fbf3",
                "sha256": "2935064ab0448e958a61f5de43dcb34bcc83735c5df13da1bc1ddc2f5f748c0a"
            },
            "downloads": -1,
            "filename": "wolfsoftware_notify-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "da835fc02f5aab991b88ed371158fbf3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 13961,
            "upload_time": "2024-06-24T17:59:44",
            "upload_time_iso_8601": "2024-06-24T17:59:44.807684Z",
            "url": "https://files.pythonhosted.org/packages/f9/52/d3cab4e104bbf84054d99393d004cd026217a1397983f0a7463330ce71ee/wolfsoftware_notify-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-24 17:59:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DevelopersToolbox",
    "github_project": "notify-package",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "colorama",
            "specs": [
                [
                    "==",
                    "0.4.6"
                ]
            ]
        }
    ],
    "lcname": "wolfsoftware.notify"
}
        
Elapsed time: 4.25495s