{"id":18538104,"url":"https://github.com/bigmb/mb_utils","last_synced_at":"2026-03-05T06:02:38.671Z","repository":{"id":109157181,"uuid":"394110477","full_name":"bigmb/mb_utils","owner":"bigmb","description":"Repository for importing, exporting and reading all the basic file types","archived":false,"fork":false,"pushed_at":"2026-02-23T04:09:38.000Z","size":74,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-23T09:39:01.011Z","etag":null,"topics":["logging","python","s3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bigmb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-08-09T01:30:54.000Z","updated_at":"2026-02-23T04:09:41.000Z","dependencies_parsed_at":"2025-07-03T15:20:22.614Z","dependency_job_id":"67b43ab3-1c81-4f45-ab27-1ae413f58ce3","html_url":"https://github.com/bigmb/mb_utils","commit_stats":null,"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"purl":"pkg:github/bigmb/mb_utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmb%2Fmb_utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmb%2Fmb_utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmb%2Fmb_utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmb%2Fmb_utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bigmb","download_url":"https://codeload.github.com/bigmb/mb_utils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmb%2Fmb_utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30111779,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T03:40:26.266Z","status":"ssl_error","status_checked_at":"2026-03-05T03:39:15.902Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["logging","python","s3"],"created_at":"2024-11-06T19:42:20.426Z","updated_at":"2026-03-05T06:02:38.648Z","avatar_url":"https://github.com/bigmb.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MB Utils\n\n[![Python Version](https://img.shields.io/badge/python-3.8+-blue)](https://www.python.org/)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/bigmb/mb_utils/graphs/commit-activity)\n[![Downloads](https://static.pepy.tech/badge/mb_utils)](https://pepy.tech/project/mb_utils)\n\nA collection of utility functions and tools to simplify common Python development tasks. Part of the `mb` namespace — install as `mb_utils`, import as `mb.utils`.\n\n## Features\n\n- **Logging**: Easy-to-use logging with colored console output, rotating file handlers, and a safe `LoggerWrapper` (`logg`) that skips logging when no logger is provided\n- **File Operations**: Concurrent path checking and validation\n- **Decorators**: Deprecation warnings and retry logic\n- **Image Verification**: Validate image files (path, type, shape) with multithreading\n- **S3 Integration**: Simplified AWS S3 file and directory operations\n- **Profiling**: Function profiling with SnakeViz, line-by-line profiling\n- **Utilities**: Timer decorator, batch creation\n\n## Installation\n\n```bash\npip install mb_utils\n# or\nuv pip install mb_utils\n```\n\nThis installs under the `mb` namespace. Import everything via `mb.utils.*`.\n\n## Usage\n\n### Logging\n\n```python\nfrom mb.utils.logging import make_logger, logg\n\n# Create a logger with colored console + rotating file output\nlogger = make_logger('myapp')\nlogger.info(\"Direct logger usage\")\n\n# Safe logging wrapper — no need for `if logger:` checks\nlogg.info(\"This message logs\", logger)      # logs normally\nlogg.info(\"This is silenced\", None)          # does nothing\n\n# Set a default logger so you don't have to pass it every time\nlogg.set_default(logger)\nlogg.info(\"Uses default logger\")             # logs via default\nlogg.warning(\"Also works\")\n```\n\n### Path Checking\n\n```python\nfrom mb.utils.path_checker import check_path\n\n# Check a list of paths concurrently (returns list of bools)\nresults = check_path(['/path/to/file1', '/path/to/file2'], max_threads=16)\n```\n\n### Retry Decorator\n\n```python\nfrom mb.utils.retry_decorator import retry\n\n@retry(times=3, exceptions=(ValueError, TypeError))\ndef might_fail():\n    pass\n```\n\n### Deprecation Decorator\n\n```python\nfrom mb.utils.deprecated import deprecated_func\n\n@deprecated_func(deprecated_version=\"1.0\", suggested_func=\"new_func\", removed_version=\"3.0\")\ndef old_function():\n    pass\n```\n\n### S3 Operations\n\n```python\nfrom mb.utils.s3 import upload_file, download_file, upload_dir, download_dir, list_objects\n\n# Upload / download a single file\nupload_file('bucket-name', 'remote_key.txt', 'local_file.txt')\ndownload_file('bucket-name', 'remote_key.txt', 'local_file.txt')\n\n# Upload / download entire directories\nupload_dir('bucket-name', 's3/prefix', '/local/dir')\ndownload_dir('bucket-name', 's3/prefix', '/local/dir')\n\n# List objects\nlist_objects('bucket-name')\n```\n\n### Timer \u0026 Batch Utilities\n\n```python\nfrom mb.utils.extra import timer, batch_generator, batch_create\n\n@timer\ndef slow_function():\n    pass\n\n# Generator-based batching\nfor batch in batch_generator(range(100), batch_size=10):\n    process(batch)\n\n# List-based batching\nbatches = batch_create(my_list, n=10)\n```\n\n### Image Verification\n\n```python\nfrom mb.utils.verify_image import verify_image\n\nresults = verify_image(\n    image_paths=['/path/img1.jpg', '/path/img2.png'],\n    image_type='JPEG',           # optional: check format\n    image_shape=(1920, 1080),    # optional: check dimensions (width, height)\n    max_workers=16\n)\n# Returns list: True, False, 'image_type_mismatch', 'image_shape_mismatch', 'unknown_image_format'\n```\n\n### Profiling\n\n```python\nfrom mb.utils.profiler import run_with_snakeviz, line_profile\n\n# Profile and visualize with SnakeViz\n@run_with_snakeviz\ndef process_data(data):\n    pass\n\n# Save profile without opening SnakeViz\nrun_with_snakeviz(my_func, arg1, arg2, save_only=True, file_path=\"output.prof\")\n\n# Line-by-line profiling\n@line_profile\ndef process_item(item):\n    result = item * 2\n    return result\n```\n\n## Available Modules\n\n| Module | Description | Import Path |\n|--------|-------------|-------------|\n| logging | Logger with colored output, file rotation, safe wrapper | `from mb.utils.logging import make_logger, logg` |\n| path_checker | Concurrent path validation | `from mb.utils.path_checker import check_path` |\n| deprecated | Function deprecation decorator | `from mb.utils.deprecated import deprecated_func` |\n| verify_image | Image verification (path, type, shape) | `from mb.utils.verify_image import verify_image` |\n| retry_decorator | Retry mechanism for functions | `from mb.utils.retry_decorator import retry` |\n| s3 | AWS S3 upload/download/list operations | `from mb.utils.s3 import *` |\n| extra | Timer decorator, batch utilities | `from mb.utils.extra import *` |\n| profiler | SnakeViz and line profiling | `from mb.utils.profiler import *` |\n| terminal | Terminal size utilities | `from mb.utils.terminal import stty_size` |\n| version | Package version info | `from mb.utils.version import version` |\n\n## Included Scripts\n\n- `verify_images_script`: Utility script for batch image verification\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigmb%2Fmb_utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigmb%2Fmb_utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigmb%2Fmb_utils/lists"}