Skip to main content

wpath

wpath: a package help add project workspace to python search path and other many small tools

python开发的一系列小工具,核心功能:

  • 自动将当前项目的工作目录添加到python搜索包
    工作目录的定义是:该目录下面有常见的项目级文件:.env,.gitignore,package.json,go.mod,go.sum,tsconfig.json
  • 将某个目录添加到搜索目录
    wpath.add("your folder path")
  • 彩色 print
    红:print_r,绿:print_r,蓝:print_b,黄:print_y,粉:print_m,黑:print_k,白:print_w
  • 字典格式打印 print
  • 彩色日志处理模块 log
  • 时间处理模块 time
  • 代码调试模块 code

Install

git clone https://github.com/aeneashe/wpath
cd wpath
python setup.py install

or

pip install wpath

Env file

add one of flags [".env",".gitignore",".git","package.json"] into your project workspace.

Useage

  • auto detect workspace folder
import wpath
  • show workspace folder
import wpath
# this will add your workspace to python path
# by default, wpath will search parent folder which has an '.env' file as workspace flag

# show project workspace, 
# if not found the flag, wpath.workspace() will return None
print(wpath.workspace())
  • use your own flag as project folder root flag
import wpath
# change default flag
wpath.reset(['.gitignore'])
print(wpath.workspace())
  • color print
from wpath import print_r,print_g,print_b

print_r("red txt")
print_g("green txt")
print_b("blue txt")
  • time tool
from wpath import today,now,yesterday

print(today())
print(now())
print(yesterday())
  • log tool
    from wpath import ColoredLogger
    logging.setLoggerClass(ColoredLogger)
    
    # use file name as logname, you can use any str as logname
    # logname=__file__  
    # logname=__name__
    # logname="module"

    logname="test log"

    log = logging.getLogger(logname)
    log.setLevel(logging.DEBUG)

    log.debug("test debug")
    log.info("test info")
    log.warning("test warning")
    log.error("test error")
    log.critical("test critical")

Release files for wpath 0.1.4

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

Source distribution (sdist)

Source distribution for wpath 0.1.4
File Size Uploaded
wpath-0.1.4.tar.gz 11.9 kB Details

Release files / wpath-0.1.4.tar.gz

Download URL wpath-0.1.4.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
edc2be09cf12c8811504b512c3d8410fbebc58488b04ae50e6daecf9ef275d91
BLAKE2b-256 checksum
How to use checksums
a3ed122b416a210d9fb40716770b2b9c19dde4b4511b2416f5f61a4de340be44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.4 This release

1 release file

0.1.3

2 release files

0.1.2

2 release files

0.1.1

3 release files

0.1.0

1 release file

0.0.9

3 release files

0.0.8

2 release files

0.0.7

3 release files

0.0.6

2 release files

0.0.5

3 release files

0.0.4

2 release files

0.0.3

2 release files

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