package help find the project root folder.
Project description
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")
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
wpath-0.1.3.tar.gz
(11.9 kB
view details)
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
wpath-0.1.3-py3.9.egg
(178.5 kB
view details)
File details
Details for the file wpath-0.1.3.tar.gz.
File metadata
- Download URL: wpath-0.1.3.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43476be14a503f0733d2b5eeb254d51151ab5d310a462e0f9c7bcb967a705499
|
|
| MD5 |
bf0eb33b035280038041cef68204e939
|
|
| BLAKE2b-256 |
48adba43015458f4623cc156b1a6db1fdce819b8b0a1bff6d70fb1cdc98e8554
|
File details
Details for the file wpath-0.1.3-py3.9.egg.
File metadata
- Download URL: wpath-0.1.3-py3.9.egg
- Upload date:
- Size: 178.5 kB
- Tags: Egg
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8f0ec9e465f077111fed0375555cf9b6c8ac730793f8d08033799654d00104a
|
|
| MD5 |
31dd024c17867f374dfc386203411a3f
|
|
| BLAKE2b-256 |
e42f06e57558e1fe726a60070f9cc0af0ccb78b3f8b60cb4c550fd64872389c6
|