A python lib created from Difficult Rocket development
Project description
lib-not-dr
A python lib came from Difficult Rocket development
一个在 Difficult Rocket 开发中 分离出来的 python 库
Information/信息
- Version / 版本: 0.3.0-rc.2
- Author / 作者: shenjackyuanjie 3695888@qq.com
License/许可证
安装/Install
pip install lib-not-dr
pip install lib-not-dr[nuitka]
# install with nuitka support
发布计划 / Release Plan
使用/Usage
Logger
WIP 等待 0.4.0
from lib_not_dr import loggers
logger = loggers.get_logger("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 pyproject paser
pyproject.toml
内的配置 Config inpyproject.toml
前往 example/nuitka 查看更多例子
[tool.lndl.nuitka.cli]
main = "main.py"
# --main=main.py
standalone = true
onefile = false
[tool.lndl.nuitka]
script = "xxx.py"
通过
lndl_nuitka
命令行工具使用 Use withlndl_nuitka
command line tool
lndl_nuitka .
lndl_nuitka . -- --onefile
# add --onefile to nuitka
lndl_nuitka . -y
# run without confirmation
lndl_nuitka . -n
# do not run
通过
lib_not_dr.nuitka.reader
模块使用 Use withlib_not_dr.nuitka.reader
from tomli import loads
from lib_not_dr.nuitka.reader import main, run_nuitka
pyproject_toml = loads(open("pyproject.toml", "r").read())
nuitka_config = pyproject_toml["tool"]["lndl"]["nuitka"]
nuitka_config["product_version"] = "0.1.0"
command = main(nuitka_config)
run_nuitka(command)
Nuitka Compiler Helper
Warning/警告
::: warning
已经弃用 Deprecated 请改用 lndl_nuitka / python -m lndl_nuitka
:::
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())
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
lib-not-dr-0.3.0rc2.tar.gz
(44.7 kB
view details)
Built Distribution
File details
Details for the file lib-not-dr-0.3.0rc2.tar.gz
.
File metadata
- Download URL: lib-not-dr-0.3.0rc2.tar.gz
- Upload date:
- Size: 44.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.10.4 CPython/3.8.18+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59c60ab2c3c7379a3dd8c92e3acef84458a4b687f68a2cbad6db1ec56792fb26 |
|
MD5 | b4b7dbadeca415542cfbf9e7e3413f80 |
|
BLAKE2b-256 | a983a92d4f5ed5e28d03d8fe70be82cf0ae7bb1ce6fe5e260f6df49c630b4e9e |
File details
Details for the file lib_not_dr-0.3.0rc2-py3-none-any.whl
.
File metadata
- Download URL: lib_not_dr-0.3.0rc2-py3-none-any.whl
- Upload date:
- Size: 48.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.10.4 CPython/3.8.18+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9b17138280f5f9d9393355742904f66512b88740d5142c6163a4a0ab433e755 |
|
MD5 | 9aebefe0519cbcdfb5bbffde3febab9c |
|
BLAKE2b-256 | 051ece1c1d489db70dbf14231f8b15f2818fdea2d767488542aa3085b15e80f9 |