Skip to main content

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:

  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:

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

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_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:

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

Metadata

Release files for markkk 0.0.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for markkk 0.0.16
File Size Uploaded Provenance
markkk-0.0.16.tar.gz 6.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for markkk 0.0.16
File Interpreter ABI Platform
markkk-0.0.16-py3-none-any.whl Python 3 none any Details

Total release size: 14.7 kB

Release files / markkk-0.0.16.tar.gz

Download URL markkk-0.0.16.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cbb7e20aa2133622e280b10411bf7527609630edd86ea89341c214ad0b4cf223
BLAKE2b-256 checksum
How to use checksums
dcf0a6c03df5d50b58ea355f162b3837e1380d864ad10930c45c5a2a81101013
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / markkk-0.0.16-py3-none-any.whl

Download URL markkk-0.0.16-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c552bcc925c22dfe7185eb2fdc8aa86c1bc803c08891b6e5ad5c9c57d8b2471c
BLAKE2b-256 checksum
How to use checksums
39db1f1928587138681eb060428928e471f53985e7688aebdfdf1bbc82cd8c7a
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for markkk 0.0.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page