Python convenient utilities for personal usage
Project description
Python Package: markkk
Convenient Python utilities for personal usage
Install
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. 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:
- log to file
logs/debug.logwhich captures all logs with timestamp. - log to file
logs/error.logwhich captures error & critical logs with timestamp. - log to console with colors for different logging levels.
Note:
- A new folder named
logswill be created at the current working directory if not already exist. debug.log&error.logfile will also be created if not already present underlogs.
Example:
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")
Sub-module: time
timeit(this is a decorator for your function)timeitprint(this is a decorator for your function)
Example:
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_renamesafe_copysafe_move
Sub-module: encoding
is_asciicheck_non_ascii_indexis_ascii_only_filecheck_file_by_lineensure_no_zh_punctuationreplace_punc_for_file
Example:
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
git clone https://github.com/MarkHershey/python-utils.git
go to project root
cd markkk
create virtual env for this project
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
pip install -e .[dev]
Run Unittest
at project root
tox
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file markkk-0.0.16.tar.gz.
File metadata
- Download URL: markkk-0.0.16.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbb7e20aa2133622e280b10411bf7527609630edd86ea89341c214ad0b4cf223
|
|
| MD5 |
31629dc9b40631270b1c4e5a88a309de
|
|
| BLAKE2b-256 |
dcf0a6c03df5d50b58ea355f162b3837e1380d864ad10930c45c5a2a81101013
|
File details
Details for the file markkk-0.0.16-py3-none-any.whl.
File metadata
- Download URL: markkk-0.0.16-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c552bcc925c22dfe7185eb2fdc8aa86c1bc803c08891b6e5ad5c9c57d8b2471c
|
|
| MD5 |
e8a89a24007769028d2c269bd884e2b6
|
|
| BLAKE2b-256 |
39db1f1928587138681eb060428928e471f53985e7688aebdfdf1bbc82cd8c7a
|