wolfsoftware.notify
Provides a set of utility functions for printing formatted messages to the terminal
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.3%) to scientific vocabulary
Keywords
Repository
Provides a set of utility functions for printing formatted messages to the terminal
Basic Info
Statistics
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 3
- Releases: 4
Topics
Metadata Files
README.md
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 successmessage, warningmessage, errormessage, infomessage, system_message
print(successmessage("Operation completed successfully.")) print(warningmessage("This is a warning message.")) print(errormessage("An error occurred.")) print(infomessage("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.
Owner
- Name: Developers Toolbox
- Login: DevelopersToolbox
- Kind: organization
- Email: github@wolfsoftware.com
- Location: United Kingdom
- Website: https://wolfsoftware.com
- Twitter: wolfsoftware
- Repositories: 24
- Profile: https://github.com/DevelopersToolbox
A selection of tools to help developers. Created by Wolf Software.
Citation (CITATION.cff)
cff-version: 1.2.0
message: If you use this software, please cite it using these metadata.
title: Notify
abstract: Create various message types, success, warning, error, info and system.
type: software
version: 0.1.2
date-released: 2024-06-24
repository-code: https://github.com/DevelopersToolbox/notify-package
keywords:
- "Wolf Software"
- "Software"
license: MIT
authors:
- family-names: "Wolf"
orcid: "https://orcid.org/0009-0007-0983-2072"
GitHub Events
Total
- Delete event: 81
- Issue comment event: 155
- Push event: 131
- Pull request review event: 120
- Pull request event: 159
- Create event: 85
Last Year
- Delete event: 81
- Issue comment event: 155
- Push event: 131
- Pull request review event: 120
- Pull request event: 159
- Create event: 85
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 0
- Total pull requests: 185
- Average time to close issues: N/A
- Average time to close pull requests: 2 days
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 1.68
- Merged pull requests: 139
- Bot issues: 0
- Bot pull requests: 185
Past Year
- Issues: 0
- Pull requests: 155
- Average time to close issues: N/A
- Average time to close pull requests: 2 days
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 1.69
- Merged pull requests: 114
- Bot issues: 0
- Bot pull requests: 155
Top Authors
Issue Authors
Pull Request Authors
- dependabot[bot] (250)
- TGWolf (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 535 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 3
- Total maintainers: 1
pypi.org: wolfsoftware.notify
Generate console base notification messages.
- Homepage: https://github.com/DevelopersToolbox/notify-package
- Documentation: https://github.com/DevelopersToolbox/notify-package
- License: MIT
-
Latest release: 0.1.2
published over 1 year ago
Rankings
Maintainers (1)
Dependencies
- ActionsToolbox/get-language-versions-action 446919617fd774095b5dd3ed71c39dd3fd0d8f4f composite
- actions/checkout a5ac7e51b41094c92402da3b24376905380afc29 composite
- actions/setup-python 82c7e631bb3cdc910f68e0081d67478d79c6982d composite
- ActionsToolbox/get-language-versions-action 446919617fd774095b5dd3ed71c39dd3fd0d8f4f composite
- actions/checkout a5ac7e51b41094c92402da3b24376905380afc29 composite
- citation-file-format/cffconvert-github-action 4cf11baa70a673bfdf9dad0acc7ee33b3f4b6084 composite
- ruby/setup-ruby 943103cae7d3f1bb1e4951d5fcc7928b40e4b742 composite
- Gamesight/slack-workflow-status 68bf00d0dbdbcb206c278399aa1ef6c14f74347a composite
- actions/checkout a5ac7e51b41094c92402da3b24376905380afc29 composite
- github/codeql-action/analyze a57c67b89589d2d13d5ac85a9fc4679c7539f94c composite
- github/codeql-action/autobuild a57c67b89589d2d13d5ac85a9fc4679c7539f94c composite
- github/codeql-action/init a57c67b89589d2d13d5ac85a9fc4679c7539f94c composite
- Gamesight/slack-workflow-status 68bf00d0dbdbcb206c278399aa1ef6c14f74347a composite
- actions/checkout a5ac7e51b41094c92402da3b24376905380afc29 composite
- github/codeql-action/analyze a57c67b89589d2d13d5ac85a9fc4679c7539f94c composite
- github/codeql-action/autobuild a57c67b89589d2d13d5ac85a9fc4679c7539f94c composite
- github/codeql-action/init a57c67b89589d2d13d5ac85a9fc4679c7539f94c composite
- Gamesight/slack-workflow-status 68bf00d0dbdbcb206c278399aa1ef6c14f74347a composite
- Mattraks/delete-workflow-runs 39f0bbed25d76b34de5594dceab824811479e5de composite
- dependabot/fetch-metadata 5e5f99653a5b510e8555840e80cbf1514ad4af38 composite
- ActionsToolbox/get-language-versions-action 446919617fd774095b5dd3ed71c39dd3fd0d8f4f composite
- actions/checkout a5ac7e51b41094c92402da3b24376905380afc29 composite
- actions/setup-node 60edb5dd545a775178f52524783378180af0d1f8 composite
- ruby/setup-ruby 943103cae7d3f1bb1e4951d5fcc7928b40e4b742 composite
- ActionsToolbox/get-language-versions-action 446919617fd774095b5dd3ed71c39dd3fd0d8f4f composite
- Bullrich/generate-release-changelog 6b60f004b4bf12ff271603dc32dbd261965ad2f2 composite
- actions/checkout a5ac7e51b41094c92402da3b24376905380afc29 composite
- actions/setup-python 82c7e631bb3cdc910f68e0081d67478d79c6982d composite
- softprops/action-gh-release 69320dbe05506a9a39fc8ae11030b214ec2d1f87 composite
- ActionsToolbox/get-language-versions-action 446919617fd774095b5dd3ed71c39dd3fd0d8f4f composite
- Bullrich/generate-release-changelog 6b60f004b4bf12ff271603dc32dbd261965ad2f2 composite
- actions/checkout a5ac7e51b41094c92402da3b24376905380afc29 composite
- actions/setup-python 82c7e631bb3cdc910f68e0081d67478d79c6982d composite
- softprops/action-gh-release 69320dbe05506a9a39fc8ae11030b214ec2d1f87 composite
- actions/first-interaction 34f15e814fe48ac9312ccf29db4e74fa767cbab7 composite
- Gamesight/slack-workflow-status 68bf00d0dbdbcb206c278399aa1ef6c14f74347a composite
- otto-de/purge-deprecated-workflow-runs 31a4e821d43e9a354cbd65845922c76e4b4b3633 composite
- ActionsToolbox/get-language-versions-action 446919617fd774095b5dd3ed71c39dd3fd0d8f4f composite
- actions/checkout a5ac7e51b41094c92402da3b24376905380afc29 composite
- actions/setup-go cdcb36043654635271a94b9a6d1392de5bb323a7 composite
- actions/setup-python 82c7e631bb3cdc910f68e0081d67478d79c6982d composite
- actions/checkout a5ac7e51b41094c92402da3b24376905380afc29 composite
- zgosalvez/github-actions-ensure-sha-pinned-actions 40e45e738b3cad2729f599d8afc6ed02184e1dbd composite
- Gamesight/slack-workflow-status 68bf00d0dbdbcb206c278399aa1ef6c14f74347a composite
- actions/stale 28ca1036281a5e5922ead5184a1bbf96e5fc984e composite
- colorama ==0.4.6
- pytest ==8.2.1
- setuptools ==70.0.0