Metadata-Version: 2.4
Name: maikol-utils
Version: 0.8.2
Summary: Python module with some utils for every day code that I've seen usefull lately while working. Print, print colors, print warnings, print errors, save files, load files, clear bash
Author: Miquel Gómez
License: MIT
Project-URL: Homepage, https://github.com/MiquelGomezCorral/maikol-utils/
Project-URL: Miquel, https://miquelgc.net
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: natsort>=8.4.0
Dynamic: license-file

# Welcoome to maikol-utils 🧰 V 0.8.2
maikol-utils is a lightweight and reusable Python utility package designed to speed up and clean up your everyday scripting and automation workflows.

Whether you're handling JSON files, managing the file system, cleaning up terminal outputs, or improving logging with colored messages and structured separators - this module brings a collection of practical tools ready to use.

# 🧑‍💻 Author

Developed by [Miquel Gómez](https://miquelgc.net) – Python developer.
Hand-picked utilities from real-world scripting and automation tasks.

# Structure

```
├── LICENSE
├── README.md
├── maikol-utils
│   ├── __init__.py
│   ├── file_utils.py
│   ├── print_utils.py
│   └── time_tracker.py
├── pyproject.toml
├── setup.py
└── usage_examples.ipynb
```

# 🚀 Features

- 🔹 Filesystem helpers: Easily check, load, save, and create files/directories.
- 🖨️ Colorful terminal prints: Add colored, formatted, or warning messages to your logs.
- 📜 Visual bash separators: Make your CLI outputs more structured and readable.
- 🧹 Terminal cleanup: Clear or update printed lines in-place for dynamic feedback.

# 📦 Installation

Option 1: _With pip_

1. With pip: `pip install maikol-utils`

Option 2: _Clonning the repo_

1. Clone it from [github](https://github.com/MiquelGomezCorral/maikol-utils): `git clone https://github.com/MiquelGomezCorral/maikol-utils`

### Examples of each function at the repo notebook

- This [notebook](https://github.com/MiquelGomezCorral/maikol-utils/blob/main/usage_examples.ipynb)

# 📘 Usage

```python
from maikol_utils.print_utils import print_separator, print_warn, clear_bash
from maikol_utils.file_utils import save_json, load_json

# Save data to JSON
save_json("outputs/data.json", {"name": "maikol"})

# Load safely from JSON
data = load_json("outputs/data.json")

# Print a section title with visual separator
print_separator("Processing Data", sep_type="SUPER")

# Warn with color
print_warn("This file is missing some fields!")

# Clean last 2 terminal lines
clear_bash(2)
```

# Functions Overview

### File system

```python
save_json(path, content) # Save Python object to JSON.

load_json(path) # Load JSON or return empty dict if not found.

check_dirs_existance(paths) # Assert if dirs exist.

make_dirs(paths) # Create dirs if not present.

list_dir_files(path) # List all the files on a directory

change_file_ext(path, new_extensions) # Yes
```

### Terminal Printing

```python
print_separator(text, sep_type) # Print formatted section headers. 
# List of valid sep_type: ["SHORT", "NORMAL", "LONG", "SUPER", "START", "END"]

print_color(text, color) # Print in red, green, blue, etc.

print_warn(text) # Print warnings wrapped in ⚠️ emojis.

print_error(text) # Print errors wrapped in ❌ emojis.

print_status(msg) # Overwrite previous line with dynamic status.

clear_bash(n) # Clear n lines above in terminal.

print_clear_bash(text, n) # Clear then print a new message.

print_time(sec) # Print the time in seconds to pretty
```

### Other utils
```python
parse_seconds_to_minutes(sed) # Paste the time in seconds to pretty, just get the string not print

args_to_dataclass(agrs, data_class) 
# It will change all the fields that have ben added to the args.
# If a field is not added in the args will be ignored.
# Fields in the args that are not in the Config this will be ignored.
```

# Roadmap

- Add async support for I/O.
- Option to customize color themes.
- CLI preview tool for bash formatting.

### Upload

- If first time

```bash
pip install twine wheel build
pip install .
```

- Upload

```bash
rm -fr dist
python -m build
twine upload dist/*
```
