semvec/pypi-packages huggingface dataset:
markkk 0.0.16
Python convenient utilities for personal usage
Requires Python: >=3.6

# Python Package: markkk

Convenient Python utilities for personal usage


## Install

```bash
pip install --upgrade markkk
```

## Usage

### Sub-module: `logger`

This is a pre-configured logger using python's built-in `logging` module and a formatter [`colorlog`](https://github.com/borntyping/python-colorlog). It is easy to use, simplest setup on earth, suitable for personal day-to-day debugging, personal small-scale projects.

The logger has three logging handlers:
1. log to file `logs/debug.log` which captures **all** logs with timestamp.
2. log to file `logs/error.log` which captures **error & critical** logs with timestamp.
3. log to console **with colors** for different logging levels.

Note:
- A new folder named `logs` will be created at the current working directory if not already exist.
- `debug.log` & `error.log` file will also be created if not already present under `logs`.

*Example*:

```python
from markkk.logger import logger

logger.debug("This is a debug message")
logger.info("This is a message for your information")
logger.warning("This is a warning message")
logger.error("This is an error message")
logger.critical("This is a critical error message")

```

![colored_log_in_console](docs/c_logger.png)

### Sub-module: `time`

- `timeit` (this is a decorator for your function)
- `timeitprint` (this is a decorator for your function)

*Example*:

```python
from markkk.time import timeitprint

@timeitprint
def tictok():
    a = 1000000
    for i in range(10000000):
        a -= 1
        b = a
    return

if __name__ == "__main__":
    tictok()
```

*Console output*:

```
====== Func 'tictok' finished in 0.3280000000 secs ======
```

### Sub-module: `file`

- `safe_rename`
- `safe_copy`
- `safe_move`

### Sub-module: `encoding`

- `is_ascii`
- `check_non_ascii_index`
- `is_ascii_only_file`
- `check_file_by_line`
- `ensure_no_zh_punctuation`
- `replace_punc_for_file`

*Example*:

```python
from markkk.encoding import replace_punc_for_file, is_ascii

replace_punc_for_file("test.txt")
is_ascii("。") # this returns false
```



## Development

### Install package using local version
*clone this repo*
```bash
git clone https://github.com/MarkHershey/python-utils.git
```
*go to project root*
```bash
cd markkk
```

*create virtual env for this project*
```bash
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip setuptools  wheel
pip install -r requirements.txt
```

*install this package in editable mode*
```bash
pip install -e .[dev]
```

### Run Unittest

*at project root*
```bash
tox
```

## License

- [MIT License]("LICENSE")
ptyprocess 0.7.0
Run a subprocess in a pseudo terminal

Launch a subprocess in a pseudo terminal (pty), and interact with both the
process and its pty.

Sometimes, piping stdin and stdout is not enough. There might be a password
prompt that doesn't read from stdin, output that changes when it's going to a
pipe rather than a terminal, or curses-style interfaces that rely on a terminal.
If you need to automate these things, running the process in a pseudo terminal
(pty) is the answer.

Interface::

    p = PtyProcessUnicode.spawn(['python'])
    p.read(20)
    p.write('6+6\n')
    p.read(20)