Skip to main content

Python convenient utilities for personal usage

Project description

Python Package: markkk

Convenient Python utilities for personal usage

Install

pip install --upgrade markkk

Usage

Generic Colored 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.

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")

The logger has three logging handlers:

  1. log to file log_debug.log which captures all logs with timestamp.
  2. log to file log_error.log which captures error & critical logs with timestamp.
  3. log to console with colors for different logging levels.

Sub-module: check_text_encoding

  • is_ascii
  • check_non_ascii_index
  • is_ascii_only_file
  • check_file_by_line
  • ensure_no_zh_punctuation
  • replace_punc_for_file

Example:

from markkk.pyutils import *

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 python-utils

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for markkk, version 0.0.11
Filename, size File type Python version Upload date Hashes
Filename, size markkk-0.0.11-py3-none-any.whl (5.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size markkk-0.0.11.tar.gz (5.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page