# auro_utils
Auro Utils is a utility toolkit, providing enhanced logging, performance profiling, etc.
## Install
### Install from pip
```bash
pip install auro_utils
```
### Install from source
```bash
git clone https://github.com/Auromix/auro_utils
cd auro_utils
pip install -e .
```
## Test
```bash
cd auro_utils
python3 -m pytest -v .
```
## Usage
Following are some simplified examples of utilities offered by this package.
You can also find detailed examples in the `examples` folder.
```bash
cd auro_utils/examples
```
## Loggers
### logger
Logger is a class that can be used to log messages to the console and to a file. It is a wrapper around loguru.
```python
from auro_utils.loggers.logger import Logger
my_logger = Logger()
my_logger.log_info("This is a info log test.")
```
![logger_cmd](/assets/images/loggers/logger_cmd.png)
### classic logger
Classic logger is a class that can be used to log messages to the console and to a file. It is a wrapper around the standard python logging module.
```python
from auro_utils.loggers.logger_classic import Logger
my_logger = Logger()
my_logger.log_info("This is a info log test.")
```
## Profilers
### profiler
Decorator for profiling and analyzing performance of functions. It is a wrapper around yappi.
```python
from auro_utils.profilers.profiler import auro_profiler
@auro_profiler
def your_function_code():
import time
time.sleep(2)
```
![profiler_cmd](/assets/images/profilers/profiler_cmd.png)
![profiler_web](/assets/images/profilers/profile_results.png)
## IO
### file_operator
Functions in file_operator can be used to read and write files and process paths.
```python
# Get the project top level directory
from auro_utils.io.file_operator import get_project_top_level_dir
project_top_dir=get_project_top_level_dir()
print(project_top_dir)
# Read a toml file
from auro_utils.io.file_operator import read_toml
config = read_toml(project_top_dir+ "/config.toml")
print(config)
```
## Install
```bash
pip install auro_utils
```
## Troubleshooting
### ModuleNotFoundError
Make sure you have installed the package correctly. See [Install](#install) section.
### Want to uninstall
```bash
pip uninstall auro_utils
```
## Contribute
Please refer to [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
Raw data
{
"_id": null,
"home_page": "https://github.com/Hermanye996/auro_utils",
"name": "auro-utils",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "auro_utils",
"author": "Herman Ye",
"author_email": "hermanye233@icloud.com",
"download_url": "https://files.pythonhosted.org/packages/cc/ad/e79b486f6e20c30da52ccf5acf02c11e3ee2a8eea2d327b890c8bd131956/auro_utils-0.0.6.tar.gz",
"platform": null,
"description": "# auro_utils\n\nAuro Utils is a utility toolkit, providing enhanced logging, performance profiling, etc.\n\n## Install\n\n### Install from pip\n\n```bash\npip install auro_utils\n```\n\n### Install from source\n\n```bash\ngit clone https://github.com/Auromix/auro_utils\ncd auro_utils\npip install -e .\n```\n\n## Test\n\n```bash\ncd auro_utils\npython3 -m pytest -v .\n```\n\n## Usage\n\nFollowing are some simplified examples of utilities offered by this package.\n\nYou can also find detailed examples in the `examples` folder.\n\n```bash\ncd auro_utils/examples\n```\n\n## Loggers\n\n### logger\n\nLogger is a class that can be used to log messages to the console and to a file. It is a wrapper around loguru.\n\n```python\nfrom auro_utils.loggers.logger import Logger\nmy_logger = Logger()\nmy_logger.log_info(\"This is a info log test.\")\n```\n\n![logger_cmd](/assets/images/loggers/logger_cmd.png)\n\n### classic logger\n\nClassic logger is a class that can be used to log messages to the console and to a file. It is a wrapper around the standard python logging module.\n\n```python\nfrom auro_utils.loggers.logger_classic import Logger\nmy_logger = Logger()\nmy_logger.log_info(\"This is a info log test.\")\n```\n\n## Profilers\n\n### profiler\n\nDecorator for profiling and analyzing performance of functions. It is a wrapper around yappi.\n\n```python\nfrom auro_utils.profilers.profiler import auro_profiler\n@auro_profiler\ndef your_function_code():\n import time\n time.sleep(2)\n```\n\n![profiler_cmd](/assets/images/profilers/profiler_cmd.png)\n\n![profiler_web](/assets/images/profilers/profile_results.png)\n\n## IO\n\n### file_operator\n\nFunctions in file_operator can be used to read and write files and process paths.\n\n```python\n# Get the project top level directory\nfrom auro_utils.io.file_operator import get_project_top_level_dir\nproject_top_dir=get_project_top_level_dir()\nprint(project_top_dir)\n\n# Read a toml file\nfrom auro_utils.io.file_operator import read_toml\nconfig = read_toml(project_top_dir+ \"/config.toml\")\nprint(config)\n\n```\n\n## Install\n\n```bash\npip install auro_utils\n```\n\n## Troubleshooting\n\n### ModuleNotFoundError\n\nMake sure you have installed the package correctly. See [Install](#install) section.\n\n### Want to uninstall\n\n```bash\npip uninstall auro_utils\n```\n\n## Contribute\n\nPlease refer to [CONTRIBUTING.md](CONTRIBUTING.md) for more information.\n",
"bugtrack_url": null,
"license": "Apache Software License 2.0",
"summary": "Auro Utils is a utility package offering various practical supports for the Auromix application, such as enhanced logging capabilities and more.",
"version": "0.0.6",
"project_urls": {
"Homepage": "https://github.com/Hermanye996/auro_utils"
},
"split_keywords": [
"auro_utils"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7a028ba388de2887fb73607a3c36269326a814e278e8b45b10cadd3ba7d7f57e",
"md5": "42557c63d894729ee28ae1f74cecfc73",
"sha256": "0c312595578a222de5dba67a52923ff60cbe60d4c905cd41046363353a5b0d51"
},
"downloads": -1,
"filename": "auro_utils-0.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "42557c63d894729ee28ae1f74cecfc73",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 25038,
"upload_time": "2024-10-18T09:12:59",
"upload_time_iso_8601": "2024-10-18T09:12:59.448009Z",
"url": "https://files.pythonhosted.org/packages/7a/02/8ba388de2887fb73607a3c36269326a814e278e8b45b10cadd3ba7d7f57e/auro_utils-0.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ccade79b486f6e20c30da52ccf5acf02c11e3ee2a8eea2d327b890c8bd131956",
"md5": "869c23fee6ecd29229c6b39bc36dda88",
"sha256": "0abc380adbe368526a908e494cda74b3910b49632a59e76b0681887668df0f10"
},
"downloads": -1,
"filename": "auro_utils-0.0.6.tar.gz",
"has_sig": false,
"md5_digest": "869c23fee6ecd29229c6b39bc36dda88",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 18532,
"upload_time": "2024-10-18T09:13:00",
"upload_time_iso_8601": "2024-10-18T09:13:00.423262Z",
"url": "https://files.pythonhosted.org/packages/cc/ad/e79b486f6e20c30da52ccf5acf02c11e3ee2a8eea2d327b890c8bd131956/auro_utils-0.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-18 09:13:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Hermanye996",
"github_project": "auro_utils",
"github_not_found": true,
"lcname": "auro-utils"
}