Skip to main content

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.2.0-rc.7
  • Author / 作者: shenjackyuanjie 3695888@qq.com

shenjackyuanjie

更新日志|Change Log

License/许可证

MPL-2.0

安装/Install

pip install lib-not-dr
pip install lib-not-dr[nuitka]
# install with nuitka support

使用/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 pyproject paser

WIP 等待 0.2.0

[tool.lndl.nuitka]
main = "main.py"
# --main=main.py
standalone = true
onefile = false
lndl_nuitka .
lndl_nuitka . -- --onefile
# add --onefile to nuitka
lndl_nuitka . -y
# run without confirmation
lndl_nuitka . -n
# do not run
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.2.0rc7.tar.gz (40.0 kB view details)

Uploaded Source

Built Distribution

lib_not_dr-0.2.0rc7-py3-none-any.whl (43.4 kB view details)

Uploaded Python 3

File details

Details for the file lib-not-dr-0.2.0rc7.tar.gz.

File metadata

  • Download URL: lib-not-dr-0.2.0rc7.tar.gz
  • Upload date:
  • Size: 40.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.10.3 CPython/3.8.18+

File hashes

Hashes for lib-not-dr-0.2.0rc7.tar.gz
Algorithm Hash digest
SHA256 4b2da6e01eb3190d8a23619c8704558487355d76592e6a53b5f716c91d58eaf7
MD5 21a7df49d79bcabf83fe946fd99516b1
BLAKE2b-256 c40882217bcb60c84818f71e198bfd0c37e91ba0ff3ca9d98afe41ee5dd15e1b

See more details on using hashes here.

File details

Details for the file lib_not_dr-0.2.0rc7-py3-none-any.whl.

File metadata

File hashes

Hashes for lib_not_dr-0.2.0rc7-py3-none-any.whl
Algorithm Hash digest
SHA256 782281563fdefe6a2fe9c9602058da897eac8b7ab9a351ae4ec8de322d7cef66
MD5 c2d176d4494f17424b2aaed7d9fc85c6
BLAKE2b-256 d3f53f5e46b6dfdc94b15f51156d34549f324789b7ca5554436ba2b38a445818

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page