# Antho Utils
## Description
This package is a collection of useful helpers that I regularly use in my projects. It uses a single lightweight
dependency: PyYAML. I made a public package because I think it might be helpful to others as well. The following presents
a short description of each module.
### Color
A zero dependencies api to add color to the terminal. It supports 256 colors and 24-bit colors (True color). It is also
possible to theme the colors, so you can use consistent colors in your project. It includes a traceback formatting tool
that automatically add colors to the traceback, in order to make it easier and quicker to read. (I use this function in
all of my projects)
### ConfigFile
A simple api to load and parse configuration files. It supports YAML files. You can verify the configuration format with
a template with a single parameter. This can be helpful when you have a long task, such as training a neural network,
and you access some keys in the config later. You do not want your long task to crash after few hours or even days
because you have the wrong type on a missing key in your config.
It also supports different Profiles, so the same configuration file can be used on different machines or for different
, but analogous, tasks. For example, if I want a to run my script locally for quicker developpement, but I train on a
HPC server, I do not want to make two configurations files that are almost identical, I can simply create two profiles
in the same configuration file with different paths or values, and use the appropriate profile depending on the machine.
### Logger
A simple implementation of a logger that is easy to use, and is highly customizable. It integrates well with the Color
api. I usually define three loggers: log, warning and error. The log logger is used for general information. The warning
logger is used for unusual patterns that could be bugs, but won't crash the program. Finally, the error logger is used
for non-blocking errors that should be looked into. Each logger has its own formatting rules. You can create as many
different loggers as you like. Once created, a logger can be used just like python's print function. Example:
```python
log = Logger(...)
log("This is a log message")
```
### Progress
This module has a similar function - and usage synthax - to tqdm. However, I believe it is more customizable than tqdm, and more suitable for
deep learning progress bar. It also implements out of the box three different types of progress bars: a tqdm-like,
a deep-learning one (keras-like) and a pip-like progress bar. It is also possible, and easy to create your own
progress bar. Let's look at an example:
```python
# tqdm-like
for i in progress(range(100)):
time.sleep(0.1)
# keras-like, it will report the loss value in the progress bar in real-time
for bar, batch in progress(dataloader, type="dl").ref():
time.sleep(0.1)
bar.repport(loss=...)
# pip-like
for i in progress(range(100), type="pip"):
time.sleep(0.1)
```
## Installation
It is as easy to install as:
```shell
pip install antho-utils
```
## Usage
For a basic usage, you can import everything from the package:
```python
from pyutils import *
```
or, you can also import the desired tools/modules:
```python
from pyutils.color import Colors, ResetColor, TraceBackColor, ConfigFile, Logger, LoggerType, progress, prange
```
For a more detailed usage, or to see how you can configure/customize each tool, see the documentation of each module.
## Documentation
You can go take a look at the [docs](docs) folder to see the documentation of each module.
Raw data
{
"_id": null,
"home_page": "https://github.com/anthol42/myPyUtils/tree/main",
"name": "antho-utils",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "MyPyUtils, utils, utilities, python, helpers, tools, datascience",
"author": "Anthony Lavertu",
"author_email": "alavertu2@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/78/70/5ca15fd4fbc3da75bbc795b4af88ff29e0a6e4e67067372eaef2085555e5/antho_utils-0.0.2.tar.gz",
"platform": null,
"description": "# Antho Utils\n## Description\nThis package is a collection of useful helpers that I regularly use in my projects. It uses a single lightweight \ndependency: PyYAML. I made a public package because I think it might be helpful to others as well. The following presents\na short description of each module.\n\n### Color\nA zero dependencies api to add color to the terminal. It supports 256 colors and 24-bit colors (True color). It is also\npossible to theme the colors, so you can use consistent colors in your project. It includes a traceback formatting tool\nthat automatically add colors to the traceback, in order to make it easier and quicker to read. (I use this function in \nall of my projects)\n\n### ConfigFile\nA simple api to load and parse configuration files. It supports YAML files. You can verify the configuration format with\na template with a single parameter. This can be helpful when you have a long task, such as training a neural network,\nand you access some keys in the config later. You do not want your long task to crash after few hours or even days \nbecause you have the wrong type on a missing key in your config.\n\nIt also supports different Profiles, so the same configuration file can be used on different machines or for different\n, but analogous, tasks. For example, if I want a to run my script locally for quicker developpement, but I train on a \nHPC server, I do not want to make two configurations files that are almost identical, I can simply create two profiles \nin the same configuration file with different paths or values, and use the appropriate profile depending on the machine.\n\n### Logger\nA simple implementation of a logger that is easy to use, and is highly customizable. It integrates well with the Color \napi. I usually define three loggers: log, warning and error. The log logger is used for general information. The warning\nlogger is used for unusual patterns that could be bugs, but won't crash the program. Finally, the error logger is used \nfor non-blocking errors that should be looked into. Each logger has its own formatting rules. You can create as many \ndifferent loggers as you like. Once created, a logger can be used just like python's print function. Example:\n```python\nlog = Logger(...)\nlog(\"This is a log message\")\n```\n\n### Progress\nThis module has a similar function - and usage synthax - to tqdm. However, I believe it is more customizable than tqdm, and more suitable for\ndeep learning progress bar. It also implements out of the box three different types of progress bars: a tqdm-like,\na deep-learning one (keras-like) and a pip-like progress bar. It is also possible, and easy to create your own \nprogress bar. Let's look at an example:\n```python\n# tqdm-like\nfor i in progress(range(100)):\n time.sleep(0.1)\n# keras-like, it will report the loss value in the progress bar in real-time\nfor bar, batch in progress(dataloader, type=\"dl\").ref():\n time.sleep(0.1)\n bar.repport(loss=...)\n# pip-like\nfor i in progress(range(100), type=\"pip\"):\n time.sleep(0.1)\n```\n\n## Installation\nIt is as easy to install as:\n```shell\npip install antho-utils\n```\n\n## Usage\nFor a basic usage, you can import everything from the package:\n```python\nfrom pyutils import *\n```\nor, you can also import the desired tools/modules:\n```python\nfrom pyutils.color import Colors, ResetColor, TraceBackColor, ConfigFile, Logger, LoggerType, progress, prange\n```\nFor a more detailed usage, or to see how you can configure/customize each tool, see the documentation of each module.\n\n## Documentation\nYou can go take a look at the [docs](docs) folder to see the documentation of each module.\n",
"bugtrack_url": null,
"license": null,
"summary": "useful utilities for python and datascience",
"version": "0.0.2",
"project_urls": {
"Homepage": "https://github.com/anthol42/myPyUtils/tree/main",
"Issues": "https://github.com/anthol42/myPyUtils/issues"
},
"split_keywords": [
"mypyutils",
" utils",
" utilities",
" python",
" helpers",
" tools",
" datascience"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "78705ca15fd4fbc3da75bbc795b4af88ff29e0a6e4e67067372eaef2085555e5",
"md5": "ee2a7813ba1fbbe0f46dd39ff122ad5d",
"sha256": "929d78e6a1330bfd54024cd98020957f13816c57285d5e225c92b166feb9288c"
},
"downloads": -1,
"filename": "antho_utils-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "ee2a7813ba1fbbe0f46dd39ff122ad5d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 23278,
"upload_time": "2025-01-09T17:34:09",
"upload_time_iso_8601": "2025-01-09T17:34:09.645212Z",
"url": "https://files.pythonhosted.org/packages/78/70/5ca15fd4fbc3da75bbc795b4af88ff29e0a6e4e67067372eaef2085555e5/antho_utils-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-09 17:34:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "anthol42",
"github_project": "myPyUtils",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "PyYAML",
"specs": []
},
{
"name": "setuptools",
"specs": []
},
{
"name": "twine",
"specs": []
}
],
"lcname": "antho-utils"
}