# glampy
This project intends to allow building useful, reliable and beautiful python CLIs with ease.
## Installation
Stable release version:
```bash
pip install glampy
```
Latest development version:
```bash
pip install git+https://github.com/snaeil/glampy
```
## Usage
### Logging
The customized logger can be used in it's default optionated way or can be customized.
It is fully compatible with the standard python logging module.
```python
from glampy.logging import Logger
# Example using the Logger class to log to stdout and a file:
logger = Logger("my_logger", log_file="my_log.log", log_level=logging.DEBUG)
logger.debug("This is a debug message that will be logged to stdout and the file.")
# Example using the Logger class to log to a file only:
logger = Logger("my_logger", console_handler=None, log_level=logging.DEBUG)
logger.debug("This is a debug message that will be logged to a file only.")
# Example using the Logger class to log to stdout only:
logger = Logger("my_logger", log_level=logging.WARNING)
logger.warning("This is a warning message that will be logged to stdout only.")
logger.info("This is an info message that will not be logged.")
```
### Style
The style module provides a simple way to style text in the terminal.
See [the source code](https://github.com/snaeil/glampy/blob/main/glampy/style.py) for all available styles.
```python
from glampy.style import Style, Sign, Foreground_Colour, Background_Colour
# Example using the Style class to style text:
print(f"{Sign.WARNING} The word {Style.bold}bold{Style.RESET_ALL} is not {style.italic}italic{Style.RESET_ALL}.")
```
## Contributing
Contributions are welcome!
For feature requests, bug reports or questions, please open an issue.
For code contributions, please open a pull request.
Please make sure to install `pre-commit` before making changes to the code (this enables
checks for code formatting, linting, etc. before committing changes):
```bash
pip install poetry
poetry install
cd path/to/glampy
pre-commit install
```
Raw data
{
"_id": null,
"home_page": "https://github.com/snaeil/glampy",
"name": "glampy",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "cli, logging, styling, terminal",
"author": "snaeil",
"author_email": "schnegel@posteo.de",
"download_url": "https://files.pythonhosted.org/packages/75/9d/d84d2c9bba729c2326c903c2149af96049d81f02a0a9be8bbfbe0e71652e/glampy-0.2.8.tar.gz",
"platform": null,
"description": "# glampy\n\nThis project intends to allow building useful, reliable and beautiful python CLIs with ease.\n\n## Installation\n\nStable release version:\n\n```bash\npip install glampy\n```\n\nLatest development version:\n\n```bash\npip install git+https://github.com/snaeil/glampy\n```\n\n## Usage\n\n### Logging\n\nThe customized logger can be used in it's default optionated way or can be customized. \nIt is fully compatible with the standard python logging module.\n\n```python\nfrom glampy.logging import Logger\n\n# Example using the Logger class to log to stdout and a file:\nlogger = Logger(\"my_logger\", log_file=\"my_log.log\", log_level=logging.DEBUG)\nlogger.debug(\"This is a debug message that will be logged to stdout and the file.\")\n\n# Example using the Logger class to log to a file only:\nlogger = Logger(\"my_logger\", console_handler=None, log_level=logging.DEBUG)\nlogger.debug(\"This is a debug message that will be logged to a file only.\")\n\n# Example using the Logger class to log to stdout only:\nlogger = Logger(\"my_logger\", log_level=logging.WARNING)\nlogger.warning(\"This is a warning message that will be logged to stdout only.\")\nlogger.info(\"This is an info message that will not be logged.\")\n```\n\n### Style\n\nThe style module provides a simple way to style text in the terminal. \nSee [the source code](https://github.com/snaeil/glampy/blob/main/glampy/style.py) for all available styles.\n\n```python\nfrom glampy.style import Style, Sign, Foreground_Colour, Background_Colour\n\n# Example using the Style class to style text:\nprint(f\"{Sign.WARNING} The word {Style.bold}bold{Style.RESET_ALL} is not {style.italic}italic{Style.RESET_ALL}.\")\n```\n\n## Contributing\n\nContributions are welcome!\nFor feature requests, bug reports or questions, please open an issue.\nFor code contributions, please open a pull request.\n\nPlease make sure to install `pre-commit` before making changes to the code (this enables\nchecks for code formatting, linting, etc. before committing changes):\n\n```bash\npip install poetry\npoetry install\ncd path/to/glampy\npre-commit install\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Make your python CLI prints and logs simple but glamorous",
"version": "0.2.8",
"project_urls": {
"Bug Tracker": "https://github.com/snaeil/glampy/issues",
"Homepage": "https://github.com/snaeil/glampy",
"Repository": "https://github.com/snaeil/glampy"
},
"split_keywords": [
"cli",
" logging",
" styling",
" terminal"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "90c6240f860e67af4cf01421ffa6858521a140c4f6b2de4fb16cd5e5a2c29bdb",
"md5": "c8407ac060b76693112ffb7886cb6234",
"sha256": "0cf437d78690a4cfbbb8fece1224c0276bbb778ff117c6d15a4daf1009c64697"
},
"downloads": -1,
"filename": "glampy-0.2.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c8407ac060b76693112ffb7886cb6234",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 5213,
"upload_time": "2024-11-04T21:31:22",
"upload_time_iso_8601": "2024-11-04T21:31:22.983999Z",
"url": "https://files.pythonhosted.org/packages/90/c6/240f860e67af4cf01421ffa6858521a140c4f6b2de4fb16cd5e5a2c29bdb/glampy-0.2.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "759dd84d2c9bba729c2326c903c2149af96049d81f02a0a9be8bbfbe0e71652e",
"md5": "06da7033d2ca105340e995bb9b08e793",
"sha256": "8289101550252f95ecd95569e9cfbe0e5c1fc7d8d99fa9126265efbb420b2019"
},
"downloads": -1,
"filename": "glampy-0.2.8.tar.gz",
"has_sig": false,
"md5_digest": "06da7033d2ca105340e995bb9b08e793",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 4491,
"upload_time": "2024-11-04T21:31:23",
"upload_time_iso_8601": "2024-11-04T21:31:23.877524Z",
"url": "https://files.pythonhosted.org/packages/75/9d/d84d2c9bba729c2326c903c2149af96049d81f02a0a9be8bbfbe0e71652e/glampy-0.2.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-04 21:31:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "snaeil",
"github_project": "glampy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "glampy"
}