lib not dr at local
Go to file
2023-11-18 23:36:04 +08:00
docs feat: add logger to docs 2023-11-18 23:11:54 +08:00
example/logger merging TraceFormatter with TimeFormatter 2023-11-12 22:14:44 +08:00
lib_not_dr feat: add logger to docs 2023-11-18 23:11:54 +08:00
test/logger Add and use LogLevel 2023-11-06 00:19:39 +08:00
.gitignore add option version 2023-06-17 14:30:14 +08:00
.pdm-python use pdm to build 2023-06-24 20:30:01 +08:00
LICENSE Initial commit 2023-06-10 00:23:46 +08:00
pdm.lock readme update 2023-08-20 22:16:58 +08:00
pdm.toml use pdm to build 2023-06-24 20:30:01 +08:00
pyproject.toml enhance: 更改 readme.md 和 pyproject.toml 2023-11-18 23:36:04 +08:00
README.md enhance: 更改 readme.md 和 pyproject.toml 2023-11-18 23:36:04 +08:00

lib-not-dr

A python lib came from Difficult Rocket development

一个在 Difficult Rocket 开发中 分离出来的 python 库

Information/信息

  • Version / 版本: 0.2.0-alpha0
  • Author / 作者: shenjackyuanjie 3695888@qq.com

shenjackyuanjie

更新日志|Change Log

License/许可证

MPL-2.0

安装/Install

pip install lib-not-dr

使用/Usage

Logger

WIP 等待 0.2.0

from lib_not_dr.logger.logger import Logger

logger = Logger.get_logger_by_name("test")

logger.fine('Hello World!')
logger.debug('Hello World!')
logger.trace('Hello tracing!')
logger.info('Hello World!')  # info!
logger.warn('warnnnnnnn')
logger.error('Hello World!')
logger.fatal('good bye world')

# tag
logger.info('this message if from tag', tag='test')
logger.debug('this debug log if from admin', tag='admin')

# end
logger.debug('and this message ends with none', end=' ')
logger.trace('so this message will be in the same line', tag='same line!')

Nuitka Compiler Helper

simple example 简单示例

import subprocess
from pathlib import Path
from lib_not_dr.nuitka.compile import CompilerHelper

compiler = CompilerHelper(src_file = Path("main.py"))

print(compiler)
subprocess.run(compiler.gen_subprocess_cmd())

more complex example 复杂示例

import sys
import subprocess
from pathlib import Path
from lib_not_dr.nuitka.compile import CompilerHelper

compiler = CompilerHelper(src_file = Path("main.py"), run_after_build=True)

print(compiler)

if '-y' in sys.argv or '--yes' in sys.argv:
    do_run = True
elif '-n' in sys.argv or '--no' in sys.argv:
    do_run = False
else: # do_run is None
    while (do_run := input("compile? [y/n]").lower()) not in ["y", "n", "yes", "no"]:
        pass
        # 获取用户输入是否编译
        # get user confirmation to compile or not
    do_run = True if do_run[0] == "y" else False

if do_run:
    subprocess.run(compiler.gen_subprocess_cmd())